autoconf/lib
Zack Weinberg bfd3894367 config.status: handle CRLF line endings in AC_CONFIG_HEADERS input
On systems that normally use Unix line endings, if config.h.in has
somehow been generated with DOS line endings, then awk will treat
each CR character as part of the line.  This breaks the regular
expressions used to edit config.h.in into config.h

To fix, manually strip trailing CRs from each “input record” before
any other processing.  For consistency I also made this change to the
code dealing with AC_CONFIG_FILES substitutions.  On systems that use
DOS line endings, both changes should be no-ops.

Reported by David Allsopp in <https://savannah.gnu.org/support/?110554>.
He offered a different patch, which also worked on my machine, but it
used a regular expression as the third argument to ‘split’, which
might not be portable across awk implementations (the gawk manual is
unclear).  Also, it could produce a config.h with _inconsistent_ line
endings.

* lib/autoconf/status.m4 (_AC_OUTPUT_HEADERS_PREPARE): In the awk
  script, strip a trailing CR from each record as the first action.
  (_AC_OUTPUT_FILES_PREPARE): Likewise.
* tests/torture.at (CRLF line endings in .in files): New test.

Co-authored-by: David Allsopp <david@davidallsopp.com>
2023-12-15 10:59:38 -05:00
..
autoconf config.status: handle CRLF line endings in AC_CONFIG_HEADERS input 2023-12-15 10:59:38 -05:00
Autom4te autom4te: Don’t crash if Data::Dumper::Sortkeys is unavailable. 2023-12-11 11:40:11 -05:00
autoscan make update-copyright 2023-01-20 23:41:13 -06:00
autotest autom4te: report subsecond timestamp support in --version 2023-12-06 15:57:05 -05:00
emacs make update-copyright 2023-01-20 23:41:13 -06:00
m4sugar Remove m4_file_append 2023-11-26 09:04:57 -08:00
autom4te.in make update-copyright 2023-01-20 23:41:13 -06:00
freeze.mk make update-copyright 2023-01-20 23:41:13 -06:00
local.mk make update-copyright 2023-01-20 23:41:13 -06:00
version.in make update-copyright 2023-01-20 23:41:13 -06:00