* [EXPAND] Fixed "$@" expansion when EXP_FULL is false
[not found] <20141231180330.GA32534@jue.netz>
@ 2014-12-31 20:56 ` Herbert Xu
0 siblings, 0 replies; only message in thread
From: Herbert Xu @ 2014-12-31 20:56 UTC (permalink / raw)
To: Juergen Daubert; +Cc: dash
On Wed, Dec 31, 2014 at 07:03:30PM +0100, Juergen Daubert wrote:
> Hi,
>
> today I tried to use dash from git as /bin/sh and run in a lot of
> problem I don't see with stable version 0.5.8.
> After some investigations I narrowed it down to commit
>
> 3c06acdac0b1ba0e0acdda513a57ee6e31385dce
> [EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
>
> and related following to expand.c
>
>
> It seems that the changes to dash triggers, among others, some problem
> with libtool.
>
> As examples I've attached build logs for libpixman and kbd, there are a
> lot other builds that failed as well. If you need more, please let me
> know.
Thanks for the report. This patch should fix the problem.
-- >8 --
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@jue.li>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/src/expand.c b/src/expand.c
index dfb3f0e..b2d710d 100644
--- a/src/expand.c
+++ b/src/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))
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-31 20:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20141231180330.GA32534@jue.netz>
2014-12-31 20:56 ` [EXPAND] Fixed "$@" expansion when EXP_FULL is false Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).