#129 `spectool -g` is returning exit code 0 despite failed download
Opened by tarulia. Modified

I noticed that when executing spectool -g and it attempts to download a non-existent file, spectool returns a 404 Client Error as expected, but it still exits with code 0 as if execution was succesful.

Maybe I'm doing this in a weird way and if I do please do point me in a better direction, but I'm building things in mock locally for which I need the sources beforehand.
I was trying to do spectool -g <specfile> && mock …, so it wouldn't go through mock just to fail halfway through because it couldn't find the source files. But as it happens I was using a wrong URL for one of the sources, spectool returned as such, but mock was run anyway.

Simplified test case:

$ cat hello-world.spec 
Name:           hello-world
Version:        1.0
Release:        1%{?dist}
Summary:        testing stuff
License:        no
URL:            https://example.com
Source0:        https://example.com/path/to/bogus/file.tar.xz
%description
Hi.
$ spectool -g hello-world.spec 
Downloading: https://example.com/path/to/bogus/file.tar.xz
Download failed:
404 Client Error: Not Found for url: https://example.com/path/to/bogus/file.tar.xz
$ echo $?
0

IMO it would be nice if this returned 1 (or even 404), non-0 in any case, so cases like the above can be handled easily in a shell script.


Hm, this should have been fixed in https://pagure.io/rpmdevtools/c/7b8aec7 but that was after the last tagged release (9.5).

oof, unfortunate

I think you meant 9.6 but yeah, that's what the current package is built off of. Any chance this could get a new release seeing as those changes are 3 years old? The last commit is from 9 months ago too.

Making a new release would be great, but the regression in https://pagure.io/rpmdevtools/issue/128 needs to be resolved first.

+1, it would be nice to have this feature in the stable branches. This would solve a problem with lpf-spotify

works nice on lpf
please do a new tag.

I did the build in my copr repo
https://copr.fedorainfracloud.org/coprs/sergiomb/builds_for_Stable_Releases/package/rpmdevtools/

Making a new release would be great, but the regression in https://pagure.io/rpmdevtools/issue/128 needs to be resolved first.

The current git master is broken, it needs to be fixed before we can tag a new release.

Metadata