Field splitting bug affecting OpenBSD sh and its derivatives
"Kerin Millar" <[email protected]> Sun, 31 May 2026 10:59:15 +0100
| Newsgroups | gmane.os.openbsd.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi Brian,
I trust that you are well.
In August of 2024, I discovered a bug concerning field splitting that affects OpenBSD sh(1) and its derivatives, though I neglected to report it at the time. To wit:
$ sh -c 'IFS=:; path=:; set -- $path; printf {%s} "$#" "$@"; echo'
{0}
This outcome does not conform to the Shell Command Language specification. Other implementations that I have tried produce the expected results. For instance:
$ dash -c 'IFS=:; path=:; set -- $path; printf {%s} "$#" "$@"; echo'
{1}{}
See also:
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=116645c35885
Copying in bugs@ in case this is best handled on-list. Please note that I am not subscribed.
Regards,
--
Kerin Millar