Suspecting bug in /bin/sh's IFS

Oliver Fromme olli at
Tue Mar 24 03:55:58 PDT 2009

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:
 > > The patch is against RELENG_7, I hope it applies to -CURRENT as well.
 > > 
 > > The NetBSD commit message also refers to
 > >
 > > 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:

"A misleading benchmark test can accomplish in minutes
what years of good engineering can never do." -- Dilbert (2009-03-02)

More information about the freebsd-standards mailing list