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.
Description of problem:
# head /usr/lib/rpm/redhat/brp-mangle-shebangs
#!/bin/bash -eu
# If using normal root, avoid changing anything.
echo $RPM_BUILD_ROOT
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
The above doesn't test whether the directory actually exists.
For a spec file which I am able to build on RHEL-7 successfully, I am getting following failure on RHEL-8:
/usr/lib/rpm/redhat/brp-mangle-shebangs: line 72: cd: /tmp/bz-ilrKNb/BUILDROOT/special-1.0-1.x86_64: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.5l4W0o (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.5l4W0o (%install)
Changing the condition to the following fixed it for me.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" -o ! -d "$RPM_BUILD_ROOT" ]; then
exit 0
fi
Version-Release number of selected component (if applicable):
redhat-rpm-config-116-1.el8.noarch
Actually none of the brp-scripts specifically test for buildroot existence, and eg brp-compress does similar unchecked cd into buildroot:
+ /usr/lib/rpm/check-buildroot
find: '/home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64': No such file or directory
+ /usr/lib/rpm/redhat/brp-ldconfig
/sbin/ldconfig: Warning: ignoring configuration file that cannot be opened: /home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64/: No such file or directory
+ /usr/lib/rpm/brp-compress
/usr/lib/rpm/brp-compress: line 10: cd: /home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64: No such file or directory
+ /usr/lib/rpm/brp-strip /usr/bin/strip
find: '/home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64': No such file or directory
+ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
find: '/home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64': No such file or directory
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
find: '/home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64': No such file or directory
+ /usr/lib/rpm/brp-python-bytecompile '%{__python}' 1 1
find: '/home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64': No such file or directory
find: '/home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64': No such file or directory
+ /usr/lib/rpm/brp-python-hardlink
find: '/home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64': No such file or directory
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
/usr/lib/rpm/redhat/brp-mangle-shebangs: line 71: cd: /home/pmatilai/rpmbuild/BUILDROOT/special-1.0-1.x86_64: No such file or directory
The catch is that brp-mangle-shebangs runs with -e:
#!/usr/bin/bash -eu
Whatever the fix ends up being, I agree these things should behave consistently.
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/RHBA-2019:3389
Description of problem: # head /usr/lib/rpm/redhat/brp-mangle-shebangs #!/bin/bash -eu # If using normal root, avoid changing anything. echo $RPM_BUILD_ROOT if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then exit 0 fi The above doesn't test whether the directory actually exists. For a spec file which I am able to build on RHEL-7 successfully, I am getting following failure on RHEL-8: /usr/lib/rpm/redhat/brp-mangle-shebangs: line 72: cd: /tmp/bz-ilrKNb/BUILDROOT/special-1.0-1.x86_64: No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.5l4W0o (%install) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.5l4W0o (%install) Changing the condition to the following fixed it for me. if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" -o ! -d "$RPM_BUILD_ROOT" ]; then exit 0 fi Version-Release number of selected component (if applicable): redhat-rpm-config-116-1.el8.noarch