diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-14 17:17:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-14 17:17:20 -0400 |
commit | 0eed604446ce09e375b8f409fc77d98df9459c23 (patch) | |
tree | 85be0d07295c6fd1265dd7e2920473e834d01d7a /Utility/StatFS.hsc | |
parent | a3d97e0c85cf6c1b6668939c02d07522d06f2d18 (diff) |
Add a sanity check for bad StatFS results.
git-annex FTBFS on s390, mips, powerpc, sparc. That StatFS code is failing
on all of them. At least on s390, the failure appears as:
Just (FileSystemStats {fsStatBlockSize = 4096, fsStatBlockCount = 0,
fsStatByteCount = 0, fsStatBytesFree = 0, fsStatBytesAvailable = 0,
fsStatBytesUsed = 0})
While I don't understand why this is happening, or how to fix it,
bandaid over it by checking for obviously bad values and returning Nothing.
That disables disk free space checking, but at least git-annex will work.
Upstream bug: http://code.google.com/p/xmobar/issues/detail?id=70
Diffstat (limited to 'Utility/StatFS.hsc')
-rw-r--r-- | Utility/StatFS.hsc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Utility/StatFS.hsc b/Utility/StatFS.hsc index d3e4a507e..937571dfa 100644 --- a/Utility/StatFS.hsc +++ b/Utility/StatFS.hsc @@ -114,7 +114,7 @@ getFileSystemStats path = bfree <- (#peek struct statfs, f_bfree) vfs bavail <- (#peek struct statfs, f_bavail) vfs let bpb = toI bsize - return $ Just FileSystemStats + let stats = FileSystemStats { fsStatBlockSize = bpb , fsStatBlockCount = toI bcount , fsStatByteCount = toI bcount * bpb @@ -122,4 +122,7 @@ getFileSystemStats path = , fsStatBytesAvailable = toI bavail * bpb , fsStatBytesUsed = toI (bcount - bfree) * bpb } + if fsStatBlockCount stats == 0 || fsStatBlockSize stats == 0 + then return Nothing + else return $ Just stats #endif |