openSUSE / zypper

World's most powerful command line package manager
http://en.opensuse.org/Portal:Zypper
Other
412 stars 113 forks source link

zypper exits with 0 when remote package is unavailable or timeouts #539

Open aledabin opened 8 months ago

aledabin commented 8 months ago

Hi, when installing multiple packages and one of them is a remote package, if the remote package is unavailable or timeouts, the exit code is still 0.

To reproduce:

  1. optional: start a local listening port: nc -l 9000, the same behavior happens if nothing is listening
  2. install a valid package and a fake remote package (to simulate when it's possible to connect to a repository but no content is received):
    [root@root ~]$ zypper  --no-refresh install --no-confirm --no-recommends --allow-unsigned-rpm  bash  http://localhost:9000/none.rpm
    Problem retrieving the specified RPM file:
    Timeout exceeded when accessing 'http://localhost:9000/none.rpm'.
    Please check whether the file is accessible.
    Problem with the RPM file specified as 'http://localhost:9000/none.rpm', skipping.
    Loading repository data...
    Reading installed packages...
    'bash' is already installed.
    No update candidate for 'bash-4.4-150400'. The highest available version is already installed.
    Resolving package dependencies...
    Nothing to do.
    [root@root ~]$ echo $?
    0

    My assumption is the exit status should not be 0 as not all packages were installed.

If only a remote package is specified, it works as expected:

[root@root ~]$ zypper  --no-refresh install --no-confirm --no-recommends --allow-unsigned-rpm   http://localhost:9000/none.rpm
Problem retrieving the specified RPM file:
Timeout exceeded when accessing 'http://localhost:9000/none.rpm'.
Please check whether the file is accessible.
Problem with the RPM file specified as 'http://localhost:9000/none.rpm', skipping.
No valid arguments specified.
[root@root ~]$  echo $?
3

It fails immediately or timeouts after some minutes, and finish with exit code 3.

Shane-Braswell commented 4 months ago

Notice the same issue when packages are skipped but found locally. Expect an option to throw an error but that's not available. image