public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] hush variable expansion & quoting
@ 2013-05-14 17:06 Henrik Nordström
  2013-05-16 12:35 ` Henrik Nordström
  0 siblings, 1 reply; 2+ messages in thread
From: Henrik Nordström @ 2013-05-14 17:06 UTC (permalink / raw)
  To: u-boot

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

Regards
Henrik

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [U-Boot] hush variable expansion & quoting
  2013-05-14 17:06 [U-Boot] hush variable expansion & quoting Henrik Nordström
@ 2013-05-16 12:35 ` Henrik Nordström
  0 siblings, 0 replies; 2+ messages in thread
From: Henrik Nordström @ 2013-05-16 12:35 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-16 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-14 17:06 [U-Boot] hush variable expansion & quoting Henrik Nordström
2013-05-16 12:35 ` Henrik Nordström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox