Fix storing of filenames of v6 unlocked files when the filename is not representable in the current locale.

This is a mostly backwards compatable change. I broke backwards
compatability in the case where a filename starts with double-quote.
That seems likely to be very rare, and v6 unlocked files are a new feature
anyway, and fsck needs to fix missing associated file mappings anyway. So,
I decided that is good enough.

The encoding used is to just show the String when it contains a problem
character. While that adds some overhead to addAssociatedFile and
removeAssociatedFile, those are not called very often. This approach has
minimal decode overhead, because most filenames won't be encoded that way,
and it only has to look for the leading double-quote to skip the expensive
read. So, getAssociatedFiles remains fast.

I did consider using ByteString instead, but getting a FilePath converted
with all chars intact, even surrigates, is difficult, and it looks like
instance PersistField ByteString uses Text, which I don't trust for problem
encoded data. It would probably be slower too, and it would make the
database less easy to inspect manually.
This commit is contained in:
Joey Hess 2016-02-14 16:37:25 -04:00
parent 613d6056f5
commit cf260d9a15
Failed to extract signature
5 changed files with 85 additions and 9 deletions

2
debian/changelog vendored
View file

@ -6,6 +6,8 @@ git-annex (6.20160212) UNRELEASED; urgency=medium
* Work around problem with concurrent-output when in a non-unicode locale
by avoiding use of it in such a locale. Instead -J will behave as if
it was built without concurrent-output support in this situation.
* Fix storing of filenames of v6 unlocked files when the filename is not
representable in the current locale.
-- Joey Hess <id@joeyh.name> Fri, 12 Feb 2016 14:03:46 -0400