From 180158114544e2bf0c11c36f373c28331d0a9ee3 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 2 May 2012 00:13:10 +0200 Subject: [PATCH] aclocal: error out again on unrecognized arguments 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 --- NEWS | 5 +++++ aclocal.in | 6 ++++++ t/aclocal.sh | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/NEWS b/NEWS index 1d4a19e..16604f0 100644 --- 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 diff --git a/aclocal.in b/aclocal.in index 09e1da4..dfb851b 100644 --- a/aclocal.in +++ b/aclocal.in @@ -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"; diff --git a/t/aclocal.sh b/t/aclocal.sh index 4030b13..3e0cac6 100755 --- a/t/aclocal.sh +++ b/t/aclocal.sh @@ -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 -- 2.7.4