bug-bash
[Top][All Lists]
Advanced

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

Re: kill builtin incorrectly works with -s -n and -PGID options


From: Stephane CHAZELAS
Subject: Re: kill builtin incorrectly works with -s -n and -PGID options
Date: Sat, 12 Dec 2009 10:48:25 +0000 (UTC)
User-agent: slrn/pre1.0.0-16 (Linux)

2009-12-11, 06:17(-07), Eric Blake:
>
> According to Roman Rakus on 12/11/2009 6:08 AM:
>> kill builtin incorrectly thinks that -PGID is signal name even if the
>> signal name is set by -s or -n option.
>> 
>> [rrakus@dhcp-lab-170 ~]$ kill -s TERM -5032
>> bash: kill: 5032: invalid signal specification
>
> Not necessarily a bug.  POSIX requires that portable shell use:
>
> kill -s TERM -- -5032

I don't think so. -- is only necessary as the first argument as
in kill -- -5032.

SUSv4:

     To avoid an ambiguity of an initial negative number
     argument specifying either a signal number or a process
     group, POSIX.1-2008 mandates that it is always considered
     the former by implementations that support the XSI option.
     It also requires that conforming applications always use
     the "--" options terminator argument when specifying a
     process group, unless an option is also specified.
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So I'd say it's a bug.

Now, pdksh, ash and their derivatives also have that bug (zsh
and AT&T ksh are OK), so the advice to use '--' in any case, in
practice should be followed.

-- 
Stéphane


reply via email to

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