aclocal: error out again on unrecognized arguments
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 1 May 2012 22:13:10 +0000 (00:13 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 2 May 2012 09:16:57 +0000 (11:16 +0200)
Starting from commit v1.11-662-g52246cc of 2102-02-18, "cmdline parsing:
move into a dedicated perl module", aclocal has been silently ignoring
non-option arguments instead of correctly reporting them.
Fix this regression.

* t/aclocal.sh: Update to catch the regression.
* aclocal.in (parse_arguments): Explicitly reject non-option arguments.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
aclocal.in
t/aclocal.sh

diff --git a/NEWS b/NEWS
index 1d4a19e..16604f0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -67,6 +67,11 @@ Bugs fixed in 1.12.1:
    - Several weaknesses in the Automake's own build system test suite
      have been fixed.
 
+* Bugs introduced by 1.11.3:
+
+  - When given non-option arguments, aclocal rejects them, instead of
+    silently ignoring them.
+
 * Long-standing bugs:
 
   - When the 'color-tests' option is in use, forcing of colored testsuite
index 09e1da4..dfb851b 100644 (file)
@@ -982,6 +982,12 @@ sub parse_arguments ()
   use Automake::Getopt ();
   Automake::Getopt::parse_options %cli_options;
 
+  if (@ARGV > 0)
+    {
+      fatal ("non-option arguments are not accepted: '$ARGV[0]'.\n"
+             . "Try '$0 --help' for more information.");
+    }
+
   if ($print_and_exit)
     {
       print "@system_includes\n";
index 4030b13..3e0cac6 100755 (executable)
@@ -34,6 +34,11 @@ cat stderr >&2
 grep 'unrecognized option.*--unknown-option' stderr
 grep '[Tt]ry.*--help.*for more information' stderr
 
+$ACLOCAL foobar 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'non-option argument.*foobar' stderr
+grep '[Tt]ry.*--help.*for more information' stderr
+
 $ACLOCAL --ver 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'unrecognized option.*--ver' stderr