Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CVS commit: src/bin/sh

1 view
Skip to first unread message

David Laight

unread,
Mar 19, 2005, 9:23:06 AM3/19/05
to

Module Name: src
Committed By: dsl
Date: Sat Mar 19 14:22:50 UTC 2005

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

David Laight

unread,
Mar 19, 2005, 11:38:42 AM3/19/05
to

Module Name: src
Committed By: dsl
Date: Sat Mar 19 16:38:27 UTC 2005

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

David Laight

unread,
Mar 19, 2005, 11:47:45 AM3/19/05
to
On Sat, Mar 19, 2005 at 04:38:27PM +0000, David Laight wrote:
>
> 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

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

Hubert Feyrer

unread,
Mar 20, 2005, 8:16:09 AM3/20/05
to
On Sat, 19 Mar 2005, David Laight wrote:
> 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]:

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)

Valentin Nechayev

unread,
Mar 20, 2005, 11:19:32 AM3/20/05
to
Sun, Mar 20, 2005 at 14:15:48, hubert wrote about "sh & IFS [was: Re: CVS commit: src/bin/sh]":

> >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-

0 new messages