[PATCH stable] largefiles: handle that a found standin file doesn't exist when removing it

Mads Kiilerich mads at kiilerich.com
Thu Oct 27 18:06:34 UTC 2016


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1477591593 -7200
#      Thu Oct 27 20:06:33 2016 +0200
# Branch stable
# Node ID 23f53561a8b6dcfbb35020df4d113fe34fec4c0e
# Parent  69ffbbe73dd03df0d1a00bdb2bc083fdb73ede09
largefiles: handle that a found standin file doesn't exist when removing it

I somehow ended up in a situation where hg crashed on an unlink I introduced in
328545c7d8a1.

I don't know how it happened and can't reproduce it. It seems like it only can
happen when the file is removed between the time of check in a working
directory context walk that finds a standin file, and the time of use when we
try to remove it because the corresponding largefile doesn't exist.

But better safe than sorry: replace the plain unlink with unlinkpath with
ignoremissing=True. That will also remove remaining empty directories, which
arguably is more correct.

diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -217,7 +217,7 @@ def reposetup(ui, repo):
                             # standin. Removing a file as a side effect of
                             # running status is gross, but the alternatives (if
                             # any) are worse.
-                            self.wvfs.unlink(standin)
+                            self.wvfs.unlinkpath(standin, ignoremissing=True)
 
                     # Filter result lists
                     result = list(result)


More information about the Mercurial-devel mailing list