Bug 2299818 - regression in %setup
Summary: regression in %setup
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2300612
TreeView+ depends on / blocked
 
Reported: 2024-07-25 10:21 UTC by Dan Horák
Modified: 2024-08-01 07:55 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-08-01 07:15:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Dan Horák 2024-07-25 10:21:04 UTC
The cross-gcc package is using

%global srcdir gcc-%{version}-%{DATE}
Source0: %{srcdir}.tar.xz

%setup -q -n %{srcdir} -c
cd %{srcdir}
...

which worked fine until the last build when rpm 4.19.92 has been used. From the build.logs is clear that handling of %setup is completely different. See https://src.fedoraproject.org/rpms/cross-gcc/blob/rawhide/f/cross-gcc.spec#_270 for the spec file.

...
Start: rpmbuild cross-gcc-14.1.1-1.fc41.1.src.rpm
Building target platforms: aarch64
Building for target aarch64
setting SOURCE_DATE_EPOCH=1721174400
Executing(%mkbuilddir): /bin/sh -e /var/tmp/rpm-tmp.f1HpC5
+ umask 022
+ cd /builddir/build/BUILD/cross-gcc-14.1.1-build/gcc-14.1.1-20240508
/var/tmp/rpm-tmp.f1HpC5: line 33: cd: /builddir/build/BUILD/cross-gcc-14.1.1-build/gcc-14.1.1-20240508: No such file or directory


compared to

Building target platforms: x86_64
Building for target x86_64
setting SOURCE_DATE_EPOCH=1715558400
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.QE22kf
+ umask 022
+ cd /builddir/build/BUILD
+ cd /builddir/build/BUILD
+ rm -rf gcc-14.1.1-20240508
+ /usr/bin/mkdir -p gcc-14.1.1-20240508
+ cd gcc-14.1.1-20240508
+ /usr/lib/rpm/rpmuncompress -x /builddir/build/SOURCES/gcc-14.1.1-20240508.tar.xz
+ STATUS=0
...

in the last successful build (https://koji.fedoraproject.org/koji/buildinfo?buildID=2451537) using rpm 4.19.1.

Reproducible: Always

Comment 1 Panu Matilainen 2024-07-31 13:04:31 UTC
Most likely this:

> %global builddir %{_builddir}/%{srcdir}

%builddir is a rpm-defined macro in >= 4.20 and redefining it to something else will break stuff. Rename that to "mybuilddir" or something.

Comment 2 Dan Horák 2024-07-31 14:09:22 UTC
yes, renaming builddir solves the issue, thanks for the hint

Comment 3 Panu Matilainen 2024-08-01 07:15:14 UTC
Ack, thanks for confirming.

Ideally you'd get a meaningful warning/error message when trying to override system macros of course - and you actually do for built-in macros (eg you can't override %define), but there's nothing like that for others at the moment.

Comment 4 Dan Horák 2024-08-01 07:36:12 UTC
Thanks, I was going to suggest something like that about emitting a warning in such cases, like for example the C/GCC preprocessor does about redefined macros.

Comment 5 Panu Matilainen 2024-08-01 07:55:43 UTC
Yup. Unlike C preprocessor macros, rpm macros are by design stackable and tons of functionality depends on that behavior, so we can't just error/warn on any macro redefinition. There'd need to be some "read-only" (or non-stackable) attribute that can be applied to some carefully selected macros.

And now I remember there actually is a related ticket already: https://github.com/rpm-software-management/rpm/issues/2314


Note You need to log in before you can comment on or make changes to this bug.