parameter expansion with uninitialized variable

Christian Hesse list at eworm.de
Fri Jan 8 20:44:03 UTC 2021


Hello everybody,

with busybox 1.32 shell's parameter expansion starts to fail with
uninitialized variables.

Set a variable and echo, replacing comma with space:

~ $ test=abc,def
~ $ echo ${test/,/ }
abc def
~ $

Even with empty variable this works. Well, brings expected result:

~ $ test=
~ $ echo ${test/,/ }

~ $

But unsetting the variable results in echoing a slash:

~ $ unset test
~ $ echo ${test/,/ }
/
~ $

This worked as expected with busybody 1.31. Sadly bisecting did not reveal
any results as I was facing build errors with most revisions.
-- 
main(a){char*c=/*    Schoene Gruesse                         */"B?IJj;MEH"
"CX:;",b;for(a/*    Best regards             my address:    */=0;b=c[a++];)
putchar(b-1/(/*    Chris            cc -ox -xc - && ./x    */b/42*2-3)*42);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210108/123ba71d/attachment.asc>


More information about the busybox mailing list