[PATCH] posix: _really_ make sure .hg/cache/checklink points at a real file

Mads Kiilerich mads at kiilerich.com
Wed Nov 23 22:09:00 UTC 2016


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1479938505 -3600
#      Wed Nov 23 23:01:45 2016 +0100
# Node ID 2841e0a6f97ba09dff5ffe7f42ac8c6e1b23338f
# Parent  8836f13e3c5b8eae765372708b659c55a044cbb4
posix: _really_ make sure .hg/cache/checklink points at a real file

8836f13e3c5b failed to do what it said; it did leave a dangling symlink. As
promised, that broke setup.py sdist. It also broke stuff on Solaris where "cp
-r" by default follows symlinks.

Instead, make it point at ../00changelog.i, which is the file that is most
likely to exist. This adds some extra layering violation ... but not much, in
an innocent way, and it works ...

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -234,7 +234,8 @@ def checklink(path):
             fd = tempfile.NamedTemporaryFile(dir=checkdir,
                                              prefix='hg-checklink-')
             try:
-                os.symlink(os.path.basename(fd.name), name)
+                # point at some arbitrary file
+                os.symlink('../00changelog.i', name)
                 if cachedir is None:
                     os.unlink(name)
                 else:


More information about the Mercurial-devel mailing list