Hush does not handle "set -o pipefail".

Denys Vlasenko vda.linux at googlemail.com
Mon Nov 22 17:06:06 UTC 2010


On Thu, Nov 18, 2010 at 4:35 AM, Rob Landley <rob at landley.net> wrote:
>> > Oh, by the way, if you point #!/bin/sh to hush and then run the zlib
>> > ./configure stage it dies kind of impressively.
>>
>> What is the bug or missing feature it stumbled over?
>
> It's not one thing.

Sure.
I do not expect you to give me the full list of things
which do not work. Just the first one.

> For example, running the ./configure stage of dropbear hangs.  It never
> produces any output, even if you let it sit there for half an hour.  I have no
> idea where it's hanging because it doesn't support "set -x".  I tried sticking
> "echo" lilnes in there but it's autoconf crap doing this horrible stuff with
> nested parentheses spanning hundreds of lines (within which there are function
> definitions using parentheses of their own) and figuring out the flow control is
> non-obvious...
>
> I eventually tracked it down to this blob:
>
> # Name of the executable.
> as_me=`$as_basename -- "$0" ||
> $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
>         X"$0" : 'X\(//\)$' \| \
>         X"$0" : 'X\(/\)' \| . 2>/dev/null ||
> echo X/"$0" |
>    sed '/^.*\/\([^/][^/]*\)\/*$/{
>            s//\1/
>            q
>          }
>          /^X\/\(\/\/\)$/{
>            s//\1/
>            q
>          }
>          /^X\/\(\/\).*/{
>            s//\1/
>            q
>          }
>          s/.*/./; q'`
>
> $as_basename=false $as_expr=expr and $0=./configure
>
> That hangs with hush, but not with ash or bash.  No idea why.

Bug in hush. It usually treats <newline> as ';', and on this line:

echo X/"$0" |

it's a wrong thing to do.
The bug caused next sed to run with fd 0 opened to stdin...

I fixed this in git (along with two other bugs which I noticed
by looking at nearby code:  echo ""#foo was treating #foo as comment
and a\<newline>=1 was not treated as assignment).
Added tests to testsuite for each of them.


>> Please provide me with the precise information what needs to be
>> fixed/implemented, and I will code it up.
>
> If I can find it, I will, but these are large complicated scripts that require
> fairly extensive debugging just to figure out what they're _trying_ to do.

Thanks, the report in your mail was exactly what I needed.
No need to dig deeper than that.

I will release 1.18.0 soon.

-- 
vda


More information about the busybox mailing list