mainAutoconf - Support: sr #110554, AC_CONFIG_HEADERS doesn't work...

 
 

sr #110554: AC_CONFIG_HEADERS doesn't work properly for files with Windows line-endings

Submitter:  David Allsopp <dra27>
Submitted:  Thu 21 Oct 2021 04:20:43 PM UTC
   
 
Priority:  * 3 - Release N+1 Severity:  3 - Normal
Status:  In Progress Privacy:  Public
Assigned to:  None Open/Closed:  Open
Operating System:  Microsoft Windows
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 18 Dec 2023 11:33:43 PM UTC, comment #2: 

Turns out either your change or my change will break config.status on Solaris 10, because its /usr/bin/awk is incredibly limited.  It has a "nawk" that is more capable, but we'd have to notice that we need to use that, and config.status isn't currently bothering.

With regret, this pushes this change over the line to 'too risky when I want to make the release this Friday'.

Revert: <https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=2d36f11a5266c22a4d40e8bea2fec7fdd5c42297>

Zack Weinberg <zackw>
Group administrator
Fri 15 Dec 2023 04:19:47 PM UTC, comment #1: 

Should be fixed in <https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=bfd3894367e4d1c36c514e02c62173cde157f06b>, thanks for reporting.

Thanks also for providing a patch; it might have taken me hours to figure out what to change otherwise.  I made a somewhat different change, though, because your code could produce a config.h with inconsistent line endings, and also because old non-GNU implementations of awk probably don't support using a regexp as the third argument to 'split'.  (I'm not 100% sure about this; the gawk manual is usually very good about pointing out portability issues but in this case it's ambiguous.  For code this fundamental I think it's best to play safe.)

I don't have access to a development environment on a machine that uses CRLF line endings.  I would appreciate it if you could test autoconf trunk in the environment where you originally encountered the problem.

Zack Weinberg <zackw>
Group administrator
Thu 21 Oct 2021 04:20:43 PM UTC, original submission:  

For headers with standard


#undef MACRO


lines, AC_CONFIG_HEADERS doesn't perform substitutions if the there is no whitespace following MACRO and the .in file has Windows CRLF line-endings.

This is a mild nuisance, given that the C pre-processor shouldn't mind about line endings. The work-around is to add space (or space and a comment) after the macro name, but the fix seems relatively straightforward (assuming the change is portable).


diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index c2721a85..d5c222bb 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -824,9 +824,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   for (key in D) D_is_set[key] = 1
   FS = "^G"
 }
-/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\r?\$)/ {
   line = \$ 0
-  split(line, arg, " ")
+  split(line, arg, /[ \r\t]/)
   if (arg[1] == "#") {
     defundef = arg[2]
     mac1 = arg[3]


David Allsopp <dra27>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by zackw (Updated the item)
  • -email is unavailable- added by dra27 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-12-18 zackw Priority7 - Release N (Desirable) 3 - Release N+1
        StatusReady For Test In Progress
    2023-12-15 zackw StatusConfirmed Ready For Test
    2023-12-08 zackw StatusNone Confirmed
    2023-12-08 zackw Priority5 - Unprioritized 7 - Release N (Desirable)

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code