changeset 26359:c545d51c901e

lock.release: do not unlink inherited locks This is part of a series that will allow locks to be inherited by subprocesses in limited circumstances. A subprocess unlinking a lock will lead to potential corruption from other concurrent processes.
author Siddharth Agarwal <sid0@fb.com>
date Thu, 24 Sep 2015 16:03:26 -0700
parents de5a52e5eb9e
children b2415e94b2f5
files mercurial/lock.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/lock.py	Thu Sep 24 16:00:41 2015 -0700
+++ b/mercurial/lock.py	Thu Sep 24 16:03:26 2015 -0700
@@ -204,10 +204,11 @@
                 if self.releasefn:
                     self.releasefn()
             finally:
-                try:
-                    self.vfs.unlink(self.f)
-                except OSError:
-                    pass
+                if not self._parentheld:
+                    try:
+                        self.vfs.unlink(self.f)
+                    except OSError:
+                        pass
             for callback in self.postrelease:
                 callback()