[U-Boot] hush variable expansion & quoting

Henrik Nordström henrik at henriknordstrom.net
Thu May 16 14:35:29 CEST 2013


tis 2013-05-14 klockan 19:06 +0200 skrev Henrik Nordström:
> Quoting is broken (ignored/lost) when there is variable expansions
> 
>     # test "a b" = c; echo $?
>     1
>     # v="a b"
>     # test "$v" = c; echo $?
>     0
>     # echo "a    b"
>     a    b
>     # v="a    b"
>     # echo "$v"
>     a b

And not entirely unexpected escaping helps here

        # echo \"$v\"
        a    b

Please note that this issue hits the whole command "pipe" as soon as
there is one variable expansion.

    # echo "a   b" "$v"
    a b a b
    # echo "a   b" "a   b"
    a    b a    b

this due to the execution taking a quite differen path when there is
variables involved, and quotes gets destroyied in that path.

upstream hush do not have this problem, but it's not entirely trivial to
pinpoint what fixed it without running an bisect (too many related fixes
& restructuring)

Regards
Henrik



More information about the U-Boot mailing list