Skip to content

Commit d10b7de

Browse files
committed
eclean: again handle empty invalid binpkgs correctly
_get_size_valid_symlink returns 0 in two cases: 1) when the file is actually of size 0, or 2) a broken symlink was passed. Hack around case 1) appearing identical to callers by returning 1 there instead. Bug: https://bugs.gentoo.org/973294 Signed-off-by: Sam James <sam@gentoo.org>
1 parent 979422f commit d10b7de

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pym/gentoolkit/eclean/clean.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ def _get_size_valid_symlink(self, file_):
132132
try:
133133
statinfo = os.stat(file_)
134134
if statinfo.st_nlink == 1:
135-
return statinfo.st_size
135+
# Hack to disambiguate a file of empty size from the other
136+
# case where this function returns 0 at the end for a dead
137+
# symlink.
138+
return statinfo.st_size or 1
136139
except OSError as er:
137140
if os.path.exists(os.readlink(file_)):
138141
print(pp.error("Could not get stat info for:" + file_), file=sys.stderr)

0 commit comments

Comments
 (0)