mainAutoconf - Support: sr #110325, autoupdate introduces a second...

 
 

sr #110325: autoupdate introduces a second invocation of AC_OUTPUT

Submitter:  Bruno Haible <haible>
Submitted:  Sun 04 Oct 2020 10:57:35 PM UTC
Votes: 2
 
Priority:  * 1 - Blocked Severity:  2 - Minor
Status:  Need Changes Elsewhere Privacy:  Public
Assigned to:  None Open/Closed:  Open
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 08 Dec 2023 02:03:11 PM UTC, comment #4: 

Can't do anything about this without the "more than one comment starter" feature in M4.

Zack Weinberg <zackw>
Group administrator
Mon 13 Jun 2022 03:47:16 PM UTC, comment #3: 


> So, M4-level `dnl` comments are one thing, but how about shell-level `#` comments?


Fun fact: `dnl ...` is not a comment as far as M4 is concerned, but `# ...` is !  See https://www.gnu.org/savannah-checkouts/gnu/m4/manual/html_node/Comments.html and https://www.gnu.org/savannah-checkouts/gnu/m4/manual/html_node/Dnl.html .

We don't usually think of `# ...` as a M4 comment because it's included in the output, but the thing is, it's included in the output verbatim.  An unquoted `#` (or more precisely, whatever the current "begin-comment delimiter" string is, see https://www.gnu.org/savannah-checkouts/gnu/m4/manual/html_node/Changecom.html ) tells M4 to copy text to the output (or current diversion) without macro expansion from that point until the end of the line (current "end-comment delimiter").

`dnl`, by contrast, is a built-in macro with abnormal argument syntax, and it can be disabled just like any other built-in macro.  People use it for comments that they want stripped from the M4 output, but that's not what it was included in M4 for originally -- its actual design purpose is to join input lines (hence the acronym, "delete [the following] new line").

The bug here is precisely that autoupdate wants to preserve `dnl ...` comments in its output, but has no way to do so without also subjecting the `...` to macro expansion.  This is what I meant by "a new feature in M4 itself -- allowing more than one comment starter to be active at once": if


undefine([dnl])
changecom([#],[
],[dnl],[
])


meant that either `#` or `dnl` began an M4-style comment -- copied verbatim to the output -- running until the end of the line, then autoupdate could use that to DTRT with the original test case.

> my style decision to combine the two into `dnl#` comments


I believe this stylistic change will also work around this particular bug in autoupdate, yes, except that you might want to double-check that it doesn't cause this


dnl# Check for the headers we need
AC_CHECK_HEADERS_ONCE([foo.h bar.h])


to turn into nothing at all (i.e. the AC_CHECK_HEADERS_ONCE line is lost) when processed by either normal autoconf or autoupdate.

Zack Weinberg <zackw>
Group administrator
Sun 12 Jun 2022 05:53:49 PM UTC, comment #2: 


comment #1:

> Regrettably, I do not think it will be possible to make any improvements to autoupdate for 2.70.  The algorithm it uses is already extremely brittle and I'm buried in regressions in automake itself.
>
> (What's going on here is, autoupdate runs M4 with an unusual set of macro definitions active: `AC_OUTPUT` is recognized as a macro, but `dnl` isn't.  It's just another word.  It might not be possible to improve the handling of this case without a new feature in M4 itself -- allowing more than one comment starter to be active at once.)


So, M4-level `dnl` comments are one thing, but how about shell-level `#` comments? Does "allowing more than one comment starter to be active at once" mean that my style decision to combine the two into `dnl#` comments (because I find that more readable) will actually start doing something?

Eric Gallager <egallager>
Fri 30 Oct 2020 08:52:21 PM UTC, comment #1: 

Regrettably, I do not think it will be possible to make any improvements to autoupdate for 2.70.  The algorithm it uses is already extremely brittle and I'm buried in regressions in automake itself.

(What's going on here is, autoupdate runs M4 with an unusual set of macro definitions active: `AC_OUTPUT` is recognized as a macro, but `dnl` isn't.  It's just another word.  It might not be possible to improve the handling of this case without a new feature in M4 itself -- allowing more than one comment starter to be active at once.)

Zack Weinberg <zackw>
Group administrator
Sun 04 Oct 2020 10:57:35 PM UTC, original submission:  

In the attached example configure.ac, there is a line

dnl AC_OUTPUT([Makefile])

and autoupdate 2.69c transforms it to

dnl AC_CONFIG_FILES([Makefile])
AC_OUTPUT


Since there is already an AC_OUTPUT invocation in the configure.ac file, now there are two AC_OUTPUT invocations!

IMO, either autoupdate should leave comment lines untouched, or should add a 'dnl ' prefix to all continuation lines of the expansion.

Bruno Haible <haible>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #49922:  configure.ac added by haible (32KiB - application/octet-stream)
file #49923:  configure.ac.diff added by haible (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by egallager (Voted in favor of this item)
  • -email is unavailable- added by egallager (Posted a comment)
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by haible (Submitted the item)
  •  

    There are 2 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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-12-08 zackw Severity3 - Normal 2 - Minor
        StatusNone Need Changes Elsewhere
    2023-07-14 egallager Carbon-Copy- Added egallager
    2020-10-30 zackw Priority5 - Unprioritized 1 - Blocked
    2020-10-04 haible Attached File- Added configure.ac, #49922
        Attached File- Added configure.ac.diff, #49923

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code