← Commit list

9a95df904

Denys Vlasenko
Denys Vlasenko
2018-04-02
SUCCESS Duration: 142s

Subject

ash: expand: Fix bugs with words connected to the right of $@

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.c+7 -4
@@ -5975,7 +5975,10 @@ ifsbreakup(char *string, struct arglist *arglist)
realifs = ifsset() ? ifsval() : defifs;
ifsp = &ifsfirst;
do {
+ int afternul;
+
p = string + ifsp->begoff;
+ afternul = nulonly;
nulonly = ifsp->nulonly;
ifs = nulonly ? nullstr : realifs;
ifsspc = 0;
@@ -5987,7 +5990,7 @@ ifsbreakup(char *string, struct arglist *arglist)
p++;
continue;
}
- if (!nulonly)
+ if (!(afternul || nulonly))
ifsspc = (strchr(defifs, *p) != NULL);
/* Ignore IFS whitespace at start */
if (q == start && ifsspc) {
@@ -6650,12 +6653,12 @@ argstr(char *p, int flags)
case CTLENDVAR: /* ??? */
goto breakloop;
case CTLQUOTEMARK:
- inquotes ^= EXP_QUOTED;
/* "$@" syntax adherence hack */
- if (inquotes && !memcmp(p, dolatstr + 1, DOLATSTRLEN - 1)) {
- p = evalvar(p + 1, flags | inquotes) + 1;
+ if (!inquotes && !memcmp(p, dolatstr + 1, DOLATSTRLEN - 1)) {
+ p = evalvar(p + 1, flags | EXP_QUOTED) + 1;
goto start;
}
+ inquotes ^= EXP_QUOTED;
addquote:
if (flags & QUOTES_ESC) {
p--;
shell/ash_test/ash-parsing/starquoted3.right+2 -0
@@ -0,0 +1,2 @@
+<a>
+<>
shell/ash_test/ash-parsing/starquoted3.tests+1 -0
@@ -0,0 +1 @@
+set -- a ""; space=" "; printf "<%s>\n" "$@"$space
shell/hush_test/hush-parsing/starquoted3.right+2 -0
@@ -0,0 +1,2 @@
+<a>
+<>
shell/hush_test/hush-parsing/starquoted3.tests+1 -0
@@ -0,0 +1 @@
+set -- a ""; space=" "; printf "<%s>\n" "$@"$space