python-aptdaemon: upgrading marks auto-installed packages as manual

Bug #1078544 reported by Daniel Hartwig
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Aptdaemon
Fix Committed
Undecided
Unassigned
aptdaemon (Debian)
Fix Released
Unknown
aptdaemon (Ubuntu)
Fix Released
High
Unassigned
Precise
Fix Released
Medium
Unassigned
Quantal
Fix Released
Medium
Unassigned
Raring
Fix Released
High
Unassigned

Bug Description

[Originally reported on bugs.d.o]

Package: python-aptdaemon
Version: 0.45-1

An obvious error in worker.py(_mark_packages_for_upgrade), introduced in revision 336[1]:

- auto = not self._cache._depcache.IsAutoInstalled(pkg._pkg)
- pkg.markInstall(False, True, auto)
+ pkg.mark_install(False, True, pkg.is_auto_installed)

causes previously auto-installed packages to be marked manually installed when upgraded with upgrade_packages or commit_packages. The error is then propagated to _mark_packages_for_downgrade, introduced in revision 449.1.3[2].

Python-apt has package.py(mark_upgrade) which uses “not pkg.is_auto_installed” as from_user, the final argument to mark_install. This suggests the original code is intended. However, it is noted that from_user is also influential in pkgDepCache::IsModeChangeOk (and others) to determine whether, e.g., a hold should be ignored. It is therefore appropriate to either expose from_user to the calling code, or determine whether an application requesting specific packages to be upgraded should expect that this will override any holds.

Either way, at least one of the attached patches applies.

[1] http://bazaar.launchpad.net/~aptdaemon-developers/aptdaemon/main/revision/336
[2] http://bazaar.launchpad.net/~aptdaemon-developers/aptdaemon/main/revision/449.1.3

[Impact]

Applications that use python-aptdaemon, such as software-center and update-manager, will trigger this bug when upgrading packages, causing those packages to lose their auto-installed status. Over time, less and less packages will be considered for autoremoval and the system will become cluttered with unused old libraries and other dependencies.

[Test Case, using update-manager]

* Identify an upgradeable, auto-installed package:

$ aptitude search -F '%p' '~U~M'

udev
$ PKG=udev
$ grep-dctrl -P -X $PKG /var/lib/apt/extended_states
Package: udev
Architecture: i386
Auto-Installed: 1

$ apt-cache policy $PKG
udev:
  Installed: 175-3.1
  Candidate: 175-7
  Version table:
     175-7 0
        500 http://ftp.iinet.net.au/debian/debian/ sid/main i386 Packages
 *** 175-3.1 0
        100 /var/lib/dpkg/status

* Run update-manager (which uses python-aptdaemon by default):

$ sudo update-manager

* Unmark all changes, then mark only the package that was identified. This issue may not be relevent when performing a complete upgrade.

* Apply changes. Quit update-manager.

* Confirm that the package is no longer auto-installed.

$ grep-dctrl -P -X $PKG /var/lib/apt/extended_states
Package: udev
Architecture: i386
Auto-Installed: 0

[Regression Potential]

The code in python-aptdaemon is *obviously* wrong. Patch is small.

Related branches

Revision history for this message
Daniel Hartwig (wigs) wrote :
tags: added: patch
Revision history for this message
Brian Murray (brian-murray) wrote :

I tried this with 3 upgradeable packages (epiphany-browser, epiphany-browser-data, and gdebi-core) on Quantal. Of the 3 only epiphany-browser and epiphany-browser-data had 'Auto-Installed' changed from 1 to 0.

This was using aptdaemon version 0.45+bzr861-0ubuntu9.1.

Changed in aptdaemon (Ubuntu):
status: New → Triaged
importance: Undecided → High
Changed in aptdaemon (Ubuntu Precise):
status: New → Incomplete
status: Incomplete → Opinion
status: Opinion → Triaged
Changed in aptdaemon (Ubuntu Quantal):
status: New → Triaged
Changed in aptdaemon (Ubuntu Precise):
importance: Undecided → Medium
Changed in aptdaemon (Ubuntu Quantal):
importance: Undecided → Medium
tags: added: rls-r-notfixing
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "upgrade-auto.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

Changed in aptdaemon (Debian):
status: Unknown → New
Revision history for this message
Sebastian Heinlein (glatzor) wrote :

Thanks a lot for spotting this error. There seem to be another issue with downgrades. If the package is marked as auto installed it cannot be downgraded. You can reproduce this by appliying the extended states setup in the test_upgrade to test_downgrade.

Revision history for this message
Sebastian Heinlein (glatzor) wrote :

The user should be allowed to override any holds, so I have chosen your second patch.

Changed in aptdaemon:
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package aptdaemon - 0.45+bzr883-0ubuntu1

---------------
aptdaemon (0.45+bzr883-0ubuntu1) raring; urgency=low

  * New upstream snapshot:
    - Don't change the automatic installed state when upgrading package
      (Thanks a lot to Daniel Hartwig, LP: #1078544)
    - Add a regression test for LP: #750958
    - Don't depend on dpkg-dev to select the correct lintian profile.
      (Fixes LP: #1066457)
    - If the user cannot be autohrized (either missing privileges
       or a cancelled password dialog) the transaction will fail.
    - Don't fail if we want to remove a a package without a
      candidate during transaction simulation.
 -- Michael Vogt <email address hidden> Mon, 17 Dec 2012 11:45:14 +0100

Changed in aptdaemon (Ubuntu Raring):
status: Triaged → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

I've uploaded a version of aptdaemon fixing this bug to the quantal -proposed queue.

Revision history for this message
Brian Murray (brian-murray) wrote :

An a version of aptdaemon fixing this bug to the precise -proposed queue.

Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello Daniel, or anyone else affected,

Accepted aptdaemon into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/aptdaemon/0.43+bzr805-0ubuntu8 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation 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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in aptdaemon (Ubuntu Precise):
status: Triaged → Fix Committed
tags: added: verification-needed
Changed in aptdaemon (Ubuntu Quantal):
status: Triaged → Fix Committed
Revision history for this message
Adam Conrad (adconrad) wrote :

Hello Daniel, or anyone else affected,

Accepted aptdaemon into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/aptdaemon/0.45+bzr861-0ubuntu9.1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation 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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Daniel Hartwig (wigs) wrote : Re: [Bug 1078544] Please test proposed package

On 12 January 2013 10:57, Adam Conrad <adconrad@0c3.net> wrote:
> Hello Daniel, or anyone else affected,

Note I am not affected by this issue as I use neither Ubuntu or aptdaemon.

Revision history for this message
Daniel Hartwig (wigs) wrote :

Sebastian Heinlein (glatzor) wrote:
> The user should be allowed to override any holds, so I
> have chosen your second patch.

Yes. Ideally the /caller/ should be able to control this, as not all requests will come so directly from the user. Please in a future revision also expose FromUser in the API.

Revision history for this message
shankao (shankao) wrote :

Tested on precise: the fix works.

Revision history for this message
shankao (shankao) wrote :

Tested package version was: aptdaemon (0.43+bzr805-0ubuntu8) precise-proposed;

Revision history for this message
shankao (shankao) wrote :

Tested on quantal with version aptdaemon (0.45+bzr861-0ubuntu9.1.2) quantal-proposed. It works

tags: added: verification-done
removed: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of this Stable Release Update 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 regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package aptdaemon - 0.43+bzr805-0ubuntu8

---------------
aptdaemon (0.43+bzr805-0ubuntu8) precise-proposed; urgency=low

  * Don't change the automatic installed state when upgrading package
    (Thanks a lot to Daniel Hartwig, LP: #1078544)
 -- Brian Murray <email address hidden> Fri, 11 Jan 2013 14:36:14 -0800

Changed in aptdaemon (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package aptdaemon - 0.45+bzr861-0ubuntu9.1.2

---------------
aptdaemon (0.45+bzr861-0ubuntu9.1.2) quantal-proposed; urgency=low

  * Don't change the automatic installed state when upgrading package
    (Thanks a lot to Daniel Hartwig, LP: #1078544)
 -- Brian Murray <email address hidden> Fri, 11 Jan 2013 13:42:28 -0800

Changed in aptdaemon (Ubuntu Quantal):
status: Fix Committed → Fix Released
Changed in aptdaemon (Debian):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.