fsck: Work around bug in persistent that broke display of problematically encoded filenames on stderr when using --incremental.
This commit is contained in:
parent
1fcca1b43b
commit
4ed82e5328
5 changed files with 36 additions and 3 deletions
|
@ -31,6 +31,7 @@ import Types.Key
|
||||||
import Types.UUID
|
import Types.UUID
|
||||||
import Annex.Perms
|
import Annex.Perms
|
||||||
import Annex.LockFile
|
import Annex.LockFile
|
||||||
|
import Messages
|
||||||
|
|
||||||
import Database.Persist.TH
|
import Database.Persist.TH
|
||||||
import Database.Esqueleto hiding (Key)
|
import Database.Esqueleto hiding (Key)
|
||||||
|
@ -77,6 +78,10 @@ openDb u = do
|
||||||
rename tmpdbdir dbdir
|
rename tmpdbdir dbdir
|
||||||
lockFileCached =<< fromRepo (gitAnnexFsckDbLock u)
|
lockFileCached =<< fromRepo (gitAnnexFsckDbLock u)
|
||||||
h <- liftIO $ H.openDb db "fscked"
|
h <- liftIO $ H.openDb db "fscked"
|
||||||
|
|
||||||
|
-- work around https://github.com/yesodweb/persistent/issues/474
|
||||||
|
liftIO setConsoleEncoding
|
||||||
|
|
||||||
return $ FsckHandle h u
|
return $ FsckHandle h u
|
||||||
|
|
||||||
closeDb :: FsckHandle -> Annex ()
|
closeDb :: FsckHandle -> Annex ()
|
||||||
|
|
10
Messages.hs
10
Messages.hs
|
@ -30,6 +30,7 @@ module Messages (
|
||||||
showHeader,
|
showHeader,
|
||||||
showRaw,
|
showRaw,
|
||||||
setupConsole,
|
setupConsole,
|
||||||
|
setConsoleEncoding,
|
||||||
enableDebugOutput,
|
enableDebugOutput,
|
||||||
disableDebugOutput,
|
disableDebugOutput,
|
||||||
debugEnabled,
|
debugEnabled,
|
||||||
|
@ -176,9 +177,12 @@ setupConsole = do
|
||||||
<$> streamHandler stderr DEBUG
|
<$> streamHandler stderr DEBUG
|
||||||
<*> pure preciseLogFormatter
|
<*> pure preciseLogFormatter
|
||||||
updateGlobalLogger rootLoggerName (setLevel NOTICE . setHandlers [s])
|
updateGlobalLogger rootLoggerName (setLevel NOTICE . setHandlers [s])
|
||||||
{- This avoids ghc's output layer crashing on
|
setConsoleEncoding
|
||||||
- invalid encoded characters in
|
|
||||||
- filenames when printing them out. -}
|
{- This avoids ghc's output layer crashing on invalid encoded characters in
|
||||||
|
- filenames when printing them out. -}
|
||||||
|
setConsoleEncoding :: IO ()
|
||||||
|
setConsoleEncoding = do
|
||||||
fileEncoding stdout
|
fileEncoding stdout
|
||||||
fileEncoding stderr
|
fileEncoding stderr
|
||||||
|
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -7,6 +7,8 @@ git-annex (5.20150825) UNRELEASED; urgency=medium
|
||||||
--unused-refspec option. Thanks, Øyvind A. Holm.
|
--unused-refspec option. Thanks, Øyvind A. Holm.
|
||||||
* Make full option parsing be done when not in a git repo, so --help
|
* Make full option parsing be done when not in a git repo, so --help
|
||||||
can be displayed for commands that require a git repo, etc.
|
can be displayed for commands that require a git repo, etc.
|
||||||
|
* fsck: Work around bug in persistent that broke display of
|
||||||
|
problematically encoded filenames on stderr when using --incremental.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 01 Sep 2015 14:46:18 -0700
|
-- Joey Hess <id@joeyh.name> Tue, 01 Sep 2015 14:46:18 -0700
|
||||||
|
|
||||||
|
|
|
@ -76,3 +76,5 @@ git-annex: fsck: 2 failed
|
||||||
|
|
||||||
# End of transcript or log.
|
# End of transcript or log.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 1"""
|
||||||
|
date="2015-09-09T20:14:01Z"
|
||||||
|
content="""
|
||||||
|
It only fails with --incremental, and the only difference
|
||||||
|
is that the fsck database is opened and written that way.
|
||||||
|
|
||||||
|
Somehow, opening the database causes the encoding of the stderr handle to get
|
||||||
|
reset from the fileEncoding git-annex normally applies at startup to
|
||||||
|
the defaut, which crashes on filenames that don't use the locale's
|
||||||
|
encoding.
|
||||||
|
|
||||||
|
What a strange side effect especially to find in haskell code!
|
||||||
|
It's some kind of bug in persistent that this happens.
|
||||||
|
I've filed a bug: <https://github.com/yesodweb/persistent/issues/474>
|
||||||
|
|
||||||
|
I put in a workaround; I have it reset the encoding of the file handles
|
||||||
|
after opening the db.
|
||||||
|
"""]]
|
Loading…
Add table
Reference in a new issue