From 1ec52bab864f7986fcc4e378c58ae0d49c8f0ee7 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 22 Nov 2004 00:03:29 +0000 Subject: [PATCH] * 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. --- ChangeLog | 8 ++++++++ aclocal.in | 7 ++++--- automake.in | 7 ++++--- tests/aclocal.test | 6 ++++++ tests/automake.test | 3 +++ 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4a60f58..b7889a4 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 1f8583a..5314ffe 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 9437f92..4a085ef 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 9ad7f5d..6a64b38 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 60dceca..5b4f013 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 -- 2.7.4