Bug 859

Summary: /bin/sh -c does not ignore SIGINT
Product: Base System Reporter: john hood <cgull>
Component: binAssignee: Joerg Wunsch <joerg>
Status: Closed FIXED    
Severity: Affects Only Me CC: netbsd-bugs
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

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.