Bug 1419590 - rpm-sign exit with 0 if it fails to sign package
Summary: rpm-sign exit with 0 if it fails to sign package
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rpm
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Packaging Maintenance Team
QA Contact: Jan Blazek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-06 15:04 UTC by Vit Ry
Modified: 2018-10-30 11:34 UTC (History)
4 users (show)

Fixed In Version: rpm-4.11.3-33.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 11:34:10 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:3250 0 None None None 2018-10-30 11:34:35 UTC

Description Vit Ry 2017-02-06 15:04:04 UTC
Description of problem:
rpm --addsign return 0 if it fails to sign rpm-package


Version-Release number of selected component (if applicable):
rpm.ppc64 0:4.11.3-21.el7
rpm-sign.ppc64 0:4.11.3-21.el7


How reproducible:
always


Steps to Reproduce:
1. get any rpm
2. change perms, so user can't write it that dir
3. setup gpg keys under user
4. rpm --addsign <package>.rpm


Actual results:
Error message and exit code 0.

$ rpm --addsign kernel-3.10.0-514.6.1.el7.src.rpm
Enter pass phrase: 
Pass phrase is good.
kernel-3.10.0-514.6.1.el7.src.rpm:
error: rpmMkTemp failed

$ echo $?
0


Expected results:

return code would be non-zero.

Comment 2 Vit Ry 2017-02-08 12:20:18 UTC
Patch:

diff -up rpm-4.11.3/sign/rpmgensig.c.sign-error-propagation rpm-4.11.3/sign/rpmgensig.c
--- rpm-4.11.3/sign/rpmgensig.c.sign-error-propagation
+++ rpm-4.11.3/sign/rpmgensig.c
@@ -495,9 +495,9 @@ static int rpmSign(const char *rpm, int
     if (deleting) {	/* Nuke all the signature tags. */
 	deleteSigs(sigh);
     } else {
-	res = replaceSignature(sigh, sigtarget, passPhrase);
-	if (res != 0) {
-	    if (res == 1) {
+	int temp_res = replaceSignature(sigh, sigtarget, passPhrase);
+	if (temp_res != 0) {
+	    if (temp_res == 1) {
 		rpmlog(RPMLOG_WARNING,
 		   _("%s already contains identical signature, skipping\n"),
 		   rpm);

Comment 3 Pavlina Moravcova Varekova 2018-04-13 13:51:41 UTC
The patch looks OK. The problem is already solved in upstream in patch
https://github.com/rpm-software-management/rpm/commit/e1fd794253588e44226f480c426ba1833295b318
The upstream patch is in rpm-4.12.0 and higher. So it should be used here too.

Comment 7 errata-xmlrpc 2018-10-30 11:34:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:3250


Note You need to log in before you can comment on or make changes to this bug.