From 73ab0e642c3ab3f35886d9d111e6490d66769d07 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 5 Jun 2012 14:53:30 -0400 Subject: [PATCH 1/3] races --- doc/design/assistant/inotify.mdwn | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/doc/design/assistant/inotify.mdwn b/doc/design/assistant/inotify.mdwn index 6692b7d94b..f6febeac82 100644 --- a/doc/design/assistant/inotify.mdwn +++ b/doc/design/assistant/inotify.mdwn @@ -39,3 +39,46 @@ really useful, it needs to: - Support OSes other than Linux; it only uses inotify currently. OSX and FreeBSD use the same mechanism, and there is a Haskell interface for it, + +## the races + +Many races need to be dealt with by this code. Here are some of them. + +* File is added and then removed before the add event starts. + + Not a problem; The add event does nothing since the file is not present. + +* File is added and then removed before the add event has finished + processing it. + + Minor problem; When the add's processing of the file (checksum and so + on) fails due to it going away, there is an ugly error message, but + things are otherwise ok. + +* File is added and then removed before the add event finishes. + + Currently unfixed; The annex add re-adds the file as a symlink and then + the remove event does nothing since the symlink exists. + +* File is added and then replaced with another file before the annex add + makes its symlink. + + Minor problem; The annex add will fail creating its symlink since + the file exists. There is an ugly error message, but the second add + event will add the new file. + +* File is added and then replaced with another file before the annex add + moves its content into the annex. + + Currently unfixed; The new content will be moved to the annex under the + old checksum, and fsck will later catch this inconsistency. + +* File is removed and then re-added before the removal event finishes. + + Not a problem; The removal event removes the old file from the index, and + the add event adds the new one. + +* File is removed and then re-added before the removal event starts. + + Not a problem; The removal event does nothing since the file exists, + and the add event replaces it in git with the new one. From 0eec65c81509210ed50d7980223da574dd9d98f7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 5 Jun 2012 14:53:30 -0400 Subject: [PATCH 2/3] races --- doc/design/assistant/inotify.mdwn | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/doc/design/assistant/inotify.mdwn b/doc/design/assistant/inotify.mdwn index 6692b7d94b..3a836a04c0 100644 --- a/doc/design/assistant/inotify.mdwn +++ b/doc/design/assistant/inotify.mdwn @@ -39,3 +39,48 @@ really useful, it needs to: - Support OSes other than Linux; it only uses inotify currently. OSX and FreeBSD use the same mechanism, and there is a Haskell interface for it, + +## the races + +Many races need to be dealt with by this code. Here are some of them. + +* File is added and then removed before the add event starts. + + Not a problem; The add event does nothing since the file is not present. + +* File is added and then removed before the add event has finished + processing it. + + Minor problem; When the add's processing of the file (checksum and so + on) fails due to it going away, there is an ugly error message, but + things are otherwise ok. + +* File is added and then removed before the add event finishes. + + Currently unfixed; The annex add re-adds the file as a symlink and then + the remove event does nothing since the symlink exists. + +* File is added and then replaced with another file before the annex add + makes its symlink. + + Minor problem; The annex add will fail creating its symlink since + the file exists. There is an ugly error message, but the second add + event will add the new file. + +* File is added and then replaced with another file before the annex add + moves its content into the annex. + + Currently unfixed; The new content will be moved to the annex under the + old checksum, and fsck will later catch this inconsistency. + + Possible fix: Move content someplace before doing checksumming. + +* File is removed and then re-added before the removal event starts. + + Not a problem; The removal event does nothing since the file exists, + and the add event replaces it in git with the new one. + +* File is removed and then re-added before the removal event finishes. + + Not a problem; The removal event removes the old file from the index, and + the add event adds the new one. From 40456953c27a39e68f663e3a0ad08e95bbaf2f1c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 5 Jun 2012 15:20:13 -0400 Subject: [PATCH 3/3] another one --- doc/design/assistant/inotify.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/design/assistant/inotify.mdwn b/doc/design/assistant/inotify.mdwn index 3a836a04c0..3b3e5dc56d 100644 --- a/doc/design/assistant/inotify.mdwn +++ b/doc/design/assistant/inotify.mdwn @@ -75,6 +75,14 @@ Many races need to be dealt with by this code. Here are some of them. Possible fix: Move content someplace before doing checksumming. +* File is added and then replaced with another file before the annex add + stages the symlink in git. + + Currently unfixed; `git add` will be run on the new file, which is + not at all good when it's big. Could be dealt with by using `git + update-index` to manually put the symlink into the index without git + looking at what's currently on disk. + * File is removed and then re-added before the removal event starts. Not a problem; The removal event does nothing since the file exists,