klibc-bot for Herbert Xu
2019-Jan-25 03:15 UTC
[klibc] [klibc:update-dash] expand: Fixed "$@" expansion when EXP_FULL is false
Commit-ID: 77604985dadef38bdaf251e3898a0b2ef33ea08e Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=77604985dadef38bdaf251e3898a0b2ef33ea08e 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: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] expand: Fixed "$@" expansion when EXP_FULL is false 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))
Seemingly Similar Threads
- [klibc:update-dash] 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 $@/$*