aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash_test/ash-quoting/space_in_varexp1.right2
-rwxr-xr-xshell/ash_test/ash-quoting/space_in_varexp1.tests6
-rw-r--r--shell/hush.c2
-rw-r--r--shell/hush_test/hush-quoting/space_in_varexp1.right2
-rwxr-xr-xshell/hush_test/hush-quoting/space_in_varexp1.tests6
5 files changed, 17 insertions, 1 deletions
diff --git a/shell/ash_test/ash-quoting/space_in_varexp1.right b/shell/ash_test/ash-quoting/space_in_varexp1.right
new file mode 100644
index 000000000..a617a91c3
--- /dev/null
+++ b/shell/ash_test/ash-quoting/space_in_varexp1.right
@@ -0,0 +1,2 @@
11:'b c'
22:'b c'
diff --git a/shell/ash_test/ash-quoting/space_in_varexp1.tests b/shell/ash_test/ash-quoting/space_in_varexp1.tests
new file mode 100755
index 000000000..1589587d1
--- /dev/null
+++ b/shell/ash_test/ash-quoting/space_in_varexp1.tests
@@ -0,0 +1,6 @@
1a=b
2a=${a:+$a }c
3echo "1:'$a'"
4a=b
5a="${a:+$a }c"
6echo "2:'$a'"
diff --git a/shell/hush.c b/shell/hush.c
index cdaa67a3b..dbc4aecab 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -6398,7 +6398,7 @@ static NOINLINE int encode_then_append_var_plusminus(o_string *output, int n,
6398 if (!dest.o_expflags) { 6398 if (!dest.o_expflags) {
6399 if (ch == EOF) 6399 if (ch == EOF)
6400 break; 6400 break;
6401 if (!dquoted && strchr(G.ifs, ch)) { 6401 if (!dquoted && !(output->o_expflags & EXP_FLAG_SINGLEWORD) && strchr(G.ifs, ch)) {
6402 /* PREFIX${x:d${e}f ...} and we met space: expand "d${e}f" and start new word. 6402 /* PREFIX${x:d${e}f ...} and we met space: expand "d${e}f" and start new word.
6403 * do not assume we are at the start of the word (PREFIX above). 6403 * do not assume we are at the start of the word (PREFIX above).
6404 */ 6404 */
diff --git a/shell/hush_test/hush-quoting/space_in_varexp1.right b/shell/hush_test/hush-quoting/space_in_varexp1.right
new file mode 100644
index 000000000..a617a91c3
--- /dev/null
+++ b/shell/hush_test/hush-quoting/space_in_varexp1.right
@@ -0,0 +1,2 @@
11:'b c'
22:'b c'
diff --git a/shell/hush_test/hush-quoting/space_in_varexp1.tests b/shell/hush_test/hush-quoting/space_in_varexp1.tests
new file mode 100755
index 000000000..1589587d1
--- /dev/null
+++ b/shell/hush_test/hush-quoting/space_in_varexp1.tests
@@ -0,0 +1,6 @@
1a=b
2a=${a:+$a }c
3echo "1:'$a'"
4a=b
5a="${a:+$a }c"
6echo "2:'$a'"