git-annex/debian
Joey Hess 51e60259e1
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.
2015-11-06 15:08:19 -04:00
..
patches add git-annex-shell link to standalone deb patch 2015-06-10 13:58:30 -04:00
tests Debian: Run the builtin test suite as an autopkgtest. 2013-08-15 15:49:19 +02:00
cabal-wrapper remove workaround for old bug #763078 2015-08-04 13:00:22 -04:00
changelog fix replaceFile makeAnnexLink race 2015-11-06 15:08:19 -04:00
compat debhelper v9 2012-01-15 14:53:38 -04:00
control Debian: Remove dependency on transformers library, as it is now included in ghc. 2015-10-07 12:26:48 -04:00
copyright lintian fix 2015-05-22 16:06:16 -04:00
create-standalone-changelog use BuildVersion in debian, which fixes windows build 2015-04-21 16:42:54 -04:00
doc-base Add doc-base file. Closes: #621408 2011-04-06 21:57:22 -04:00
git-annex.lintian-overrides merge lintian overrides from debian 2015-08-15 11:45:37 -04:00
NEWS prep release 2013-10-02 16:13:45 -04:00
rules Added back debian/cabal-wrapper, since it still seems needed after all. 2015-08-04 12:25:06 -04:00