From: Alexandre Duret-Lutz Date: Mon, 22 Nov 2004 00:03:28 +0000 (+0000) Subject: * aclocal.in (parse_arguments): Diagnose abbreviation ambiguous with X-Git-Tag: Release-1-9b~252 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=54ff8a6de821265be7a94c0165a09a1af67a1e18;p=automake.git * aclocal.in (parse_arguments): Diagnose abbreviation ambiguous with --help or --version. * automake.in (parse_arguments): Likewise. * tests/aclocal.test, tests/automake.test: Check this. Report from Eric Blake. --- diff --git a/ChangeLog b/ChangeLog index 4a60f589..b7889a40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-11-22 Alexandre Duret-Lutz + + * aclocal.in (parse_arguments): Diagnose abbreviation ambiguous with + --help or --version. + * automake.in (parse_arguments): Likewise. + * tests/aclocal.test, tests/automake.test: Check this. + Report from Eric Blake. + 2004-11-21 Alexandre Duret-Lutz * automake.in (parse_arguments): Diagnose empty arguments, options diff --git a/aclocal.in b/aclocal.in index 1f8583a6..5314ffe7 100644 --- a/aclocal.in +++ b/aclocal.in @@ -659,9 +659,10 @@ sub parse_arguments () or exit 1; @ARGV = @ARGV_backup; - # Now *really* process the options. This time we know - # that --help and --version are not present. - Getopt::Long::GetOptions %cli_options + # Now *really* process the options. This time we know that --help + # and --version are not present, but we specify them nonetheless so + # that ambiguous abbreviation are diagnosed. + Getopt::Long::GetOptions %cli_options, 'version' => sub {}, 'help' => sub {} or exit 1; if (@ARGV) diff --git a/automake.in b/automake.in index 9437f925..4a085ef4 100755 --- a/automake.in +++ b/automake.in @@ -7474,9 +7474,10 @@ sub parse_arguments () or exit 1; @ARGV = @ARGV_backup; - # Now *really* process the options. This time we know - # that --help and --version are not present. - Getopt::Long::GetOptions %cli_options + # Now *really* process the options. This time we know that --help + # and --version are not present, but we specify them nonetheless so + # that ambiguous abbreviation are diagnosed. + Getopt::Long::GetOptions %cli_options, 'version' => sub {}, 'help' => sub {} or exit 1; if (defined $output_directory) diff --git a/tests/aclocal.test b/tests/aclocal.test index 9ad7f5dd..6a64b389 100755 --- a/tests/aclocal.test +++ b/tests/aclocal.test @@ -35,4 +35,10 @@ $ACLOCAL --unknown-option 2>stderr && exit 1 grep 'unrecognized.*--unknown-option' stderr grep help stderr +$ACLOCAL --ver 2>stderr && exit 1 +grep 'unrecognized.*--ver' stderr +grep help stderr + +$ACLOCAL --versi + test "`$ACLOCAL --print-ac-dir`" = "$testaclocaldir" diff --git a/tests/automake.test b/tests/automake.test index 60dceca3..5b4f0131 100755 --- a/tests/automake.test +++ b/tests/automake.test @@ -37,3 +37,6 @@ AUTOMAKE_fails --warnings grep 'option.*--warning.*requires an argument' stderr AUTOMAKE_fails --warnings --help grep 'unknown warning.*--help' stderr +AUTOMAKE_fails --ver +grep 'unrecognized option.*--ver' stderr +$AUTOMAKE --vers