From e7c920d7836534378805d547f8bdb3abf353d32e Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Fri, 19 Oct 2018 22:56:53 +0300 Subject: [PATCH] system: add workaround for buggy os.lstat().st_ino Fixes #1241 Signed-off-by: Ruslan Kuprieiev --- dvc/system.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dvc/system.py b/dvc/system.py index 4591e8d13..1d5fe3118 100644 --- a/dvc/system.py +++ b/dvc/system.py @@ -178,7 +178,12 @@ class System(object): @staticmethod def inode(path): if System.is_unix(): + import ctypes inode = os.lstat(path).st_ino + # NOTE: See https://bugs.python.org/issue29619 and + # https://stackoverflow.com/questions/34643289/ + # pythons-os-stat-is-returning-wrong-inode-value + inode = ctypes.c_ulong(inode).value else: # getdirinfo from ntfsutils works on both files and dirs info = System.getdirinfo(path)