Commit 904330a6 authored by Julian Andres Klode's avatar Julian Andres Klode

apt.Cache: Reinstate locks in a finally / run dpkg inside try

We always need to re-acquire all locks we released before, otherwise
if dpkg fails or an exception is raised somehow, we do not reacquire
the correct lock count and callers will fail when they try to unlock.
parent 5d3d5801
......@@ -586,11 +586,12 @@ class Cache(object):
break
lock_count += 1
res = install_progress.run(pm)
# Reinstate lock count
for i in range(lock_count):
apt_pkg.pkgsystem_lock()
try:
res = install_progress.run(pm)
finally:
# Reinstate lock count
for i in range(lock_count):
apt_pkg.pkgsystem_lock()
try:
install_progress.finishUpdate() # type: ignore
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment