diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-01-08 12:45:32 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-01-08 12:45:32 -0400 |
commit | 6b4fc5e985ed96e14ebc89e67b373dd66c857bc5 (patch) | |
tree | ae3df8f2b4f5bee6bc41b0b339e1277601044815 | |
parent | dc70490577892424bffe1f87b73a54adff6fb988 (diff) |
view: Avoid using cute unicode homomorphs for '/' and '\' and instead use ugly escaping, as the unicode method doesn't work on non-unicode supporting systems.
-rw-r--r-- | Annex/View.hs | 28 | ||||
-rw-r--r-- | Test.hs | 1 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | doc/bugs/slash_in_metadata_breaks_field__61____42___view.mdwn | 2 | ||||
-rw-r--r-- | doc/bugs/slash_in_metadata_breaks_field__61____42___view/comment_1_249d786ce15ab0c91191987c0bab76ef._comment | 24 |
5 files changed, 39 insertions, 20 deletions
diff --git a/Annex/View.hs b/Annex/View.hs index f724889af..92a7ffc48 100644 --- a/Annex/View.hs +++ b/Annex/View.hs @@ -226,32 +226,22 @@ toViewPath :: MetaValue -> FilePath toViewPath = concatMap escapeslash . fromMetaValue where escapeslash c - | c == '/' = [pseudoSlash] - | c == '\\' = [pseudoBackslash] - | c == pseudoSlash = [pseudoSlash, pseudoSlash] - | c == pseudoBackslash = [pseudoBackslash, pseudoBackslash] + | c == '/' = "%_" + | c == '\\' = "%." + | c == '%' = "%%" | otherwise = [c] fromViewPath :: FilePath -> MetaValue fromViewPath = toMetaValue . deescapeslash [] where deescapeslash s [] = reverse s - deescapeslash s (c:cs) - | c == pseudoSlash = case cs of - (c':cs') - | c' == pseudoSlash -> deescapeslash (pseudoSlash:s) cs' - _ -> deescapeslash ('/':s) cs - | c == pseudoBackslash = case cs of - (c':cs') - | c' == pseudoBackslash -> deescapeslash (pseudoBackslash:s) cs' - _ -> deescapeslash ('/':s) cs - | otherwise = deescapeslash (c:s) cs + deescapeslash s ('%':'_':cs) = deescapeslash ('/':s) cs + deescapeslash s ('%':'.':cs) = deescapeslash ('\\':s) cs + deescapeslash s ('%':'%':cs) = deescapeslash ('%':s) cs + deescapeslash s (c:cs) = deescapeslash (c:s) cs -pseudoSlash :: Char -pseudoSlash = '\8725' -- '∕' /= '/' - -pseudoBackslash :: Char -pseudoBackslash = '\9586' -- '╲' /= '\' +prop_viewPath_roundtrips :: MetaValue -> Bool +prop_viewPath_roundtrips v = fromViewPath (toViewPath v) == v pathProduct :: [[FilePath]] -> [FilePath] pathProduct [] = [] @@ -173,6 +173,7 @@ properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck" , testProperty "prop_metadata_sane" Types.MetaData.prop_metadata_sane , testProperty "prop_metadata_serialize" Types.MetaData.prop_metadata_serialize , testProperty "prop_branchView_legal" Logs.View.prop_branchView_legal + , testProperty "prop_viewPath_roundtrips" Annex.View.prop_viewPath_roundtrips , testProperty "prop_view_roundtrips" Annex.View.prop_view_roundtrips , testProperty "prop_viewedFile_rountrips" Annex.View.ViewedFile.prop_viewedFile_roundtrips , testProperty "prop_b64_roundtrips" Utility.Base64.prop_b64_roundtrips diff --git a/debian/changelog b/debian/changelog index 6ad211996..8c7258ccb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,7 @@ git-annex (6.20151219) UNRELEASED; urgency=medium * fix: Adjusts unlocked files as configured by annex.thin. * persistent-sqlite is now a hard build dependency, since v6 repository mode needs it. + * status: On crippled filesystems, was displaying M for all annexed files that were present. Probably caused by a change to what git status displays in this situation. Fixed by treating files git thinks are @@ -47,6 +48,9 @@ git-annex (6.20151219) UNRELEASED; urgency=medium * rekey: No longer copies over urls from the old to the new key. It makes sense for migrate to do that, but not for this low-level (and little used) plumbing command to. + * view: Avoid using cute unicode homomorphs for '/' and '\' and instead + use ugly escaping, as the unicode method doesn't work on non-unicode + supporting systems. -- Joey Hess <id@joeyh.name> Sat, 19 Dec 2015 13:31:17 -0400 diff --git a/doc/bugs/slash_in_metadata_breaks_field__61____42___view.mdwn b/doc/bugs/slash_in_metadata_breaks_field__61____42___view.mdwn index f43b61623..e52e2e5f7 100644 --- a/doc/bugs/slash_in_metadata_breaks_field__61____42___view.mdwn +++ b/doc/bugs/slash_in_metadata_breaks_field__61____42___view.mdwn @@ -39,4 +39,4 @@ I was trying out the metadata extraction via libextractor and for the mimetype t Apart from this git-annex is working very well for me. I mostly use it as an archive, distributing numerous copies on various hard drives and cloud providers and keeping track of what is where.Its an amazing tool for that. - +> [[done]] --[[Joey]] diff --git a/doc/bugs/slash_in_metadata_breaks_field__61____42___view/comment_1_249d786ce15ab0c91191987c0bab76ef._comment b/doc/bugs/slash_in_metadata_breaks_field__61____42___view/comment_1_249d786ce15ab0c91191987c0bab76ef._comment new file mode 100644 index 000000000..2cd288951 --- /dev/null +++ b/doc/bugs/slash_in_metadata_breaks_field__61____42___view/comment_1_249d786ce15ab0c91191987c0bab76ef._comment @@ -0,0 +1,24 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2016-01-08T15:52:22Z" + content=""" +I was able to reproduce this problem, but only with LANG=C. It works in a +unicode locale. + +What's torpedoing this is a hack that it uses to handle "/" in a view. + + pseudoSlash :: Char + pseudoSlash = '\8725' -- '∕' /= '/' + +It's necessary that in a view, each viewed metadata component yield exactly one +level of directory hierarchy. Otherwise, it would be impossible to reverse +"a/b/c/file" when viewing on 2 metadata components -- +is that "a/b" and "c" or "a" and "b/c"? + +Which is why I used this cutsey hack, but yeah, it requires working +unicode support. + +Sigh, 2016 and still can't have nice things.. Suppose it'll have to use an +ugly encoding for them instead. +"""]] |