fsck: When checksumming a file fails due to a hardware fault, the file is now moved to the bad directory, and the fsck proceeds. Before, the fsck immediately failed.
This commit is contained in:
parent
ff629a1ec0
commit
8990d4cc68
4 changed files with 21 additions and 11 deletions
|
@ -95,7 +95,9 @@ selectExtension f
|
|||
|
||||
{- A key's checksum is checked during fsck. -}
|
||||
checkKeyChecksum :: Hash -> Key -> FilePath -> Annex Bool
|
||||
checkKeyChecksum hash key file = do
|
||||
checkKeyChecksum hash key file = go `catchHardwareFault` hwfault
|
||||
where
|
||||
go = do
|
||||
fast <- Annex.getState Annex.fast
|
||||
mstat <- liftIO $ catchMaybeIO $ getFileStatus file
|
||||
case (mstat, fast) of
|
||||
|
@ -104,7 +106,6 @@ checkKeyChecksum hash key file = do
|
|||
showSideAction "checksum"
|
||||
check <$> hashFile hash file filesize
|
||||
_ -> return True
|
||||
where
|
||||
expected = keyHash key
|
||||
check s
|
||||
| s == expected = True
|
||||
|
@ -114,6 +115,10 @@ checkKeyChecksum hash key file = do
|
|||
| '\\' : s == expected = True
|
||||
| otherwise = False
|
||||
|
||||
hwfault e = do
|
||||
warning $ "hardware fault: " ++ show e
|
||||
return False
|
||||
|
||||
keyHash :: Key -> String
|
||||
keyHash key = dropExtensions (keyName key)
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ import Utility.Exception
|
|||
import Data.List
|
||||
import Data.Char
|
||||
import System.IO
|
||||
import Control.Applicative
|
||||
import Prelude
|
||||
|
||||
externalSHA :: String -> Int -> FilePath -> IO (Either String String)
|
||||
externalSHA command shasize file = do
|
||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -8,6 +8,9 @@ git-annex (5.20150523) UNRELEASED; urgency=medium
|
|||
* Revert removal dependency on obsolete hamlet package, since the
|
||||
autobuilders are not ready for this change yet and it prevented them
|
||||
from building the webapp. Reopens: #786659
|
||||
* fsck: When checksumming a file fails due to a hardware fault,
|
||||
the file is now moved to the bad directory, and the fsck proceeds.
|
||||
Before, the fsck immediately failed.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Fri, 22 May 2015 22:23:32 -0400
|
||||
|
||||
|
|
|
@ -12,3 +12,7 @@ git-annex: sha1sum parse error
|
|||
### What version of git-annex are you using? On what operating system?
|
||||
git-annex 5.20150508
|
||||
linux 4.0.4
|
||||
|
||||
> [[fixed|done]]; IO errors are now detected and the file moved to bad/;
|
||||
> the fsck also continues past that failure now, so if a disk has
|
||||
> a lot of damanged files, it will find them all. --[[Joey]]
|
||||
|
|
Loading…
Reference in a new issue