← Commit list

bab8828b0

Denys Vlasenko
Denys Vlasenko
2023-06-12
SUCCESS Duration: 156s

Subject

hush: fix expansion of space in "a=${a:+$a }c" construct

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/ash_test/ash-quoting/space_in_varexp1.right+2 -0
@@ -0,0 +1,2 @@
+1:'b c'
+2:'b c'
shell/ash_test/ash-quoting/space_in_varexp1.tests+6 -0
@@ -0,0 +1,6 @@
+a=b
+a=${a:+$a }c
+echo "1:'$a'"
+a=b
+a="${a:+$a }c"
+echo "2:'$a'"
shell/hush.c+1 -1
@@ -6398,7 +6398,7 @@ static NOINLINE int encode_then_append_var_plusminus(o_string *output, int n,
if (!dest.o_expflags) {
if (ch == EOF)
break;
- if (!dquoted && strchr(G.ifs, ch)) {
+ if (!dquoted && !(output->o_expflags & EXP_FLAG_SINGLEWORD) && strchr(G.ifs, ch)) {
/* PREFIX${x:d${e}f ...} and we met space: expand "d${e}f" and start new word.
* do not assume we are at the start of the word (PREFIX above).
*/
shell/hush_test/hush-quoting/space_in_varexp1.right+2 -0
@@ -0,0 +1,2 @@
+1:'b c'
+2:'b c'
shell/hush_test/hush-quoting/space_in_varexp1.tests+6 -0
@@ -0,0 +1,6 @@
+a=b
+a=${a:+$a }c
+echo "1:'$a'"
+a=b
+a="${a:+$a }c"
+echo "2:'$a'"