I have recently upgraded from busybox 1.11.1 to 1.13.2 (latest/current stable in gentoo distro!). After this I have noticed that the "if" statement (ash) doesn't understand any more the negation of empty variables: if [ ! $variable_that_has_not_yet_been_defined ]; then This will fail with the error message: "sh: argument expected", whereas in busybox 1.11.1 the command list after "then" would have been executed. As a consequence busybox 1.13.2 is now less portable (standard "bash" accepts the anterior line without complaints). This behaviour is also not very coherent because empty variables are still accepted, if not negated: if [ $variable_that_has_not_yet_been_defined ]; then else fi "ash" will execute the else part of this code - without complaint on the error stream. As the following lines should be executed in the same manner (and old busybox and likewise bash do so) without error message, I think this should be fixed. if [ ! $variable_that_has_not_yet_been_defined ]; then if ! [ $variable_that_has_not_yet_been_defined ]; then if [ ! "$variable_that_has_not_yet_been_defined" ]; then if ! [ "$variable_that_has_not_yet_been_defined" ]; then (with and without negation this should work equally!)
the surrounding aspects are noise here. the only thing that matters is this: [ ! ] that statement should work in every shell, but it seems to be broken atm in ash
Created attachment 477 [details] Fix Please try attached patch
http://busybox.net/downloads/fixes-1.14.2/busybox-1.14.2-test.patch