bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: timeout --help --help


From: Kim Hansen
Subject: Re: timeout --help --help
Date: Mon, 22 Mar 2010 10:31:42 +0100

2010/3/22 Pádraig Brady <address@hidden>:
> On 21/03/10 16:16, Kim Hansen wrote:
>> When testing the --kill-after I found the following strange behaviour:
>>   address@hidden:~$ timeout --help --help
>>   timeout: unrecognized option '--help'
>>   Try `timeout --help' for more information.
>>   address@hidden:~$
>>
>> It looks like parse_long_options() only will give help or version if
>> that is the only option passed to the program, the following change
>> made the program behave like I expected it to do:
>
> Well all of the following have that behavior:
>
> $ grep -l parse_long_options *.c | sed 's/.c$//' | fmt
> basename chroot cksum dd dirname echo expr getlimits hostid hostname
> link logname nice nohup printf setuidgid sleep sync test timeout tsort
> unlink uptime users whoami yes

But all the programs that I sometimes need help for does it the other way:

address@hidden:/tmp/coreutils/git/src$ grep -l GETOPT_HELP_OPTION_DECL *.c |
sed 's/.c$//' | fmt
base64 cat chcon chgrp chmod chown chroot comm cp csplit cut date df
dircolors du env expand factor fmt fold groups head id install join
kill ln ls md5sum mkdir mkfifo mknod mktemp mv nl nproc od paste pathchk
pinky pr printenv ptx pwd readlink rm rmdir runcon seq shred shuf sort
split stat stdbuf stty su sum tac tail tee timeout touch tr truncate
tty uname unexpand uniq wc who

chroot is a little funny, it does both.

> The reason is that parse_long_options() only parses
> options when there is a single option passed to the command.
> It does this on purpose so as not to effect options that
> may be passed on to further commands or requiring users
> to specially mark such options.

I don't think I understand this, can you give an example?

I would expect it to be enough that timeout uses a + at the start of
the getopt string, and it seems to work: "./timeout 1s cat --version"
returns the version of cat, not of timeout.

-- 
Kim Hansen
Vadgårdsvej 3, 2.tv
2860 Søborg
Fastnet: 3956 2437  --  Mobil: 3091 2437




reply via email to

[Prev in Thread] Current Thread [Next in Thread]