bin/113860: sh: shell is still running when using `sh -c'

Ed Schouten ed at
Tue Jun 19 17:50:10 UTC 2007

>Number:         113860
>Category:       bin
>Synopsis:       sh: shell is still running when using `sh -c'
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 19 17:50:09 GMT 2007
>Originator:     Ed Schouten
>Release:        FreeBSD 6.2-STABLE i386
System: FreeBSD 6.2-STABLE FreeBSD 6.2-STABLE #0: Fri Apr 20 13:44:49 CEST 2007 root at i386
Some bloated shell from GNU immediately shuts down the shell when using
`sh -c'. This means that:

sh -c 'sleep 10'

only keeps a sleep(1) process running for 10 seconds; the shell is
closed immediately.

FreeBSD's sh doesn't. This means that all applications that use
system(3) or just execve(2) /bin/sh leave shells running around.
| $ sh -c 'sleep 10' &
| [1] 13519
| $ ps ux
| ...
| ed   13519  0.0  0.2  6228  1808  p2  SN    7:48PM   0:00.00 sh -c sleep 10
| ed   13520  0.0  0.1  2552   704  p2  SN    7:48PM   0:00.00 sleep 10
I looked through the sh source code, but I can't seem to find a way to
do this. I'm not an expert when it comes to patching sh(1) code. :-(

More information about the freebsd-bugs mailing list