Skip to content

Default FD buffer size is not a power of 2

From https://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC.IO.FD.html

-- We used to use System.Posix.Internals.dEFAULT_BUFFER_SIZE, which is
-- taken from the value of BUFSIZ on the current platform.  This value
-- varies too much though: it is 512 on Windows, 1024 on OS X and 8192
-- on Linux.  So let's just use a decent size on every platform:
dEFAULT_FD_BUFFER_SIZE :: Int
dEFAULT_FD_BUFFER_SIZE = 8096

8096 is not a power of two, and does not agree with the original commit message that sets it to 8KB (https://github.com/ghc/ghc/blame/master/libraries/base/GHC/IO/FD.hs#L119).

Confirmed by Simon Marlow on IRC that this is a typo, a mix between 8192 and 4096.

I'll send a patch to set it to 8192.

It would be nice if the fix could be released in both GHC 8.2 and and 8.0.3.

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC nh2, simonmar
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information