Bug 859 - /bin/sh -c does not ignore SIGINT
Summary: /bin/sh -c does not ignore SIGINT
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Joerg Wunsch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1995-12-01 09:20 UTC by john hood
Modified: 1996-09-17 03:00 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description john hood 1995-12-01 09:20:03 UTC
'sh -c command' does not ignore/handle SIGINT while waiting for command
to complete.

Fix: 

none
How-To-Repeat: 
keyboard SIGINT in emacs or vi while posting in trn, or try
this interactive ditty and see if the subshell keeps on running:

------------------------------8<------------------------------
#!/bin/sh
#
# test sig handling in sh -c
#
# create second script
TF=/tmp/test.$$
cat > $TF <<\/EOF
#!/bin/sh
echo -e "shell c flags: $-"
trap
trap : 2 3
echo "Type ^C and ^\\"
for i in a b c d e
do
  sleep 1
  echo shell c: $i
done
/EOF
chmod a+x $TF

if [ $# != 1 ]
then
  echo "$0 shell-to-test"
  exit 1
fi
SHELL=$1
echo -e "shell a flags: $-"
trap
trap : 2 3
$SHELL -c "echo shell b flags: $-; trap; $TF"
echo 'shell a exit: ' $?
rm $TF
------------------------------8<------------------------------
Comment 1 Joerg Wunsch freebsd_committer freebsd_triage 1996-04-12 22:36:24 UTC
Responsible Changed
From-To: freebsd-bugs->joerg

I'm goinmg to deal with sh(1) bugs some day. 
Comment 2 alex freebsd_committer freebsd_triage 1996-09-17 02:58:28 UTC
State Changed
From-To: open->closed

Fixed with the recent integration of Lite2 fixes. 

Thanks to Steve Price <sprice@hiwaay.net> for pointing this out.