Date: Tue, 24 Mar 2009 11:55:26 +0100 (CET) From: Oliver Fromme <olli@lurza.secnetix.de> To: stefan@fafoe.narf.at (Stefan Farfeleder) Cc: freebsd-standards@FreeBSD.ORG, Jilles Tjoelker <jilles@stack.nl> Subject: Re: Suspecting bug in /bin/sh's IFS Message-ID: <200903241055.n2OAtQKr035646@lurza.secnetix.de> In-Reply-To: <20090322221540.GA1269@lizard.fafoe.narf.at>
next in thread | previous in thread | raw e-mail | index | archive | help
Stefan Farfeleder wrote: > 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. Cool, thanks! -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "A misleading benchmark test can accomplish in minutes what years of good engineering can never do." -- Dilbert (2009-03-02)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903241055.n2OAtQKr035646>