dash does not handle ^C trap the same way that bash does
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dash (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: dash
The problems with making /bin/sh symlink to dash instead of bash are known (#141481), but I haven't seen this particular problem reported yet.
dash and bash process the ^C (INT) signal differently. Try running the following script (then type ^C) with both bash and dash:
<<<
tint() { echo int; }
thup() { echo hup; }
tchld() { echo chld; }
tterm() { echo term; }
texit() { echo exit; }
# trap tint INT
trap thup HUP
trap tchld CHLD
trap tterm TERM
trap texit EXIT
echo type ^C...
sleep 100
>>>
bash triggers the EXIT. dash triggers no trap.
If you uncomment the INT trap, bash triggers INT and EXIT, and dash triggers INT, CHLD, and EXIT.
I don't know what POSIX dictates or which is correct, I am guessing that any exit should trigger EXIT (so dash is wrong).
Either way, the shells behave differently, and the difference is causing problems in existing Ubuntu scripts. (I found it in /usr/bin/
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: dash 0.5.5.1-3ubuntu2
ProcVersionSign
Uname: Linux 2.6.32-23-generic i686
Architecture: i386
Date: Thu Jul 22 15:12:27 2010
ProcEnviron:
PATH=(custom, user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: dash
Status changed to 'Confirmed' because the bug affects multiple users.