diff options
author | Rob Landley <rob@landley.net> | 2021-03-19 03:52:09 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-03-19 03:52:09 -0500 |
commit | 3aaf63f6d908eea164111791ec90fd608000dfe1 (patch) | |
tree | dfe274a26f3af84a037eb9822fed4307a95c3d2b | |
parent | 7a4524c989c2702b0c86ebe210aa6315da3a1a77 (diff) | |
download | toybox-3aaf63f6d908eea164111791ec90fd608000dfe1.tar.gz |
Fix another sh regression.
-rw-r--r-- | toys/pending/sh.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/toys/pending/sh.c b/toys/pending/sh.c index b3414a7e..f5ed9bd4 100644 --- a/toys/pending/sh.c +++ b/toys/pending/sh.c @@ -646,7 +646,10 @@ static char *parse_word(char *start, int early, int quote) end++; } else toybuf[quote++] = ")}]"[qq]; } else if (*end=='(' && strchr("?*+@!", ii)) toybuf[quote++] = ')'; - else end--; + else { + end--; + if (early && !quote) return end; + } end++; } } @@ -1362,7 +1365,7 @@ static int expand_arg_nobrace(struct sh_arg *arg, char *str, unsigned flags, // both types of subshell work the same, so do $( here not in '$' below // TODO $((echo hello) | cat) ala $(( becomes $( ( retroactively - } else if (cc == '`' || (cc == '$' && strchr("([", str[ii]))) { + } else if (cc == '`' || (cc == '$' && str[ii] && strchr("([", str[ii]))) { off_t pp = 0; s = str+ii-1; |