← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1773316] Re: Object of different cache passed as argument to apt_pkg.DepCache method

 

** Description changed:

- ========== xenial / trusty ==========
- [Impact]
- Some applications, like unattended-upgrades or update-manager, reopen the apt cache. They also keep around old apt.Package objects however, and operate on them after reopening. Under the hood, this means that apt_pkg.Package objects belonging to an old cache are passed to a new cache.
- 
- APT relies on the ID of the package (it's position in the cache) for
- it's operation. So if a package has ID 0 in the old cache, and a
- different package has ID 0 in the new cache, performing operations on
- the old package would perform it on the new package. If the old
- package's ID is out of bounds in the new cache, the behavior is
- undefined - it's an out of bounds array access.
- 
- [Test case]
- The attached test case has a list of packages 0-9, a-z; stores the package "z" into a variable, then reopens the cache. It then marks z for deletion. This either segfaults or does nothing; when it should mark z for deletion.
- 
- More test cases like this are in the autopkgtest.
- 
- [Regression potential]
- The initial fix introduced bug 1780099, there might be similar bugs lurking. However, these bugs would have been undefined behavior before and might have caused segmentation faults or did the wrong thing. It seems likely that any regression cannot possibly be worse than the current state.
- 
- ========== bionic+ ===================
- 
  [Impact]
  python-apt 1.6 raises an exception when objects of an old cache are passed to a apt_pkg.DepCache methods for a different cache. Prior to that, those would either segfault, succeed, or silently operate on a different object, as they use package/version ids, and e.g. two different packages in the old and new cache might have the same id.
  
  With 1.6.1, we introduce a remapping algorithm that remaps objects of
  apt.Cache() when calling apt.Cache.open(), allowing old objects to be
  used after reopening, as long as they exist in the new cache. If they
  don't exist in the new cache, apt_pkg.CacheMismatchError will be raised
  from the apt_pkg layer.
  
  [Test case]
  import apt
  c=apt.Cache()
  p=c["apt"]
  c.open()
  p.mark_install()
  
  [Regression potential]
  Could be remapping to wrong items which would cause us to install a wrong version, for example. Compared to pre-bionic, bionic is a regression already, though, and any regression caused here is less important than
  what we have now.
  
  [Original bug report]
  The Ubuntu Error Tracker has been receiving reports about a problem regarding update-manager.  This problem was most recently seen with package version 1:18.04.11, the problem page at https://errors.ubuntu.com/problem/e6ff7b5c385c512b7933497ad895c8a19ed063b2 contains more details, including versions of packages affected, stacktrace or traceback, and individual crash reports.
  If you do not have access to the Ubuntu Error Tracker and are a software developer, you can request it at http://forms.canonical.com/reports/.

** No longer affects: python-apt (Ubuntu Xenial)

** No longer affects: python-apt (Ubuntu Trusty)

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1773316

Title:
  Object of different cache passed as argument to apt_pkg.DepCache
  method

Status in python-apt package in Ubuntu:
  Fix Released
Status in update-manager package in Ubuntu:
  Won't Fix
Status in update-manager source package in Trusty:
  Confirmed
Status in update-manager source package in Xenial:
  Confirmed
Status in python-apt source package in Bionic:
  Fix Released
Status in update-manager source package in Bionic:
  Won't Fix
Status in python-apt source package in Cosmic:
  Fix Released
Status in update-manager source package in Cosmic:
  Won't Fix

Bug description:
  [Impact]
  python-apt 1.6 raises an exception when objects of an old cache are passed to a apt_pkg.DepCache methods for a different cache. Prior to that, those would either segfault, succeed, or silently operate on a different object, as they use package/version ids, and e.g. two different packages in the old and new cache might have the same id.

  With 1.6.1, we introduce a remapping algorithm that remaps objects of
  apt.Cache() when calling apt.Cache.open(), allowing old objects to be
  used after reopening, as long as they exist in the new cache. If they
  don't exist in the new cache, apt_pkg.CacheMismatchError will be
  raised from the apt_pkg layer.

  [Test case]
  import apt
  c=apt.Cache()
  p=c["apt"]
  c.open()
  p.mark_install()

  [Regression potential]
  Could be remapping to wrong items which would cause us to install a wrong version, for example. Compared to pre-bionic, bionic is a regression already, though, and any regression caused here is less important than
  what we have now.

  [Original bug report]
  The Ubuntu Error Tracker has been receiving reports about a problem regarding update-manager.  This problem was most recently seen with package version 1:18.04.11, the problem page at https://errors.ubuntu.com/problem/e6ff7b5c385c512b7933497ad895c8a19ed063b2 contains more details, including versions of packages affected, stacktrace or traceback, and individual crash reports.
  If you do not have access to the Ubuntu Error Tracker and are a software developer, you can request it at http://forms.canonical.com/reports/.

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