diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2014-10-08 15:42:08 +0800 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2020-03-28 21:42:54 +0000 |
commit | 2474db119d9240db258134f8532ebcb096e539a4 (patch) | |
tree | 0a82a10dccb3e36d490cdd674b647d21e57e4dc2 | |
parent | 4dc603d0fe5a997d8bbd5048b229d655e6549ced (diff) | |
download | klibc-2474db119d9240db258134f8532ebcb096e539a4.tar.gz |
[klibc] dash: [EXPAND] Do not split quoted VSLENGTH and VSTRIM
[ dash commit 8ecad23eae02bbdf36fe5dc8e53deb67fb894357 ]
Currently VSLENGTH and VSTRIM* are field-split even within quotes.
This is obviously wrong. This patch fixes that.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | usr/dash/expand.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/usr/dash/expand.c b/usr/dash/expand.c index add952b7d5fd1..9bbd19daa262a 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -753,28 +753,22 @@ vsplus: argstr(p, flag | EXP_TILDE | EXP_WORD); goto end; } - if (easy) - goto record; - goto end; + goto record; } if (subtype == VSASSIGN || subtype == VSQUESTION) { - if (varlen < 0) { - if (subevalvar(p, var, 0, subtype, startloc, - varflags, flag & ~QUOTES_ESC)) { - varflags &= ~VSNUL; - /* - * Remove any recorded regions beyond - * start of variable - */ - removerecordregions(startloc); - goto again; - } - goto end; - } - if (easy) + if (varlen >= 0) goto record; - goto end; + + subevalvar(p, var, 0, subtype, startloc, varflags, + flag & ~QUOTES_ESC); + varflags &= ~VSNUL; + /* + * Remove any recorded regions beyond + * start of variable + */ + removerecordregions(startloc); + goto again; } if (varlen < 0 && uflag) @@ -786,9 +780,9 @@ vsplus: } if (subtype == VSNORMAL) { +record: if (!easy) goto end; -record: recordregion(startloc, expdest - (char *)stackblock(), nulonly); goto end; } |