Work around statfs() overflow on some XFS systems.

statfs(".", 0xffa8ad50)                 = -1 EOVERFLOW (Value too large for defined data type)

Ref <20141222221621.GO7251@onerussian.com>
This commit is contained in:
Joey Hess 2014-12-23 11:52:23 -04:00
parent db27ad26bf
commit 02f150b33d
2 changed files with 5 additions and 1 deletions

View file

@ -21,6 +21,7 @@ import Control.Applicative
import qualified System.FilePath.Posix as Posix import qualified System.FilePath.Posix as Posix
#else #else
import System.Posix.Files import System.Posix.Files
import Utility.Exception
#endif #endif
import qualified "MissingH" System.Path as MissingH import qualified "MissingH" System.Path as MissingH
@ -255,7 +256,9 @@ fileNameLengthLimit :: FilePath -> IO Int
fileNameLengthLimit _ = return 255 fileNameLengthLimit _ = return 255
#else #else
fileNameLengthLimit dir = do fileNameLengthLimit dir = do
l <- fromIntegral <$> getPathVar dir FileNameLimit -- getPathVar can fail due to statfs(2) overflow
l <- catchDefaultIO 0 $
fromIntegral <$> getPathVar dir FileNameLimit
if l <= 0 if l <= 0
then return 255 then return 255
else return $ minimum [l, 255] else return $ minimum [l, 255]

1
debian/changelog vendored
View file

@ -1,6 +1,7 @@
git-annex (5.20141220) UNRELEASED; urgency=medium git-annex (5.20141220) UNRELEASED; urgency=medium
* vicfg: Avoid crashing on badly encoded config data. * vicfg: Avoid crashing on badly encoded config data.
* Work around statfs() overflow on some XFS systems.
-- Joey Hess <id@joeyh.name> Mon, 22 Dec 2014 15:16:38 -0400 -- Joey Hess <id@joeyh.name> Mon, 22 Dec 2014 15:16:38 -0400