vicfg: Avoid crashing on badly encoded config data.

This commit is contained in:
Joey Hess 2014-12-22 15:17:00 -04:00
parent af28cce617
commit 8af447c01b
3 changed files with 15 additions and 4 deletions

View file

@ -42,7 +42,7 @@ start = do
createAnnexDirectory $ parentDir f
cfg <- getCfg
descs <- uuidDescriptions
liftIO $ writeFile f $ genCfg cfg descs
liftIO $ writeFileAnyEncoding f $ genCfg cfg descs
vicfg cfg f
stop
@ -52,11 +52,11 @@ vicfg curcfg f = do
-- Allow EDITOR to be processed by the shell, so it can contain options.
unlessM (liftIO $ boolSystem "sh" [Param "-c", Param $ unwords [vi, shellEscape f]]) $
error $ vi ++ " exited nonzero; aborting"
r <- parseCfg (defCfg curcfg) <$> liftIO (readFileStrict f)
r <- parseCfg (defCfg curcfg) <$> liftIO (readFileStrictAnyEncoding f)
liftIO $ nukeFile f
case r of
Left s -> do
liftIO $ writeFile f s
liftIO $ writeFileAnyEncoding f s
vicfg curcfg f
Right newcfg -> setCfg curcfg newcfg

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
git-annex (5.20141220) UNRELEASED; urgency=medium
* vicfg: Avoid crashing on badly encoded config data.
-- Joey Hess <id@joeyh.name> Mon, 22 Dec 2014 15:16:38 -0400
git-annex (5.20141219) unstable; urgency=medium
* Webapp: When adding a new box.com remote, use the new style chunking.

View file

@ -11,7 +11,10 @@ The problem does exit on all the clone of the repos.
### What steps will reproduce the problem?
I don't know if the "è" in the directory name is linked to this. It seem also that the description of one of the repository has been incorrect (something like "toubib: ~/Biblioth⯁⯁⯁que calibre/" where the three ⯁ replace one incorrectly encoded char that was, since then, changed.
I don't know if the "è" in the directory name is linked to this. It seem
also that the description of one of the repository has been incorrect
(something like "toubib: ~/Biblioth⯁⯁⯁que calibre/" where the three ⯁
replace one incorrectly encoded char that was, since then, changed.
### What version of git-annex are you using? On what operating system?
@ -27,3 +30,5 @@ I'm using the more uptodate version that are in Debian sid:
local repository version: 5
supported repository version: 5
upgrade supported from repository versions: 0 1 2 4
> [[fixed|done]] --[[Joey]]