git-annex/Annex
Joey Hess e386e26ef2 avoid trying to create a content file in order to lock it
The nice refactoring in ec7dd0446a
highlighted a bug in lockContent -- when the content is not present,
this incorrectly created an empty lock file, using the same filename
as the content file.

This seems like it could result in empty objects, which fsck would detect
and complain about. Both drop and move --to call lockContent, as does
Remote.Git.dropKey -- I think we got lucky and this bug didn't show up
because both all of those only operate on files that are present. So
this bug could only manifest if there was a race, and a file's content
was dropped at just the wrong time, just as another process was about to
drop it. (And then only if the other process's dropping failed, otherwise
it'd delete the empty object file.)

Hmm, move --from also called lockContent. Unnecessarily, since the content
is not being removed from the local annex. In this case, the combination of
the 2 bugs could result in an empty lock file being written, and then if
the download of the content failed, left in the object directory as the
content.

This commit also optimises lockContent, avoiding an unncessary
doesFileExist test and instead just catching the exception that's thrown
when the file doesn't exist.

This commit was sponsored by Justine Lam.
2014-08-20 17:25:30 -04:00
..
Branch add missing Ord constraint (fixes android build) 2014-07-30 11:57:40 -04:00
Content finish fixing windows timezone madness 2014-06-12 13:54:08 -04:00
Direct fix reversion in relative paths to local remotes of direct mode repos 2013-11-26 19:33:26 -04:00
MetaData toplevel lastchanged field 2014-03-19 19:10:55 -04:00
View fix test to work on Windows 2014-02-25 18:09:45 -04:00
AutoMerge.hs resolvemerge: finish up by committing 2014-07-11 16:59:49 -04:00
Branch.hs Fix minor FD leak in journal code. 2014-07-09 23:36:53 -04:00
BranchState.hs remove git-annex branch read cache 2012-10-19 14:25:15 -04:00
CatFile.hs When accessing a local remote, shut down git-cat-file processes afterwards, to ensure that remotes on removable media can be unmounted. Closes: #758630 2014-08-20 12:07:57 -04:00
CheckAttr.hs finished where indentation changes 2012-12-13 00:24:19 -04:00
CheckIgnore.hs hlint 2013-09-25 03:09:06 -04:00
Content.hs avoid trying to create a content file in order to lock it 2014-08-20 17:25:30 -04:00
Direct.hs direct: Avoid leaving file content in misctemp if interrupted. 2014-08-15 13:38:05 -04:00
Drop.hs unify exception handling into Utility.Exception 2014-08-07 22:03:29 -04:00
Environment.hs unify exception handling into Utility.Exception 2014-08-07 22:03:29 -04:00
FileMatcher.hs reorg matcher types; no non-type code changes 2014-03-29 14:43:34 -04:00
Hook.hs fix handling of nonexistant hook 2014-03-03 13:59:36 -04:00
Index.hs unify exception handling into Utility.Exception 2014-08-07 22:03:29 -04:00
Init.hs reinit: New command that can initialize a new reposotory using the configuration of a previously known repository. Useful if a repository got deleted and you want to clone it back the way it was. 2014-04-15 20:13:35 -04:00
Journal.hs unify exception handling into Utility.Exception 2014-08-07 22:03:29 -04:00
Link.hs Fix bug in automatic merge conflict resolution 2014-07-08 13:55:11 -04:00
LockFile.hs reorganize and refactor lock code 2014-08-20 16:45:58 -04:00
MakeRepo.hs support commit.gpgsign 2014-07-04 11:53:51 -04:00
MetaData.hs really add non-date metadata too 2014-07-03 14:35:20 -04:00
Notification.hs Notification: Add action/status-dependent icon and urgency 2014-04-05 20:45:11 +03:00
Path.hs move programPath out of Config.Files to Annex.Path 2013-11-24 16:03:03 -04:00
Perms.hs unify exception handling into Utility.Exception 2014-08-07 22:03:29 -04:00
Queue.hs type based git config handling for remotes 2013-01-01 13:58:14 -04:00
Quvi.hs Probe for quvi version at run time. 2014-02-28 14:54:02 -04:00
ReplaceFile.hs direct: Avoid leaving file content in misctemp if interrupted. 2014-08-15 13:38:05 -04:00
Ssh.hs reorganize and refactor lock code 2014-08-20 16:45:58 -04:00
TaggedPush.hs remove Read instance for Ref 2014-02-19 01:19:57 -04:00
Transfer.hs Ensure that all lock fds are close-on-exec, fixing various problems with them being inherited by child processes such as git commands. 2014-08-20 11:37:02 -04:00
Url.hs memoize construction of the Request -> Request function to apply the UrlOptions 2014-08-15 17:47:21 -04:00
UUID.hs reinit: New command that can initialize a new reposotory using the configuration of a previously known repository. Useful if a repository got deleted and you want to clone it back the way it was. 2014-04-15 20:13:35 -04:00
VariantFile.hs sync: Fix bug in direct mode that caused a file not checked into git to be deleted when merging with a remote that added a file by the same name. (Thanks, jkt) 2014-03-03 14:57:16 -04:00
Version.hs Auto-upgrade v3 indirect repos to v5 with no changes. This also fixes a problem when a direct mode repo was somehow set to v3 rather than v4, and so the automatic direct mode upgrade to v5 was not done. 2013-12-29 13:06:23 -04:00
View.hs unify exception handling into Utility.Exception 2014-08-07 22:03:29 -04:00
Wanted.hs fix transfers of key with no associated file 2014-01-23 16:44:02 -04:00