Hello, It seems that there is a bug in the 'jobs' built-in command of ash. As a matter of fact, its output cannot be captured nor piped.
I made a little script (in attachment) which shows the case. If you execute it with ash, you should see that 'test3' doesn't return anything but a new line, while 'test4' indicates that the output is well directed to stdout (so, according to the rules of shell, the pipe should work). I first observed this bug with the ash shell embedded in Slackware (then I tested the one of Busybox because Patrick Volkerding said to me that it was probably the best maintained ash shell :-) and I saw that dash has the same curious behaviour. So, I think this bug comes from the "historical" ash shell. The 'TOUR' doc which is in the ash shell Slackware package says that ash cooks its own outputs, hence here could be the cause of the bug (complete file in attachment): "OUTPUT: Ash uses it's own output routines. There are three out- put structures allocated. "Output" represents the standard out- put, "errout" the standard error, and "memout" contains output which is to be stored in memory. This last is used when a buil- tin command appears in backquotes, to allow its output to be col- lected without doing any I/O through the UNIX operating system. The variables out1 and out2 normally point to output and errout, respectively, but they are set to point to memout when appropri- ate inside backquotes." I'm not skilled at all in C, so I can help much more. And I don't know if it's possible to make a "portable" patch for other ash shells, despite it would be great for everyone. Hopefully this can however be useful for busybox, ++ Seb. P-S. I don't know if it matters, but I tested the issue on a busybox compiled with the default configuration.
ashjbtest.sh
Description: Binary data
TOUR.gz
Description: Binary data
_______________________________________________ busybox mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/busybox
