** Description changed:

  [Impact]
  Add support to python-apt for frontend locking. This is a bit more 
complicated, and also requires some other restructuring:
  
  (1) The archives lock was only taken for a short time, when it should
  have been kept for the duration of an installation, as otherwise debs
  could disappear from archives/ while the install is running.
  
  (2) There was no lock handling at all. Tools essentially acquire the
  lock, and then release it before commit().
  
  The fix is based on the apt fix, which makes apt_pkg.SystemLock() manage
  both the frontend and the normal lock, and allows code to call
  apt_pkg.pkgsystem_unlock_inner() and apt_pkg.pkgsystem_lock_inner()
  around dpkg invocations to release the inner lock.
  
  Cache.commit() takes care of locking itself now. It releases the inner
  lock as needed for dpkg invocations. It also now requires
  apt_pkg.SystemLock to be hold - if it is not, it will acquire it itself.
  
  [Test case]
  1. Mark a package in the cache for install/removal and commit() - FE lock 
should be taken while dpkg is running.
  2. Mark a package in the cache for install/removal and commit() while holding 
the lock. Releasing the lock afterwards should still work correctly, and the FE 
lock should never be released
  3. Observe that the archive lock is not released until the last dpkg run
  
  The locking behavior can be observed via strace.
  
  [Regression potential]
  The dpkg lock changed the most: Some lock counting might go wrong and 
programs might fail as a result. Any problems will be isolated, though - dpkg 
still acquires its locks, and if a lock miscount happens, apt would not tell 
dpkg to skip acquiring the frontend lock, so even if we were losing the lock 
anywhere, dpkg would still try to acquire it and not run unlocked.
  
  The archive lock done by commit()/fetch_archives() in apt.Cache() is now
  hold as long as the fetcher object exists though (as it uses the
  fetcher's get_lock method), which might cause unexpected behavior in
  apps not expecting that.
  
  The lists/ lock is unaffected by the changes, so there should not be any
  regressions when it comes to updating index files.
  
- [Other info]
+ [Other info (1)]
  CI changes: There were some improvements to type hints for mypy needed to 
make type checks pass, and changes to the CI's Dockerfile to pull a new apt 
from the apt stable PPA (as a new enough apt is only in unapproved atm). 
Neither of those files are used anywhere outside of the package, so they should 
not cause any problems.
  
- [Other info]
+ [Other info (2)]
  This is part of a wider series of SRUs for frontend locking
  
  - dpkg (bug 1796081)
  - apt (bug 1781169)
  - python-apt (bug 1795407)
  - packagekit (bug 1795614)
  - unattended-upgrades (bug 1789637)
  - aptdaemon (no bug filed yet)
  
  Further details about frontend locking can be found in
  https://lists.debian.org/debian-dpkg/2017/01/msg00044.html
+ 
+ - This SRU depends on the apt SRU above, and breaks unattended-upgrades
+ in bionic without its SRU due to a bug in the u-u code in handling the
+ new API.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to python-apt in Ubuntu.
https://bugs.launchpad.net/bugs/1795407

Title:
  python-apt frontend locking

Status in python-apt package in Ubuntu:
  Fix Released
Status in python-apt source package in Xenial:
  Fix Committed
Status in python-apt source package in Bionic:
  Fix Committed

Bug description:
  [Impact]
  Add support to python-apt for frontend locking. This is a bit more 
complicated, and also requires some other restructuring:

  (1) The archives lock was only taken for a short time, when it should
  have been kept for the duration of an installation, as otherwise debs
  could disappear from archives/ while the install is running.

  (2) There was no lock handling at all. Tools essentially acquire the
  lock, and then release it before commit().

  The fix is based on the apt fix, which makes apt_pkg.SystemLock()
  manage both the frontend and the normal lock, and allows code to call
  apt_pkg.pkgsystem_unlock_inner() and apt_pkg.pkgsystem_lock_inner()
  around dpkg invocations to release the inner lock.

  Cache.commit() takes care of locking itself now. It releases the inner
  lock as needed for dpkg invocations. It also now requires
  apt_pkg.SystemLock to be hold - if it is not, it will acquire it
  itself.

  [Test case]
  1. Mark a package in the cache for install/removal and commit() - FE lock 
should be taken while dpkg is running.
  2. Mark a package in the cache for install/removal and commit() while holding 
the lock. Releasing the lock afterwards should still work correctly, and the FE 
lock should never be released
  3. Observe that the archive lock is not released until the last dpkg run

  The locking behavior can be observed via strace.

  [Regression potential]
  The dpkg lock changed the most: Some lock counting might go wrong and 
programs might fail as a result. Any problems will be isolated, though - dpkg 
still acquires its locks, and if a lock miscount happens, apt would not tell 
dpkg to skip acquiring the frontend lock, so even if we were losing the lock 
anywhere, dpkg would still try to acquire it and not run unlocked.

  The archive lock done by commit()/fetch_archives() in apt.Cache() is
  now hold as long as the fetcher object exists though (as it uses the
  fetcher's get_lock method), which might cause unexpected behavior in
  apps not expecting that.

  The lists/ lock is unaffected by the changes, so there should not be
  any regressions when it comes to updating index files.

  [Other info (1)]
  CI changes: There were some improvements to type hints for mypy needed to 
make type checks pass, and changes to the CI's Dockerfile to pull a new apt 
from the apt stable PPA (as a new enough apt is only in unapproved atm). 
Neither of those files are used anywhere outside of the package, so they should 
not cause any problems.

  [Other info (2)]
  This is part of a wider series of SRUs for frontend locking

  - dpkg (bug 1796081)
  - apt (bug 1781169)
  - python-apt (bug 1795407)
  - packagekit (bug 1795614)
  - unattended-upgrades (bug 1789637)
  - aptdaemon (no bug filed yet)

  Further details about frontend locking can be found in
  https://lists.debian.org/debian-dpkg/2017/01/msg00044.html

  - This SRU depends on the apt SRU above, and breaks unattended-
  upgrades in bionic without its SRU due to a bug in the u-u code in
  handling the new API.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/1795407/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to