Re: [Partial patch] IFS and read builtin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Jilles Tjoelker <jilles@xxxxxxxx> wrote:
>
> The intention is that if there are more fields than variables, the final
> variable receive the exact text after the already assigned fields and
> their delimiters (apart from trailing IFS whitespace). The POSIX.1-2008
> text achieves this if used with the POSIX.1-2008 field splitting rules,
> and so does the text you cited if used with the old field splitting
> rules (which result in five fields for " 1 ,2 3,,").

I agree that dash is wrong here.  However, the underlying logic is
correct as you can see from:

$ echo "1,2,3,"         | { read a; IFS=','; set -- $a; echo $#; }
3
$

So it's just the use in read that needs to be fixed.

FWIW I tried your patch but it grew the binary by about 0.5%.
This coupled with the fact that we'll now need to maintain two
copies of IFS logic (should it ever change again god forbid) means
that I'd like to stay with the current implementation if possible.

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

Powered by Linux