aptitude returns 0(=OK) even if install fails

Bug #585408 reported by Klavs Klavsen
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
aptitude (Debian)
Fix Released
Unknown
aptitude (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: aptitude

When I tell aptitude to install a certain version of a package - and this version is not available - it outputs an error (Unable to find a version "..." for the package...) - but still returns 0(=OK).

This is a problem when automating installs using aptitude (we use puppet to do it) - as it thinks all is well, when it isn't :(

To reproduce - do this on a hardy install.
# aptitude install subversion=1.5.1dfsg1-1ubuntu2~hardy2; echo "ret:$?"
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
Unable to find a version "1.5.1dfsg1-1ubuntu2~hardy2" for the package "subversion"
Unable to find a version "1.5.1dfsg1-1ubuntu2~hardy2" for the package "subversion"
The following packages have been automatically kept back:
  libpq5 linux-libc-dev sun-java6-bin
The following packages have been kept back:
  bind9-host dnsutils libbind9-30 libdns35 libisc35 libisccfg30 libkrb53 liblwres30 linux-image-server linux-server nfs-common sudo sun-java6-jre tzdata
0 packages upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Writing extended state information... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
ret:0

Revision history for this message
Klavs Klavsen (kl-vsen) wrote :

This rudimentary patch catches this situation where aptitude would otherwise just install the latest available version of the package - even though you requested a specific version - and with this patch applied, it aborts when it finds out this is the case, instead of installing "latest version" of the requested package.

IMHO the correct thing to do.

You probably want to stop the processing in some other way than using abort() - and the printf may or may not need to be there (it does print out the error earlier on as well).

tags: added: patch
Changed in aptitude (Ubuntu):
status: New → Confirmed
tags: added: patch-forwarded-upstream
removed: patch
Changed in aptitude (Debian):
status: Unknown → New
Changed in aptitude (Debian):
status: New → Fix Committed
Revision history for this message
Daniel Hartwig (wigs) wrote :

commit a88745bf22c3e83e5d78331a69f813e451c895a0
Author: Daniel Hartwig <email address hidden>
Date: Tue Jun 12 18:19:47 2012 +0800

Changed in aptitude (Ubuntu):
status: Confirmed → Fix Committed
Changed in aptitude (Debian):
status: Fix Committed → Fix Released
Changed in aptitude (Debian):
status: Fix Released → New
Changed in aptitude (Debian):
status: New → Confirmed
Changed in aptitude (Debian):
status: Confirmed → Fix Committed
Changed in aptitude (Debian):
status: Fix Committed → Fix Released
Rolf Leggewie (r0lf)
Changed in aptitude (Ubuntu):
status: Fix Committed → 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.