klibc-bot for Herbert Xu
2020-Mar-28 21:48 UTC
[klibc] [klibc:update-dash] dash: expand: Fixed "$@" expansion when EXP_FULL is false
Commit-ID: 57da2c169d4f22009725f47645ca6a4501f2475f Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=57da2c169d4f22009725f47645ca6a4501f2475f Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Thu, 1 Jan 2015 07:53:10 +1100 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:54 +0000 [klibc] dash: expand: Fixed "$@" expansion when EXP_FULL is false [ dash commit bc4d989af4a4069f70f19fbe41a7d7ad61965ff8 ] The commit 3c06acdac0b1ba0e0acdda513a57ee6e31385dce ([EXPAND] Split unquoted $@/$* correctly when IFS is set but empty) broke the case where $@ is in quotes and EXP_FULL is false. In that case we should still emit IFS as field splitting is not performed. Reported-by: Juergen Daubert <jue at jue.li> 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index a2f99f14..c04ff6e1 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -901,6 +901,7 @@ varvalue(char *name, int varflags, int flags, int *quotedp) int quotes = (discard ? 0 : (flags & QUOTES_ESC)) | QUOTES_KEEPNUL; ssize_t len = 0; + sep = (flags & EXP_FULL) << CHAR_BIT; syntax = quoted ? DQSYNTAX : BASESYNTAX; switch (*name) { @@ -931,16 +932,14 @@ numvar: expdest = p; break; case '@': - sep = 0; - if (quoted) + if (quoted && sep) goto param; /* fall through */ case '*': - sep = ifsset() ? ifsval()[0] : ' '; - if (!quoted) { + if (quoted) + sep = 0; + sep |= ifsset() ? ifsval()[0] : ' '; param: - sep |= (flags & EXP_FULL) << CHAR_BIT; - } sepc = sep; *quotedp = !sepc; if (!(ap = shellparam.p))
Maybe Matching Threads
- [klibc:update-dash] expand: Fixed "$@" expansion when EXP_FULL is false
- [klibc:update-dash] [EXPAND] Optimise nulonly away and just use quoted as before
- [klibc:update-dash] dash: [EXPAND] Optimise nulonly away and just use quoted as before
- [klibc:update-dash] expand: Fix ghost fields with unquoted $@/$*
- [klibc:update-dash] dash: expand: Fix ghost fields with unquoted $@/$*