[Bug 919216] [NEW] aptitude returns 0 exit status code even if the requested action is not successful

Thomas Nygreen 919216 at bugs.launchpad.net
Fri Jan 20 14:26:12 UTC 2012


Public bug reported:

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.20-native{a} liblzo2-2{a}
    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.
                   Depends: sun-java6-bin 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-0.20-native [Not Installed]
   
    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

** Affects: aptitude (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  I have experienced two cases where aptitude returns a 0 exit status
- code, even if it prints error messages to the terminal:
+ 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.20-native{a} liblzo2-2{a} 
-  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.
-                 Depends: sun-java6-bin which is a virtual package.
-  The following actions will resolve these dependencies:
+     > 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.20-native{a} liblzo2-2{a}
+     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.
+                    Depends: sun-java6-bin 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-0.20-native [Not Installed]
+    
+     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
  
-  Keep the following packages at their current version:
-  hadoop-0.20 [Not Installed]
-  hadoop-0.20-native [Not Installed]
-  
-  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
+     > 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
+    > 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

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to aptitude in Ubuntu.
https://bugs.launchpad.net/bugs/919216

Title:
  aptitude returns 0 exit status code even if the requested action is
  not successful

Status in “aptitude” package in Ubuntu:
  New

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.20-native{a} liblzo2-2{a}
      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.
                     Depends: sun-java6-bin 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-0.20-native [Not Installed]
     
      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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/aptitude/+bug/919216/+subscriptions




More information about the foundations-bugs mailing list