Skip to content

hSetFileSize zeroes file

The following sequence:

cp /bin/echo /tmp/echo && ghc -e 'import System.IO' -e 'withFile "/tmp/echo" WriteMode (`hSetFileSize` 1000)'

results in /tmp/echo containing 1000 zeros. I would expect the truncated content as if truncate() was called.

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