Date: Sun, 22 Mar 2009 23:15:40 +0100 From: Stefan Farfeleder <stefan@fafoe.narf.at> To: Jilles Tjoelker <jilles@stack.nl> Cc: freebsd-standards@FreeBSD.ORG, Oliver Fromme <olli@lurza.secnetix.de> Subject: Re: Suspecting bug in /bin/sh's IFS Message-ID: <20090322221540.GA1269@lizard.fafoe.narf.at> In-Reply-To: <20090321214634.GA36395@stack.nl> References: <200903181213.n2ICDPpT042350@lurza.secnetix.de> <200903191412.n2JECdbl011120@lurza.secnetix.de> <20090321214634.GA36395@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Mar 21, 2009 at 10:46:34PM +0100, Jilles Tjoelker wrote: > > The code is wrong, but your patched code is also wrong. The read builtin > should use the same logic as normal field splitting, with additional > rules if there are more fields in the input than variables. > > I have noticed that NetBSD has already fixed this. I have ported these > fixes over: http://www.stack.nl/~jilles/unix/sh-read-split.patch > The patch is against RELENG_7, I hope it applies to -CURRENT as well. > > The NetBSD commit message also refers to > http://www.research.att.com/~gsf/public/ifs.sh > Just like their /bin/sh, our /bin/sh with the patch now passes the > 'read' tests from there (there are still many other failures though). > > By the way, to avoid all processing by read, one must IFS= read -r VAR. > Without the IFS specification, leading and trailing whitespace will > still be stripped. Thank you, I have committed this patch.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090322221540.GA1269>