Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1419590

Summary: rpm-sign exit with 0 if it fails to sign package
Product: Red Hat Enterprise Linux 7 Reporter: Vit Ry <Frodox>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Jan Blazek <jblazek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: ffesti, Frodox, pmoravco, vmukhame
Target Milestone: rcKeywords: EasyFix
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.11.3-33.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 11:34:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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