From 323e317104b4558046610f491e28510851f0d56d Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Mon, 6 May 2019 22:05:41 +0200 Subject: [PATCH] avoid comparing symlink pointing to themselves (#133) --- dotdrop/dotdrop.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dotdrop/dotdrop.py b/dotdrop/dotdrop.py index c020188..a1b6a7e 100644 --- a/dotdrop/dotdrop.py +++ b/dotdrop/dotdrop.py @@ -191,6 +191,17 @@ def cmd_compare(o, tmp): same = False continue src = tmpsrc + + # is a symlink pointing to itself + asrc = os.path.join(o.dotpath, os.path.expanduser(src)) + adst = os.path.expanduser(dotfile.dst) + if os.path.samefile(asrc, adst): + if o.debug: + line = '=> compare {}: diffing with \"{}\"' + LOG.dbg(line.format(dotfile.key, dotfile.dst)) + LOG.dbg('points to itself') + return True + # install dotfile to temporary dir ret, insttmp = inst.install_to_temp(t, tmp, src, dotfile.dst) if not ret: