Bug 974786

Summary: Wrong exit code at zypper info
Product: [openSUSE] openSUSE Distribution Reporter: Forgotten User RqZ36qr9_H <forgotten_RqZ36qr9_H>
Component: libzyppAssignee: E-mail List <zypp-maintainers>
Status: RESOLVED WONTFIX QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Leap 42.1   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE 42.1   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Forgotten User RqZ36qr9_H 2016-04-10 09:52:16 UTC
Currently I create a script which install missing packages (in my case: Java) across the most Linux distributions, including OpenSUSE.

"dnf info", "yum info" and "apt-cache show" don't return the exit code 0, if a package was not found. They only return 0, if the package was found.

"zypper info" always returns 0, even if the package was not found. That is bad in my opinion. It should return 1 if the package was not found.

Reproduce:
# zypper info java-1_8_0-openjdk-headless
Loading repository data...
Reading installed packages...


Information for package java-1_8_0-openjdk-headless:
----------------------------------------------------
[...]
# echo $?
0

# zypper info java-1_10_0-openjdk-headless
Loading repository data...
Reading installed packages...


package 'java-1_10_0-openjdk-headless' not found.
# echo $?
0
Comment 1 Michael Andres 2016-04-11 09:21:24 UTC
Right, it should behave like e.g the search command and return 104 if we don't have at least one hit for each argument.

> # zypper rm xteddy

> # zypper se -x xteddy; echo $?
> ...
> S | Name   | Summary                                       | Type   
> --+--------+-----------------------------------------------+--------
>   | xteddy | A cuddly teddy bear for your X Window desktop | package
> 0

> # zypper se -x -i xteddy; echo $?
> ...
> No matching items found.
> 104
Comment 2 Tomáš Chvátal 2018-04-13 15:14:49 UTC
This is automated batch bugzilla cleanup.

The openSUSE 42.1 changed to end-of-life (EOL [1]) status. As such
it is no longer maintained, which means that it will not receive any
further security or bug fix updates.
As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
openSUSE, or you can still observe it under openSUSE Leap 15.0, please
feel free to reopen this bug against that version (see the "Version"
component in the bug fields), or alternatively open
a new ticket.

Thank you for reporting this bug and we are sorry it could not be fixed
during the lifetime of the release.

[1] https://en.opensuse.org/Lifetime