diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-11-06 15:08:19 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-11-06 15:08:19 -0400 |
commit | b29a7d5b2472bc8066e84b86d6f66f79a35b2099 (patch) | |
tree | 1548f38e7f84ebd3d17e4e1931eee301f168155f /debian | |
parent | c8aab6d37c790505580f297bba05fb4591ebae45 (diff) |
fix replaceFile makeAnnexLink race
replaceFile created a temp file, which was guaranteed to not overlap with
another temp file. However, makeAnnexLink then deleted that file, in
preparation for making the symlink in its place. This caused a race, since
some other replaceFile could create a temp file, using the same name!
I was able to reproduce the race easily running git-annex add -J10 in a
directory with 100 files (all with different contents). Some files would
get ingested into the annex, but their annex links would fail to be added.
There could be other situations where this same problem could occur.
Perhaps when the assistant is adding a file, if the user manually also ran
git-annex add. Perhaps in cases not involving adding a file.
The new replaceFile makes a temprary directory, which is guaranteed to be
unique, and doesn't make a temp file in there. makeAnnexLink can thus
create the symlink without problem and the race is avoided.
Audited all calls to replaceFile to make sure that the old behavior of
providing an empty temp file was not relied on.
The general problem of asking for a temp file and deleting it as part of
the process of using it could reach beyond replaceFile. Did some quick
audits and didn't find other cases of it. Probably only symlink creation
stuff would tend to make that mistake, mostly.
Diffstat (limited to 'debian')
-rw-r--r-- | debian/changelog | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 2a05e8b0b..4f10ff57d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ git-annex (5.20151102.2) UNRELEASED; urgency=medium are imported to is not a directort, but perhaps an annexed file. * Concurrent progress bars are now displayed when using -J with a command that moves file contents around. + * Fix race that could result in an annexed file's symlink not being + created, when eg, running concurrent git-annex adds. -- Joey Hess <id@joeyh.name> Wed, 04 Nov 2015 12:50:20 -0400 |