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

 
 

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

Submitted by:  None
Submitted on:  Fri 16 Mar 2012 05:23:10 AM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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 File(s):
   
   
Comment:
   

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dwheeler (Updated the item)
  • -unavailable- added by ericb (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 07 Apr 2012 06:46:21 PM UTCdwheelerAttached File-=>Added autoconf-ac-init.patch, #25606
    Sun 18 Mar 2012 06:48:07 PM UTCdwheelerAttached File-=>Added 0001-autoconf-Fail-if-AC_INIT-not-used.patch, #25396

    Back to the top


    Powered by Savane 3.1-cleanup