summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-20 12:57:00 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-20 12:57:00 -0400
commitdfccee26168d1ecca34dc504812f24a23b7633ed (patch)
tree5b26b52c1ad70a8d2d66cdc5716e90f2a30073f0
parentee2acd474fbefb3851d168dec474c83475cc917c (diff)
unused: Fix crash when file names contain invalid utf8.
Was decoding the git-cat-file of the symlink target as utf8, but that can't do, unix filenames are from the 70's and need this shiny disco fileSystemEncoding.
-rw-r--r--Command/Unused.hs8
-rw-r--r--debian/changelog1
2 files changed, 5 insertions, 4 deletions
diff --git a/Command/Unused.hs b/Command/Unused.hs
index 03a709534..b115eee83 100644
--- a/Command/Unused.hs
+++ b/Command/Unused.hs
@@ -10,8 +10,7 @@
module Command.Unused where
import qualified Data.Set as S
-import qualified Data.Text.Lazy as L
-import qualified Data.Text.Lazy.Encoding as L
+import qualified Data.ByteString.Lazy as L
import Data.BloomFilter
import Data.BloomFilter.Easy
import Data.BloomFilter.Hash
@@ -265,8 +264,9 @@ withKeysReferencedInGitRef a ref = do
go [] = noop
go (l:ls)
| isSymLink (LsTree.mode l) = do
- content <- L.decodeUtf8 <$> catFile ref (LsTree.file l)
- case fileKey (takeFileName $ L.unpack content) of
+ content <- encodeW8 . L.unpack
+ <$> catFile ref (LsTree.file l)
+ case fileKey (takeFileName content) of
Nothing -> go ls
Just k -> do
a k
diff --git a/debian/changelog b/debian/changelog
index 9a47447ce..bc9932d52 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ git-annex (3.20120616) UNRELEASED; urgency=low
files and automatically annexes new files, etc, so you don't need
to manually run git commands when manipulating files.
* Enable diskfree on kfreebsd, using statvfs.
+ * unused: Fix crash when key names contain invalid utf8.
-- Joey Hess <joeyh@debian.org> Tue, 12 Jun 2012 11:35:59 -0400