hush: handle empty execs
Sometimes variable expansions yield empty strings, and if they happen to be a command someone wants to run like `$foo`, then hush currently segfaults. So handle `` and $(). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
14
shell/hush_test/hush-psubst/emptytick.right
Normal file
14
shell/hush_test/hush-psubst/emptytick.right
Normal file
@@ -0,0 +1,14 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
16
shell/hush_test/hush-psubst/emptytick.tests
Executable file
16
shell/hush_test/hush-psubst/emptytick.tests
Executable file
@@ -0,0 +1,16 @@
|
||||
true; ``; echo $?
|
||||
false; ``; echo $?
|
||||
true; `""`; echo $?
|
||||
false; `""`; echo $?
|
||||
true; ` `; echo $?
|
||||
false; ` `; echo $?
|
||||
|
||||
true; $(); echo $?
|
||||
false; $(); echo $?
|
||||
true; $(""); echo $?
|
||||
false; $(""); echo $?
|
||||
true; $( ); echo $?
|
||||
false; $( ); echo $?
|
||||
|
||||
true; exec ''; echo $?
|
||||
false; exec ''; echo $?
|
Reference in New Issue
Block a user