Who knows, maybe this folder doesn't exist in some context

This commit is contained in:
Alexandre Aubin 2019-02-22 15:16:07 +01:00
parent 2fec4a6c64
commit 6fc6d6cfe6

View file

@ -477,5 +477,7 @@ def dpkg_is_broken():
# If dpkg is broken, /var/lib/dpkg/updates # If dpkg is broken, /var/lib/dpkg/updates
# will contains files like 0001, 0002, ... # will contains files like 0001, 0002, ...
# ref: https://sources.debian.org/src/apt/1.4.9/apt-pkg/deb/debsystem.cc/#L141-L174 # ref: https://sources.debian.org/src/apt/1.4.9/apt-pkg/deb/debsystem.cc/#L141-L174
if not os.path.isdir("/var/lib/dpkg/updates/"):
return False
return any(re.match("^[0-9]+$", f) return any(re.match("^[0-9]+$", f)
for f in os.listdir("/var/lib/dpkg/updates/")) for f in os.listdir("/var/lib/dpkg/updates/"))