[klibc] [klibc:update-dash] [EXPAND] Do not split quoted VSLENGTH and VSTRIM
klibc-bot for Herbert Xu
herbert at gondor.apana.org.au
Thu Jan 24 19:15:22 PST 2019
Commit-ID: baa2d8dd94e0d59450fc8bc96c27c2dd891c014c
Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=baa2d8dd94e0d59450fc8bc96c27c2dd891c014c
Author: Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Wed, 8 Oct 2014 15:42:08 +0800
Committer: Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 25 Jan 2019 02:57:21 +0000
[klibc] [EXPAND] Do not split quoted VSLENGTH and VSTRIM
Currently VSLENGTH and VSTRIM* are field-split even within quotes.
This is obviously wrong. This patch fixes that.
Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
usr/dash/expand.c | 32 +++++++++++++-------------------
1 file changed, 13 insertions(+), 19 deletions(-)
diff --git a/usr/dash/expand.c b/usr/dash/expand.c
index add952b7..9bbd19da 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;
}
More information about the klibc
mailing list