Bug 1686413
| Summary: | /usr/lib/rpm/redhat/brp-mangle-shebangs fails for non-existing RPM_BUILD_ROOT | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Karel Srot <ksrot> |
| Component: | redhat-rpm-config | Assignee: | Florian Festi <ffesti> |
| Status: | CLOSED ERRATA | QA Contact: | Eva Mrakova <emrakova> |
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | 8.0 | CC: | dmach, emrakova, ffesti, fweimer, pmatilai |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | 8.0 | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | redhat-rpm-config-119-1.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-11-05 20:58:43 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: | |||
| Bug Depends On: | 1681082 | ||
| Bug Blocks: | |||
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.
That is correct. These errors are reported even on RHEL-7, however none of them prevents the package from being built. 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