Cache remapping breaks hashing of Package objects

Bug #1780099 reported by Julian Andres Klode on 2018-07-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-apt (Ubuntu)

Bug Description

The apt.Package objects use the id as the hash, but the hash can change after reopening, meaning that code will fail to work, for example:

assert p in set_of_p

will fail.

[Test case]
The above test case is run as part of autopkgtest (syntax is slightly different), so passing autopkgtests means verification is done.

[Regression potential]
Hashing packages objects will be slower as it hashes the name and architecture now.

Changed in python-apt (Ubuntu):
status: New → In Progress
description: updated
tags: added: id-5b3cdc9fd5afad903a1d027f
Changed in python-apt (Ubuntu Bionic):
status: New → In Progress
Changed in python-apt (Ubuntu):
status: In Progress → Fix Committed

Hello Julian, or anyone else affected,

Accepted python-apt into bionic-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at . Thank you in advance!

Changed in python-apt (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
Julian Andres Klode (juliank) wrote :

autopkgtest has run the tests for us, and passed for 1.6.2, so it's verified.

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-apt - 1.6.2

python-apt (1.6.2) unstable; urgency=medium

  * Introduce gitlab ci
  * Document whatsnew in 1.6.y
  * Add more extensive test cases for cache remapping
  * Do not override __hash__ in apt.package.Package (LP: #1780099)
  * debian/ README is since some time
  * debian/control: Point to salsa instead of anonscm

 -- Julian Andres Klode <email address hidden> Mon, 09 Jul 2018 15:37:51 +0200

Changed in python-apt (Ubuntu Bionic):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for python-apt has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Julian Andres Klode (juliank) wrote :

For unknown reasons, this bug was never marked as fix released in cosmic, but it was:

Changed in python-apt (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers