GNU bug report logs - #18531
[PATCH] man: Fix an inverted test that prevented dummy-man from working

Previous Next

Package: coreutils;

Reported by: Alban Bedel <alban.bedel <at> avionic-design.de>

Date: Mon, 22 Sep 2014 17:57:03 UTC

Severity: normal

Tags: fixed, patch

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: alban.bedel <at> avionic-design.de, 18531 <at> debbugs.gnu.org, Andreas Schwab <schwab <at> linux-m68k.org>
Subject: bug#18531: [PATCH] man: Fix an inverted test that prevented dummy-man from working
Date: Tue, 23 Sep 2014 01:54:53 +0100
On 09/23/2014 12:53 AM, Bernhard Voelker wrote:
> On 09/22/2014 11:42 PM, Bernhard Voelker wrote:
>> On 09/22/2014 10:11 PM, Andreas Schwab wrote:
>>> Pádraig Brady <P <at> draigBrady.com> writes:
>>>> On 09/22/2014 10:53 AM, Alban Bedel wrote:
>>> Huh?
>>>
>>> $ man/dummy-man foo
>>> man/dummy-man: too many non-option arguments
>>>
>>> Andreas.
>>>
>>
>> oops, in commit b3578fc9ffe70b9466687f9f6470a85f1a0ab14f
>> I added the --info-page=... option _after_ the program argument
>> in local.mk.  The original help2man doesn't have a problem with
>> that, as it does the normal GNU option parsing, but the parsing
>> loop in dummy-man stops parsing when it hit the program argument,
>> thus leaving $# = 2 (and the --info-page option unused).
>>
>> I'll propose a fix for both the test in dummy-man and local.mk
>> soon.
> 
> The proper fix for 'dummy-man' would have been to read the program
> name argument in the above while loop, checking that such a non-option
> argument has only been passed once, and then check the final remaining
> argument count again.
> I took the easier road, and only fixed the error condition in patch 1,
> while patch 2 fixes the caller in local.mk.
> 
> Have a nice day,
> Berny
> 
> 
>>From bf2057b20b6c84d792816898dcded905bfdb146f Mon Sep 17 00:00:00 2001
> From: Bernhard Voelker <mail <at> bernhard-voelker.de>
> Date: Tue, 23 Sep 2014 01:44:51 +0200
> Subject: [PATCH 1/2] build: fix argument count check in dummy-man again
> 
> * man/dummy-man: Fix argument count check, now only permitting
> exactly 1 argument, the program name.
> Reported by Andreas Schwab <schwab <at> linux-m68k.org>
> ---
>  man/dummy-man | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man/dummy-man b/man/dummy-man
> index 65b85d5..bf31912 100755
> --- a/man/dummy-man
> +++ b/man/dummy-man
> @@ -39,7 +39,7 @@ while test $# -gt 0; do
>  done
> 
>  test $# -gt 0 || fatal_ "missing argument"
> -test $# -gt 1 || fatal_ "too many non-option arguments"
> +test $# -le 1 || fatal_ "too many non-option arguments"
> 
>  baseout=`basename_ "$output"`
>  sed 's/^/WARNING: /' >&2 <<END

Oops right. I did check that the patch caused dummy-man to "work"
though that was only accidental.  The above two patches are obviously
the correct fix.

thanks,
Pádraig.





This bug report was last modified 6 years and 221 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.