aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash_test/ash-misc/control_char3.right1
-rwxr-xr-xshell/ash_test/ash-misc/control_char3.tests2
-rw-r--r--shell/ash_test/ash-misc/control_char4.right1
-rwxr-xr-xshell/ash_test/ash-misc/control_char4.tests2
-rw-r--r--shell/hush.c11
-rw-r--r--shell/hush_test/hush-misc/control_char3.right1
-rwxr-xr-xshell/hush_test/hush-misc/control_char3.tests2
-rw-r--r--shell/hush_test/hush-misc/control_char4.right1
-rwxr-xr-xshell/hush_test/hush-misc/control_char4.tests2
9 files changed, 23 insertions, 0 deletions
diff --git a/shell/ash_test/ash-misc/control_char3.right b/shell/ash_test/ash-misc/control_char3.right
new file mode 100644
index 000000000..283e02cbb
--- /dev/null
+++ b/shell/ash_test/ash-misc/control_char3.right
@@ -0,0 +1 @@
SHELL: line 1: : not found
diff --git a/shell/ash_test/ash-misc/control_char3.tests b/shell/ash_test/ash-misc/control_char3.tests
new file mode 100755
index 000000000..4359db3f3
--- /dev/null
+++ b/shell/ash_test/ash-misc/control_char3.tests
@@ -0,0 +1,2 @@
1# (set argv0 to "SHELL" to avoid "/path/to/shell: blah" in error messages)
2$THIS_SH -c '\' SHELL
diff --git a/shell/ash_test/ash-misc/control_char4.right b/shell/ash_test/ash-misc/control_char4.right
new file mode 100644
index 000000000..2bf18e684
--- /dev/null
+++ b/shell/ash_test/ash-misc/control_char4.right
@@ -0,0 +1 @@
SHELL: line 1: -: not found
diff --git a/shell/ash_test/ash-misc/control_char4.tests b/shell/ash_test/ash-misc/control_char4.tests
new file mode 100755
index 000000000..48010f154
--- /dev/null
+++ b/shell/ash_test/ash-misc/control_char4.tests
@@ -0,0 +1,2 @@
1# (set argv0 to "SHELL" to avoid "/path/to/shell: blah" in error messages)
2$THIS_SH -c '"-"' SHELL
diff --git a/shell/hush.c b/shell/hush.c
index 9fead37da..249728b9d 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -5235,6 +5235,11 @@ static int encode_string(o_string *as_string,
5235 } 5235 }
5236#endif 5236#endif
5237 o_addQchr(dest, ch); 5237 o_addQchr(dest, ch);
5238 if (ch == SPECIAL_VAR_SYMBOL) {
5239 /* Convert "^C" to corresponding special variable reference */
5240 o_addchr(dest, SPECIAL_VAR_QUOTED_SVS);
5241 o_addchr(dest, SPECIAL_VAR_SYMBOL);
5242 }
5238 goto again; 5243 goto again;
5239#undef as_string 5244#undef as_string
5240} 5245}
@@ -5346,6 +5351,11 @@ static struct pipe *parse_stream(char **pstring,
5346 if (ch == '\n') 5351 if (ch == '\n')
5347 continue; /* drop \<newline>, get next char */ 5352 continue; /* drop \<newline>, get next char */
5348 nommu_addchr(&ctx.as_string, '\\'); 5353 nommu_addchr(&ctx.as_string, '\\');
5354 if (ch == SPECIAL_VAR_SYMBOL) {
5355 nommu_addchr(&ctx.as_string, ch);
5356 /* Convert \^C to corresponding special variable reference */
5357 goto case_SPECIAL_VAR_SYMBOL;
5358 }
5349 o_addchr(&ctx.word, '\\'); 5359 o_addchr(&ctx.word, '\\');
5350 if (ch == EOF) { 5360 if (ch == EOF) {
5351 /* Testcase: eval 'echo Ok\' */ 5361 /* Testcase: eval 'echo Ok\' */
@@ -5670,6 +5680,7 @@ static struct pipe *parse_stream(char **pstring,
5670 /* Note: nommu_addchr(&ctx.as_string, ch) is already done */ 5680 /* Note: nommu_addchr(&ctx.as_string, ch) is already done */
5671 5681
5672 switch (ch) { 5682 switch (ch) {
5683 case_SPECIAL_VAR_SYMBOL:
5673 case SPECIAL_VAR_SYMBOL: 5684 case SPECIAL_VAR_SYMBOL:
5674 /* Convert raw ^C to corresponding special variable reference */ 5685 /* Convert raw ^C to corresponding special variable reference */
5675 o_addchr(&ctx.word, SPECIAL_VAR_SYMBOL); 5686 o_addchr(&ctx.word, SPECIAL_VAR_SYMBOL);
diff --git a/shell/hush_test/hush-misc/control_char3.right b/shell/hush_test/hush-misc/control_char3.right
new file mode 100644
index 000000000..94b4f8699
--- /dev/null
+++ b/shell/hush_test/hush-misc/control_char3.right
@@ -0,0 +1 @@
hush: can't execute '': No such file or directory
diff --git a/shell/hush_test/hush-misc/control_char3.tests b/shell/hush_test/hush-misc/control_char3.tests
new file mode 100755
index 000000000..4359db3f3
--- /dev/null
+++ b/shell/hush_test/hush-misc/control_char3.tests
@@ -0,0 +1,2 @@
1# (set argv0 to "SHELL" to avoid "/path/to/shell: blah" in error messages)
2$THIS_SH -c '\' SHELL
diff --git a/shell/hush_test/hush-misc/control_char4.right b/shell/hush_test/hush-misc/control_char4.right
new file mode 100644
index 000000000..698e21427
--- /dev/null
+++ b/shell/hush_test/hush-misc/control_char4.right
@@ -0,0 +1 @@
hush: can't execute '-': No such file or directory
diff --git a/shell/hush_test/hush-misc/control_char4.tests b/shell/hush_test/hush-misc/control_char4.tests
new file mode 100755
index 000000000..48010f154
--- /dev/null
+++ b/shell/hush_test/hush-misc/control_char4.tests
@@ -0,0 +1,2 @@
1# (set argv0 to "SHELL" to avoid "/path/to/shell: blah" in error messages)
2$THIS_SH -c '"-"' SHELL