git-annex/Annex
Joey Hess ddd46db09a Fix a few bugs involving filenames that are at or near the filesystem's maximum filename length limit.
Started with a problem when running addurl on a really long url,
because the whole url is munged into the filename. Ended up doing
a fairly extensive review for places where filenames could get too large,
although it's hard to say I'm not missed any..

Backend.Url had a 128 character limit, which is fine when the limit is 255,
but not if it's a lot shorter on some systems. So check the pathconf()
limit. Note that this could result in fromUrl creating different keys
for the same url, if run on systems with different limits. I don't see
this is likely to cause any problems. That can already happen when using
addurl --fast, or if the content of an url changes.

Both Command.AddUrl and Backend.Url assumed that urls don't contain a
lot of multi-byte unicode, and would fail to truncate an url that did
properly.

A few places use a filename as the template to make a temp file.
While that's nice in that the temp file name can be easily related back to
the original filename, it could lead to `git annex add` failing to add a
filename that was at or close to the maximum length.

Note that in Command.Add.lockdown, the template is still derived from the
filename, just with enough space left to turn it into a temp file.
This is an important optimisation, because the assistant may lock down
a bunch of files all at once, and using the same template for all of them
would cause openTempFile to iterate through the same set of names,
looking for an unused temp file. I'm not very happy with the relatedTemplate
hack, but it avoids that slowdown.

Backend.WORM does not limit the filename stored in the key.
I have not tried to change that; so git annex add will fail on really long
filenames when using the WORM backend. It seems better to preserve the
invariant that a WORM key always contains the complete filename, since
the filename is the only unique material in the key, other than mtime and
size. Since nobody has complained about add failing (I think I saw it
once?) on WORM, probably it's ok, or nobody but me uses it.

There may be compatability problems if using git annex addurl --fast
or the WORM backend on a system with the 255 limit and then trying to use
that repo in a system with a smaller limit. I have not tried to deal with
those.

This commit was sponsored by Alexander Brem. Thanks!
2013-07-30 19:18:29 -04:00
..
Content avoid failure creating inode sentinal file 2013-06-18 15:38:17 -04:00
Branch.hs importfeed: git-annex becomes a podcatcher in 150 LOC 2013-07-28 16:55:42 -04:00
BranchState.hs remove git-annex branch read cache 2012-10-19 14:25:15 -04:00
CatFile.hs assistant: Work around git-cat-file's not reloading the index after files are staged. 2013-05-25 00:37:41 -04:00
CheckAttr.hs finished where indentation changes 2012-12-13 00:24:19 -04:00
Content.hs fix uninit to delete content from annex when it ended up hard linked back to the work tree 2013-07-18 13:30:12 -04:00
Direct.hs importfeed: git-annex becomes a podcatcher in 150 LOC 2013-07-28 16:55:42 -04:00
Environment.hs detect system with no dot in FQDN, where git commit will fail, and workaround 2013-07-05 12:24:28 -04:00
Exception.hs avoid warnings when built with ghc 7.6 2013-06-02 15:01:58 -04:00
FileMatcher.hs refactor 2013-05-24 23:07:26 -04:00
Journal.hs improve robustness of fromDirect and replaceFile 2013-05-25 15:06:02 -04:00
Link.hs Fix inverted logic in last release's fix for data loss bug, that caused git-annex sync on FAT or other crippled filesystems to add symlink standin files to the annex. 2013-07-30 16:08:09 -04:00
LockPool.hs fix permission damage (thanks, Windows) 2013-05-11 23:54:25 -04:00
Perms.hs fix permission damage (thanks, Windows) 2013-05-11 23:54:25 -04:00
Queue.hs type based git config handling for remotes 2013-01-01 13:58:14 -04:00
ReplaceFile.hs Fix a few bugs involving filenames that are at or near the filesystem's maximum filename length limit. 2013-07-30 19:18:29 -04:00
Ssh.hs For long hostnames, use a hash of the hostname to generate the socket file for ssh connection caching. 2013-07-22 15:09:41 -04:00
TaggedPush.hs expose Control.Monad.join 2013-04-22 20:24:53 -04:00
UUID.hs Now uses the Haskell uuid library, rather than needing a uuid program. 2013-02-10 14:52:54 -04:00
Version.hs git-annex now builds on Windows (doesn't work) 2013-05-11 15:03:00 -05:00
Wanted.hs moved AssociatedFile definition 2013-07-04 02:36:02 -04:00