handle sha*sum's leading \ in checksum with certian unsual filenames
* Bugfix: Remove leading \ from checksums output by sha*sum commands, when the filename contains \ or a newline. Closes: #696384 * fsck: Still accept checksums with a leading \ as valid, now that above bug is fixed. * migrate: Remove leading \ in checksums
This commit is contained in:
parent
071adb0709
commit
e71f85645e
6 changed files with 36 additions and 6 deletions
|
@ -11,6 +11,7 @@ import Common.Annex
|
|||
import Command
|
||||
import Backend
|
||||
import qualified Types.Key
|
||||
import qualified Types.Backend
|
||||
import Types.KeySource
|
||||
import Annex.Content
|
||||
import qualified Command.ReKey
|
||||
|
@ -26,7 +27,7 @@ start :: FilePath -> (Key, Backend) -> CommandStart
|
|||
start file (key, oldbackend) = do
|
||||
exists <- inAnnex key
|
||||
newbackend <- choosebackend =<< chooseBackend file
|
||||
if (newbackend /= oldbackend || upgradableKey key) && exists
|
||||
if (newbackend /= oldbackend || upgradableKey oldbackend key) && exists
|
||||
then do
|
||||
showStart "migrate" file
|
||||
next $ perform file key oldbackend newbackend
|
||||
|
@ -35,10 +36,17 @@ start file (key, oldbackend) = do
|
|||
choosebackend Nothing = Prelude.head <$> orderedList
|
||||
choosebackend (Just backend) = return backend
|
||||
|
||||
{- Checks if a key is upgradable to a newer representation. -}
|
||||
{- Ideally, all keys have file size metadata. Old keys may not. -}
|
||||
upgradableKey :: Key -> Bool
|
||||
upgradableKey key = isNothing $ Types.Key.keySize key
|
||||
{- Checks if a key is upgradable to a newer representation.
|
||||
-
|
||||
- Reasons for migration:
|
||||
- - Ideally, all keys have file size metadata. Old keys may not.
|
||||
- - Something has changed in the backend, such as a bug fix.
|
||||
-}
|
||||
upgradableKey :: Backend -> Key -> Bool
|
||||
upgradableKey backend key = isNothing (Types.Key.keySize key) || backendupgradable
|
||||
where
|
||||
backendupgradable = maybe False (\a -> a key)
|
||||
(Types.Backend.canUpgradeKey backend)
|
||||
|
||||
{- Store the old backend's key in the new backend
|
||||
- The old backend's key is not dropped from it, because there may
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue