Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1442015

Summary: rpmbuild: a way to request that /var/rpm/rpm-tmp* files are not removed
Product: [Fedora] Fedora Reporter: Pavel Raiskup <praiskup>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: ignatenko, kardos.lubos, mjw, packaging-team-maint, pmatilai, vmukhame
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.14.0-0.rc1.1.fc27 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-09-30 06:20:07 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 Pavel Raiskup 2017-04-13 10:23:46 UTC
I try to debug build failure of one SCL package, and I keep hearing this
error output:

Processing files: sclo-postgresql96-runtime-3.0-2.fc27.x86_64
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.6wkbfE
+ umask 022
+ cd /builddir/build/BUILD
+ cd sclo-postgresql96-3.0
+ DOCDIR=/builddir/build/BUILDROOT/sclo-postgresql96-3.0-2.fc27.x86_64/opt/rh/sclo-postgresql96/root/usr/share/doc/sclo-postgresql96-runtime
+ export DOCDIR
+ /usr/bin/mkdir -p /builddir/build/BUILDROOT/sclo-postgresql96-3.0-2.fc27.x86_64/opt/rh/sclo-postgresql96/root/usr/share/doc/sclo-postgresql96-runtime
+ cp -pr README /builddir/build/BUILDROOT/sclo-postgresql96-3.0-2.fc27.x86_64/opt/rh/sclo-postgresql96/root/usr/share/doc/sclo-postgresql96-runtime
+ cp -pr LICENSE /builddir/build/BUILDROOT/sclo-postgresql96-3.0-2.fc27.x86_64/opt/rh/sclo-postgresql96/root/usr/share/doc/sclo-postgresql96-runtime
+ exit 0
ERROR: Exception(intermediate-srpm/sclo-postgresql96-3.0-2.fc27.src.rpm) Config(praiskup-sclo-postgresql96_fedora-rawhide-x86_64) 1 minutes 28 seconds
INFO: Results and/or logs in: /var/lib/copr-builder/results
INFO: Cleaning up build root ('cleanup_on_failure=True')
Start: clean chroot

It is not clear to me where the "Exception" comes from ... more on that,
this is not reproducible on my box in fedora-rawhide mock chroot, but on
only in cloud disposable VM.

It might help or it might not, I'd like to see the contents of
/var/tmp/rpm-tmp.6wkbfE file, but that file is immediately removed after
build failure (perhaps because there's exit 0 after all).. having a look
at rpm code, there's:
https://github.com/rpm-software-management/rpm/blob/054f3ce53ce71dfdcae5559aa4a7f9cbb1df9bae/lib/rpmscript.c#L402

But perhaps there's no way to 'rpmSetVerbosity(RPMLOG_DEBUG)' in
rpmbulid.c.  Can we add some option for it (so I don't have to rebulid and
re-install rpm?

Comment 1 Panu Matilainen 2017-05-23 10:15:15 UTC
https://github.com/rpm-software-management/rpm/blob/054f3ce53ce71dfdcae5559aa4a7f9cbb1df9bae/build/build.c#L53 is what runs the build-side scripts, not rpmscript.c. 

The build-side only cleans up scripts which exited succesfully, see https://github.com/rpm-software-management/rpm/blob/054f3ce53ce71dfdcae5559aa4a7f9cbb1df9bae/build/build.c#L188:

    if (scriptName) {
	if (rc == RPMRC_OK)
	    (void) unlink(scriptName);
	free(scriptName);
    }

So technically there is a way: exit non-zero from scriptlet.

Comment 2 Jan Kurik 2017-08-15 08:41:01 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 4 Fedora Update System 2017-09-07 07:31:27 UTC
rpm-4.14.0-0.rc1.1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-b46d2f3c29

Comment 5 Fedora Update System 2017-09-07 14:33:35 UTC
rpm-4.14.0-0.rc1.1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-b46d2f3c29

Comment 6 Fedora Update System 2017-09-30 06:20:07 UTC
rpm-4.14.0-0.rc1.1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.