[BusyBox 0001576]: ash -c causes two processes (compatibility issue)
bugs at busybox.net
bugs at busybox.net
Wed Feb 13 15:50:29 UTC 2008
The following issue requires your FEEDBACK.
======================================================================
http://busybox.net/bugs/view.php?id=1576
======================================================================
Reported By: jensnachtigall
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 1576
Category: Other
Reproducibility: always
Severity: minor
Priority: normal
Status: feedback
======================================================================
Date Submitted: 11-06-2007 05:30 PST
Last Modified: 02-13-2008 07:50 PST
======================================================================
Summary: ash -c causes two processes (compatibility issue)
Description:
background:
===========
I use a software that starts plugins via the -c flag of the shell, and
then to unload/stop the plugin again, it sends SIGTERM or SIGKILL to the
plugin's pid. See the code snippet:
void Plugin::start() {
[...]
pid = fork();
[...]
execl("/bin/sh", "/bin/sh", "-c", (cmdline + " " + name).c_str(),
NULL);
}
This works fine with bash, where a command like "bash -c "sleep 10""
results in just one process, namely just in the "sleep 10" process.
However, with ash a command like "ash -c "sleep 10"" results in 2
processes, namely first "ash -c sleep 10" and then "sleep 10".
For the above software this means that
pid = fork()
is the pid of "ash -c <plugin-command>" and not of "<plugin-command>, so
the signals go to the "ash -c <plugin-command>" and not to
"plugin-command" as it was with bash.
Would be nice if ash behaved in the same way as bash (and probably other
shells) by just starting the command after the "-c" option (that is, one
command).
======================================================================
----------------------------------------------------------------------
vda - 02-13-08 07:50
----------------------------------------------------------------------
This would require parsing the command, because in cases like
ash -c "cmd1 | cmd2"
ash -c "while true; do something; done"
ash cannot "just exec the command".
If you need to know the PID of the command, why can't you just execute
command directly using execv("command", argv)?
Issue History
Date Modified Username Field Change
======================================================================
11-06-07 05:30 jensnachtigall New Issue
11-06-07 05:30 jensnachtigall Status new => assigned
11-06-07 05:30 jensnachtigall Assigned To => BusyBox
11-06-07 05:31 jensnachtigall Issue Monitored: jensnachtigall
02-13-08 07:50 vda Note Added: 0004414
02-13-08 07:50 vda Status assigned => feedback
======================================================================
More information about the busybox-cvs
mailing list