aptitude returns 0 exit status code even if the requested action is not successful
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
aptitude |
Fix Released
|
Unknown
|
|||
aptitude (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I have experienced two cases where aptitude returns a 0 exit status code, even if it prints error messages to the terminal.
Case 1: A package cannot be installed due to unmet dependencies.
Example: (installing something that depends on sun-java on a host with the "partner" repository disabled)
> sudo /usr/bin/aptitude -y install hadoop-0.20
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
The following packages are BROKEN:
hadoop-0.20
The following NEW packages will be installed:
hadoop-
0 packages upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 41.2MB of archives. After unpacking 92.3MB will be used.
The following packages have unmet dependencies:
hadoop-0.20: Depends: sun-java6-jre which is a virtual package.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
hadoop-0.20 [Not Installed]
hadoop-
Score is -9868
Writing extended state information... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
> echo $?
0
Expected result: Non-zero exit status code
Case 2: The package name does not exist
Example:
> sudo aptitude install bogus-package
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Couldn't find any package whose name or description matched "bogus-package"
Couldn't find any package whose name or description matched "bogus-package"
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
> echo $?
0
Expected result: Non-zero exit status code
Related branches
description: | updated |
Changed in aptitude: | |
status: | Unknown → New |
Changed in aptitude: | |
status: | New → Fix Committed |
Changed in aptitude: | |
status: | Fix Committed → Fix Released |
Changed in aptitude: | |
status: | Fix Released → New |
Changed in aptitude: | |
status: | New → Confirmed |
Changed in aptitude: | |
status: | Confirmed → Fix Committed |
Changed in aptitude: | |
status: | Fix Committed → Fix Released |
Changed in aptitude (Ubuntu): | |
status: | Fix Committed → Fix Released |
The inclusion of "-y":
> sudo /usr/bin/aptitude -y install hadoop-0.20
means that in the event of problems you are instructing aptitude to proceed with it's first suggestion:
Keep the following packages at their current version: 0.20-native [Not Installed]
hadoop-0.20 [Not Installed]
hadoop-
*technically* aptitude has done what you have asked it to do.
The problem resolver does attempt to honour explicitly requested actions [1]. In this case that is not possible. The only solution would be to add a further option *requiring* the requested actions to be performed (this is very different to what "-y" does).
[1] Configuration items: Aptitude: :ProblemResolve r::PreserveManu alScore and Aptitude: :CmdLine: :Request- Strictness
> sudo aptitude install bogus-package
...
> echo $?
0
This has already been reported [2].
[2] http:// bugs.debian. org/cgi- bin/bugreport. cgi?bug= 590686