Package: ghc Version: 7.6.3-20 Severity: normal import System.Posix.Files import Control.Exception import Foreign.C.Types main = print =<< (try (getPathVar "." FileNameLimit) :: IO (Either IOException CLong))
This program can fail on a system with a large disk: Left .: getPathVar: failed (Value too large for defined data type) statfs(".", 0xffa8ad50) = -1 EOVERFLOW (Value too large for defined data type) The problem is, getPathVar is using statfs, not statfs64. Here's a C program that uses statfs64: #define _LARGEFILE64_SOURCE 1 #include <sys/vfs.h> #include <stdio.h> main () { struct statfs64 buf; statfs64(".", &buf); printf("%li\n", buf.f_namelen); } And strace shows just how large some of the fields are, which is why statfs() overflows. statfs64(".", 84, {f_type=0x2fc12fc1, f_bsize=131072, f_blocks=67107265, f_bfree=66904371, f_bavail=66904371, f_files=17127878964, f_ffree=17127519173, f_fsid={-676822403, 15770009}, f_namelen=255, f_frsize=131072, f_flags=4128}) = 0 An added problem is that getPathVar is implemented using pathconf, rather than using statfs directly. It seems that setting _LARGEFILE64_SOURCE does not cause pathconf to use statfs64. This may be a glibc bug. -- see shy jo
signature.asc
Description: Digital signature