Fwd: Piping to functions in busybox hush shell with NOMMU CPU
Konstantin Lazarev
cnlazarev at gmail.com
Fri Aug 28 19:36:37 UTC 2015
Hello,
I have issue with busybox hash built for NOMMU CPU.
I am experiencing a problem with different behaviour of piping between
functions in script when using hush on NOMMU platform and ash shells on MMU
platform running busybox 1.23.2.
I have test script which is called with parameter:
./script.sh /tmp
And in hush following script is getting stuck.
With debug output added to read implementation I figured out that it is
stuck because "read" in test_method function is getting stdin from console
instead of piping from calling code:
-------------------------------------------------------------
#!/bin/sh
test_method()
{
while read p; do
echo "$p"
done
}
do_ls()
{
ls -1RF "$1" | test_method
}
processArgs()
{
do_ls "$1"
}
processArgs "$@" | sort -u
-------------------------------------------------------------
The same script works as expected in busybox ash shell.
And it works in busybox hush if last sort is removed.
Also in busybox hush if I do the same without functions with following
commands it works fine too:
ls -1RF /tmp | while read p; do echo "$p"; done | sort -u
It seems that issue is in hush NOMMU implementation in the case when piping
happens to a function.
Can anybody to be so kind to give me idea how fix this problem without
changing test script?
Thank you,
Konstantin Lazarev.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20150828/dbed65e2/attachment.html>
More information about the busybox
mailing list