mainAutoconf - Support: sr #107986, autoconf should reject or...

 
 

sr #107986: autoconf should reject or specifically warn about obviously wrong configure.ac files

Submitter:  None
Submitted:  Fri 16 Mar 2012 05:23:10 AM UTC
   
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Originator Email:  -email is unavailable-
Open/Closed:  Closed Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 18 Aug 2020 12:29:57 PM UTC, comment #7: 

I wound up re-doing the code changes from scratch, but this has now been addressed in aba75f6d4a9c875a9d5d90a07c6b3678db66a4bf and 6a0c0239449a98181c5dd7e505cddbc0840471a4.

Further improvements to autoconf's ability to detect erroneous configure scripts would be welcome.

Zack Weinberg <zackw>
Group administrator
Fri 17 Jul 2020 03:32:08 AM UTC, comment #6: 

comment #5:

> Hm, I think this is still a desirable change and could be merged for 2.70.  David Wheeler, if you're still reading this, do you have a copyright assignment on file with the FSF for changes to autoconf?  I don't see your name in the git log or any of the old changelogs.


Thanks so much for the vote of confidence! I'm working right now on the copyright assignment with my former employer (I just got the revised FSF paperwork today). My former employer has done this before, so I think this will be resolved soon. I'm hoping this improvement can be merged into autoconf 2.70.

David A. Wheeler <dwheeler>
Fri 10 Jul 2020 03:38:04 PM UTC, comment #5: 

Hm, I think this is still a desirable change and could be merged for 2.70.  David Wheeler, if you're still reading this, do you have a copyright assignment on file with the FSF for changes to autoconf?  I don't see your name in the git log or any of the old changelogs.

Zack Weinberg <zackw>
Group administrator
Sat 07 Apr 2012 06:46:21 PM UTC, comment #4: 

Okay, here's a better patch.  This one will warn if someone fails to use AC_INIT in configure.ac, when you use either autoconf or autoreconf.  It adds an option flag, in case you want to skip the check.  It also checks the AC_INIT parameters and warns if they are not normalized.  Finally, some changes to the test suite to add tests and make them pass.

(file #25606)

David A. Wheeler <dwheeler>
Sun 18 Mar 2012 08:15:49 PM UTC, comment #3: 

Oh, a quick note about the attached patch to require AC_INIT - this patch will currently cause "make check" in autoconf to fail, because some of the autoconf test cases don't call AC_INIT either :-(.

Possible solutions include:
1. Fix all the tests so that they use AC_INIT
2. Create an option flag meaning "do not require AC_INIT", and change those tests to use it
3. Make omitting AC_INIT a warning, not an error.

All the above would work.  Turning the omission of AC_INIT into a warning might be the easiest upward-compatible approach.  However, which one is most acceptable to the autoconf developers?

David A. Wheeler <dwheeler>
Sun 18 Mar 2012 06:48:07 PM UTC, comment #2: 

Okay, I have developed a git format-patch (attached) to detect a failure to use AC_INIT. With this patch, if "autoconf" is invoked using an empty "configure.ac" (for example), it correctly fails and reports:
autoconf: error: Failed to use AC_INIT in the input file configure.ac.

HOWEVER, autoreconf seems to ignore and hide ALL errors returned by autoconf, including this one, so "autoreconf -i" doesn't error out as I expected. That behavior seems fundamentally wrong. Is that the expected behavior? Or am I missing something obvious?

This doesn't do everything I suggested, but it's a first step and useful.  I think it's better to do this sort of thing incrementally, so here is an increment.


(file #25396)

David A. Wheeler <dwheeler>
Fri 16 Mar 2012 07:04:09 PM UTC, comment #1: 

1. AC_INIT is essential, AC_OUTPUT is optional but useful; and makes the most sense if any AC_CONFIG_ were used.  It's probably possible to wire up something along those lines (for AC_INIT: have the autoconf driver trace AC_INIT, and error out if the trace was not present; for AC_OUTPUT: have AC_INIT install an m4_wrap that warns if AC_OUTPUT has not been expanded).  Patches welcome.

Yes, a warning for a trailing space in a package version name or number might make sense; we can't warn everywhere, and it should not be outright forbidden, but hopefully the warning will help.  Patches welcome.

3. It's hard to pro-actively fix everything, without knowing what sort of mistakes are being commonly made, and without bloating the tool or slowing it down for the common and correct use cases.

Eric Blake <ericb>
Group administrator
Fri 16 Mar 2012 05:23:10 AM UTC, original submission:  

The key input to autoconf is "configure.ac", but "obviously wrong" configure.ac files just sail through.  This is bad, especially for people just starting to learn autoconf, because a simple typo can produce mysterious-to-them results.  Autoconf should detect at least some "obviously wrong" situations, like any other compiler, and complain specifically about problems so they can be fixed quickly instead of debugged.

1. autoconf should fail loudly if either AC_INIT or AC_OUTPUT are missing, and specifically say "AC_INIT missing" and/or "AC_OUTPUT missing".

2. If AC_INIT's first parameter contains any whitespace, it should at least warn.  A common beginner mistake is to think that whitespace is irrelevant in m4, e.g.:
  AC_INIT( hello , 0.01 )
but the trailing whitespace is actually part of the parameter.  If there is no first parameter (or it's empty), that should probably emit a warning.

3. If there are some other places where beginners are likely to make a mistake (e.g., whitespace at the end that would probably cause a problem), autoconf should detect it and either warn or error out.

This would make autoconf easier to work with, since problems would be immediately and specifically identified, instead of having to debug them.

Thank you!

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #25606:  autoconf-ac-init.patch added by dwheeler (5KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by dwheeler (Updated the item)
  • -email is unavailable- added by ericb (Posted a comment)
  • -email is unavailable- added by None (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-08-18 zackw StatusNeed Copyright Assignment Done
        Open/ClosedOpen Closed
    2020-07-16 zackw StatusNeed Info Need Copyright Assignment
    2020-07-10 zackw StatusNone Need Info
    2012-04-07 dwheeler Attached File- Added autoconf-ac-init.patch, #25606
    2012-03-18 dwheeler Attached File- Added 0001-autoconf-Fail-if-AC_INIT-not-used.patch, #25396

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code