git-annex/Utility
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
..
DirWatcher
Gpg
Applicative.hs
Base64.hs
Batch.hs simpler ifdef for linux 2013-06-21 13:09:09 -04:00
CoProcess.hs got file descriptors mixed up in last commit 2013-06-14 17:59:22 -04:00
CopyFile.hs Android: Fix use of cp command to not try to use features present only on build system. 2013-06-14 11:54:44 -04:00
Daemon.hs fix a minor fd leak 2013-05-27 16:48:41 -04:00
DataUnits.hs refactor and unify code 2013-07-19 19:39:14 -04:00
DBus.hs
Directory.hs better nukefile 2013-05-21 13:03:46 -04:00
DirWatcher.hs
DiskFree.hs
Dot.hs
Env.hs
Exception.hs avoid warnings when built with ghc 7.6 2013-06-02 15:01:58 -04:00
ExternalSHA.hs
FileMode.hs
FileSystemEncoding.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
Format.hs
FreeDesktop.hs linux standalone auto-install icons 2013-07-09 20:50:41 -04:00
FSEvents.hs
Gpg.hs
HumanNumber.hs refactor and unify code 2013-07-19 19:39:14 -04:00
HumanTime.hs
InodeCache.hs
INotify.hs catch does not exist error when adding a watch 2013-07-17 15:32:24 -04:00
JSONStream.hs
Kqueue.hs
libdiskfree.c
libdiskfree.h
libkqueue.c
libkqueue.h
libmounts.c
libmounts.h
LogFile.hs
Lsof.hs
Matcher.hs fix handling of Not in the matcher 2013-05-25 13:50:27 -04:00
Metered.hs
Misc.hs
Monad.hs assistant: In direct mode, objects are now only dropped when all associated files are unwanted. This avoids a repreated drop/get loop of a file that has a copy in an archive directory, and a copy not in an archive directory. (Indirect mode still has some buggy behavior in this area, since it does not keep track of associated files.) Closes: #712060 2013-06-15 14:44:43 -04:00
Mounts.hsc avoid warnings when built with ghc 7.6 2013-06-02 15:01:58 -04:00
Network.hs
NotificationBroadcaster.hs
OSX.hs
Parallel.hs
PartialPrelude.hs
Path.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
Percentage.hs cleanup 2013-07-20 20:56:04 -04:00
Process.hs reorg 2013-07-08 14:51:43 -04:00
QuickCheck.hs
Rsync.hs
SafeCommand.hs
Shell.hs
SRV.hs remove debug prints 2013-05-30 13:36:51 -04:00
Tense.hs
ThreadLock.hs
ThreadScheduler.hs fix warning 2013-05-26 16:02:55 -04:00
TList.hs add two long-running XMPP push threads, no more inversion of control 2013-05-22 15:13:31 -04:00
Tmp.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
Touch.hsc
Url.hs importfeed: git-annex becomes a podcatcher in 150 LOC 2013-07-28 16:55:42 -04:00
UserInfo.hs
Verifiable.hs
WebApp.hs now builds with both yesod 1.2 and 1.1 2013-06-03 18:14:22 -04:00
Yesod.hs fix a build failure on android 2013-06-27 15:25:28 -04:00