BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001576 [BusyBox] Other minor always 11-06-07 05:30 02-13-08 07:50
Reporter jensnachtigall View Status public  
Assigned To BusyBox
Priority normal Resolution open  
Status feedback   Product Version svn
Summary 0001576: 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).
Additional Information
Attached Files

- Relationships

- Notes
(0004414)
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


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker