From 28736c36ca6a73864324296117ce26c9a23066dd Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 18 Oct 2009 01:11:45 -0400 Subject: 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 --- shell/hush_test/hush-psubst/emptytick.right | 14 ++++++++++++++ shell/hush_test/hush-psubst/emptytick.tests | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 shell/hush_test/hush-psubst/emptytick.right create mode 100755 shell/hush_test/hush-psubst/emptytick.tests (limited to 'shell/hush_test/hush-psubst') diff --git a/shell/hush_test/hush-psubst/emptytick.right b/shell/hush_test/hush-psubst/emptytick.right new file mode 100644 index 0000000..d4b70c5 --- /dev/null +++ b/shell/hush_test/hush-psubst/emptytick.right @@ -0,0 +1,14 @@ +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 diff --git a/shell/hush_test/hush-psubst/emptytick.tests b/shell/hush_test/hush-psubst/emptytick.tests new file mode 100755 index 0000000..af3a183 --- /dev/null +++ b/shell/hush_test/hush-psubst/emptytick.tests @@ -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 $? -- cgit v1.1