Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2007 19:49:39 +0200 (CEST)
From:      Ed Schouten <ed@fxq.nl>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/113860: sh: shell is still running when using `sh -c'
Message-ID:  <20070619174939.D3EFC1CE25@palm.hoeg.nl>
Resent-Message-ID: <200706191750.l5JHo9NS064196@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 19 17:50:09 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Ed Schouten
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD palm.hoeg.nl 6.2-STABLE FreeBSD 6.2-STABLE #0: Fri Apr 20 13:44:49 CEST 2007 root@palm.hoeg.nl:/usr/obj/usr/src/sys/PALM i386
>Description:
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.
>How-To-Repeat:
| $ sh -c 'sleep 10' &
| [1] 13519
| $ ps ux
| USER   PID %CPU %MEM   VSZ   RSS  TT  STAT STARTED      TIME COMMAND
| ...
| 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
>Fix:
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. :-(
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070619174939.D3EFC1CE25>