Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 151485 - kill doesn't like 'SIG' prefix in bash scripts invoked through 'sh'
kill doesn't like 'SIG' prefix in bash scripts invoked through 'sh'
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: bash (Show other bugs)
i686 Linux
medium Severity low
: ---
: ---
Assigned To: Tim Waugh
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2005-03-18 09:25 EST by Mike Herrick
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-03-18 09:53:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mike Herrick 2005-03-18 09:25:39 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030716

Description of problem:
Man page states:

'sigspec is either a  case-insensitive signal name such as SIGKILL (with or
without the SIG prefix)'

In an interactive bash, this seems to be true - the following command works:

kill -SIGUSR1 1

However, if it is placed in a script:

# cat - > /tmp/foo <<EOF
> #!/bin/bash
> type kill
> kill -SIGUSR1 1
# sh /tmp/foo
kill is a shell builtin
/tmp/foo: line 3: kill: SIGUSR1: invalid signal specification

Removing the 'SIG' prefix solves the problem.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
# cat - > /tmp/foo <<EOF
> #!/bin/bash
> type kill
> kill -SIGUSR1 1
# sh /tmp/foo


Actual Results:  kill is a shell builtin
/tmp/foo: line 3: kill: SIGUSR1: invalid signal specification

Expected Results:  kill is a shell builtin

Additional info:

Seems to be related to invoking 'sh'.  Invoking 'bash' works:

# sh /tmp/foo
kill is a shell builtin
/tmp/foo: line 3: kill: SIGUSR1: invalid signal specification
# bash /tmp/foo
kill is a shell builtin
# ls -l /bin/sh
lrwxrwxrwx  1 root root 4 Mar  3 16:34 /bin/sh -> bash

I thought the '#!/bin/bash' would explicitly invoke bash.

Same scripts work fine on Enterprise Linux 3 update 4.

SELinux is installed.  Output from sestatus:
# sestatus
SELinux status:         enabled
SELinuxfs mount:        /selinux
Current mode:           enforcing
Mode from config file:  enforcing
Policy version:         18
Policy from config file:targeted

Policy booleans:
allow_ypbind            active
dhcpd_disable_trans     inactive
httpd_disable_trans     inactive
httpd_enable_cgi        active
httpd_enable_homedirs   active
httpd_ssi_exec          active
httpd_tty_comm          inactive
httpd_unified           active
mysqld_disable_trans    inactive
named_disable_trans     inactive
nscd_disable_trans      inactive
ntpd_disable_trans      inactive
portmap_disable_trans   inactive
snmpd_disable_trans     inactive
squid_disable_trans     inactive
syslogd_disable_trans   active
winbind_disable_trans   inactive
ypbind_disable_trans    inactive
Comment 1 Tim Waugh 2005-03-18 09:53:38 EST
The '#!/bin/bash' line is only used when executing the shell script directly,
not when the shell script is passed as a parameter to an explicit shell
invocation as in 'sh ./script'.

The kill built-in command adheres to IEEE Std 1003.1-2001 more strictly when the
shell is invoked as 'sh', and so must follow this:

  Values of signal_name shall be recognized in a case-independent
  fashion, without the SIG prefix.

Allowing the SIG prefix is a bash extension as far as I can tell.

Note You need to log in before you can comment on or make changes to this bug.