bug report
authorJoey Hess <joeyh@joeyh.name>
Tue, 14 Jun 2022 18:13:48 +0000 (14:13 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 14 Jun 2022 18:13:48 +0000 (14:13 -0400)
doc/bugs/worktree_overwrite_races.mdwn [new file with mode: 0644]

diff --git a/doc/bugs/worktree_overwrite_races.mdwn b/doc/bugs/worktree_overwrite_races.mdwn
new file mode 100644 (file)
index 0000000..78fdf1a
--- /dev/null
@@ -0,0 +1,17 @@
+Similar to [[add_overwrite_race]], several callers of replaceWorkTreeFile
+are susceptable to a race. They do some check of the current content of the
+file, and then they call that to replace it with something else. But in
+between, the file could be overwritten with other content. And that content
+then gets replaced, which is not expected behavior.
+
+Some other commands may modify the worktree without using it (oops)
+and also be susceptable to a race. `git-annex fix` in fixSymlink, for example,
+checks if the file is a symlink, and then deletes and recreates it.
+
+[[!commit 5ef79125ad0eddd5467b6bec451fdcdbd748b96f]] fixed one of these
+races, but not in an ideal way.
+
+Better would probably be for replaceWorkTreeFile to be provided with a
+InodeCache of the content of the worktree file that is ok to replace.
+Then it can move the file to a temp directory, check that it's still
+unmodified, and replace it. --[[Joey]]