[Rpm-maint] [rpm-software-management/rpm] `$RPM_BUILD_ROOT` is no longer an absolute path if `%_builddir` is configured relative (Issue #3128)

Michal Domonkos notifications at github.com
Mon May 27 16:10:50 UTC 2024


If `%_builddir` is a relative path configured externally (e.g. `.`), when we internally override it with the newly created per-package subdirectory, it's still a relative path (e.g. `./test-1-build`). That, in turn, ends up in `$RPM_BUILD_ROOT` at build scriptlet execution time which is initialized from the new `%_builddir`.

This is of course sane but it happens to break the expectation of at least one macro config which we ship in Fedora via redhat-rpm-config, namely:

```
#---------------------------------------------------------------------
#       Expanded at beginning of %install scriptlet.
#

%__spec_install_pre %{___build_pre}\
    [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
    mkdir -p "`dirname "$RPM_BUILD_ROOT"`"\
    mkdir "$RPM_BUILD_ROOT"\
    %{?_auto_set_build_flags:%{set_build_flags}}\
%{nil}
```

As a result, when you build a package with such a relative builddir set, another subdirectory will be created in the `%install` stage and `cd`ed into which breaks the rest of the script.

As mentioned, this is not necessarily a bug per se, however it may result in random breakage wherever relative paths are configured in `%_builddir`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/3128
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/3128 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240527/bd2b1c7c/attachment.html>


More information about the Rpm-maint mailing list