[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Fwd: Piping to functions in busybox hush shell with NOMMU CPU
From: Konstantin Lazarev <cnlazarev () gmail ! com>
Date: 2015-08-28 19:36:37
Message-ID: CABwJm7ZKhqcrGQrqKp15T=_qW6nc-74_E52==CmUN2UxSv6aqQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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.
[Attachment #5 (text/html)]
<div dir="ltr">Hello,<br><div class="gmail_quote"><div \
dir="ltr"><div><br></div><div>I have issue with busybox hash built for NOMMU \
CPU.<br><br></div><div>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.<br></div><div><br>I have test script which is \
called with parameter:<br></div><div>./script.sh /tmp<br></div>And in hush following \
script is getting stuck.<br><div>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:<br>-------------------------------------------------------------<br>#!/bin/sh<br><br>test_method()<br>{<br> \
while read p; do<br> echo "$p"<br> \
done<br>}<br><br>do_ls()<br>{<br> ls -1RF "$1" | \
test_method<br>}<br><br><br>processArgs()<br>{<br> do_ls \
"$1"<br>}<br><br>processArgs "$@" | sort \
-u<br>-------------------------------------------------------------<br><br></div><div>The \
same script works as expected in busybox ash shell.<br><br></div><div>And it works in \
busybox hush if last sort is removed.<br></div><div>Also in busybox hush if I do the \
same without functions with following commands it works fine too:<br>ls -1RF /tmp | \
while read p; do echo "$p"; done | sort -u<br><br></div><div>It seems that \
issue is in hush NOMMU implementation in the case when piping happens to a \
function.<br><br></div><div>Can anybody to be so kind to give me idea how fix this \
problem without changing test script?<br><br></div><div>Thank \
you,<br></div><div>Konstantin Lazarev.<br></div></div> </div><br></div>
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic