Modified Files:
src/bin/sh: miscbltin.c
Log Message:
Fix the way the 'read' builtin processes IFS. In particular:
- IFS whitespace is now processes correctly,
- Trailing non-whitespace IFS characters are added to the last variable
iff a subsequent variable would have been assigned a non-null string.
Now passes the 'read' tests in http://www.research.att.com/~gsf/public/ifs.sh
To generate a diff of this commit:
cvs rdiff -r1.34 -r1.35 src/bin/sh/miscbltin.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-...@muc.de
Modified Files:
src/bin/sh: expand.c
Log Message:
Check quoting before merging ifs regions.
sh -c 'set -- a; x="b c"; set -- "$@"$x'
now correctly gives $1=ab, $2=c
To generate a diff of this commit:
cvs rdiff -r1.69 -r1.70 src/bin/sh/expand.c
That was the wrong comment (that one applies to rev 1.69, and is arguable
better than the one I used).
1.70 needs:
Don't generate empty trailing arguments when field-splitting
a string that ends with non-whitespace IFS.
sh -c 'IFS=":"; set -- x$IFS; echo $#'
now correctly returns 1.
NetBSD's /bin/sh now passes all the IFS tests in:
http://www.research.att.com/~gsf/public/ifs.sh
David
--
David Laight: da...@l8s.co.uk
Pretty cool. I've put a few numbers for comparison in my weblog[1]:
sh NetBSD-current: # tests 6856 passed 6856 failed 0
bash 2.05b.0(1): # tests 6856 passed 5408 failed 1448
bash 3.00.16(1): # tests 6856 passed 5408 failed 1448
ksh Solaris 9/x86: # tests 6856 passed 4456 failed 2400
ksh NetBSD 2.0_STABLE: # tests 6856 passed 2584 failed 4272
sh NetBSD 2.0_STABLE: # tests 6856 passed 1176 failed 5680 ordered 1336
sh Solaris 9/x86: aborts with "bad substitution"
BTW, maybe import that test script into src/regress?
- Hubert
[1] http://www.feyrer.de/NetBSD/blog.html#20050320_1408
--
NetBSD - Free AND Open! (And of course secure, portable, yadda yadda)
> >NetBSD's /bin/sh now passes all the IFS tests in:
> > http://www.research.att.com/~gsf/public/ifs.sh
>
> Pretty cool. I've put a few numbers for comparison in my weblog[1]:
Some time ago I had got only zsh passed tests (not this set but with show
trial mix of space and non-space chars). It's interesting to include it
in this compatison.
> sh NetBSD-current: # tests 6856 passed 6856 failed 0
> bash 2.05b.0(1): # tests 6856 passed 5408 failed 1448
> bash 3.00.16(1): # tests 6856 passed 5408 failed 1448
> ksh Solaris 9/x86: # tests 6856 passed 4456 failed 2400
> ksh NetBSD 2.0_STABLE: # tests 6856 passed 2584 failed 4272
> sh NetBSD 2.0_STABLE: # tests 6856 passed 1176 failed 5680 ordered 1336
> sh Solaris 9/x86: aborts with "bad substitution"
>
> BTW, maybe import that test script into src/regress?
-netch-