System.Posix.IO.ByteString fdRead and fdWrite.

Brandon Allbery allbery.b at
Wed Nov 20 23:18:09 UTC 2013

On Wed, Nov 20, 2013 at 6:03 PM, Ashley Yakeley <ashley at> wrote:

> In unix-, fdRead and fdWrite in System.Posix.IO.ByteString use
> String instead of ByteString. This is wrong, isn't it? The point of the
> .ByteString modules is to do IO in ByteString.

No. ByteString provides its own routines for that.

The point of System.Posix.IO.ByteString is to provide a ByteString (which
is to say, a correct POSIX) interface to *filesystem paths*. Using String
for these is entirely incorrect, because POSIX pathnames are literally byte
strings --- there is no encoding, just raw bytes with only '/' and '\NUL'
being special. There are *lots* of programs that behave weirdly or crash
because they assume the filesystem uses normalized UTF8, but absolutely
nothing forces pathnames to be UTF8 much less normalized UTF8. (Gtk+ file
dialogs tend to crash with non-UTF8-encoded filenames. They do even weirder
things when filenames are UTF8 but not normalized. OS X native file dialogs
have similar problems.)

brandon s allbery kf8nh                               sine nomine associates
allbery.b at                                  ballbery at
unix, openafs, kerberos, infrastructure, xmonad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list