Reproducer:
[rrakus@dhcp-lab-170 ~]$ sleep 1d | sleep 2d | sleep 3d &
[1] 5034
[rrakus@dhcp-lab-170 ~]$ ps -j
PID PGID SID TTY TIME CMD
4863 4863 4863 pts/2 00:00:00 bash
5032 5032 4863 pts/2 00:00:00 sleep
5033 5032 4863 pts/2 00:00:00 sleep
5034 5032 4863 pts/2 00:00:00 sleep
5035 5035 4863 pts/2 00:00:00 ps
[rrakus@dhcp-lab-170 ~]$ kill -s TERM -5032
bash: kill: 5032: invalid signal specification
Patch:
diff -up bash-4.0/builtins/kill.def.pgid bash-4.0/builtins/kill.def
--- bash-4.0/builtins/kill.def.pgid 2009-12-11 13:56:26.000000000 +0100
+++ bash-4.0/builtins/kill.def 2009-12-11 13:58:04.000000000 +0100
@@ -121,6 +121,7 @@ kill_builtin (list)
else
sig = decode_signal (sigspec, dflags);
list = list->next;
+ saw_signal++;
}
else
{
RR
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
when targetting a process group. But it is certainly an area for QoI
enhancement, if Chet wants to accept your patch as an extension allowed by
POSIX.
- --
Don't work too hard, make some time for fun as well!
Eric Blake eb...@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAksiRnAACgkQ84KuGfSFAYCAHgCfe+m7Q9wz6++tlwUYaKgC6QtI
zHAAnA+I9JLRBOovsr/gyqcQPqGaZw5e
=aXWm
-----END PGP SIGNATURE-----
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