public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: Behave more consistently when target %%optflags are not defined (#2231727)
@ 2026-11-23 9:35 Panu Matilainen
0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-11-23 9:35 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 88f6201129682599e946dfd0785b957ebd6ef1cd
Author : Panu Matilainen <pmatilai@redhat.com>
Date : 2023-08-21T14:28:53+03:00
Stats : +58/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/88f6201129682599e946dfd0785b957ebd6ef1cd?branch=pmatilai-v6
Log:
Behave more consistently when target %%optflags are not defined (#2231727)
---
diff --git a/0001-Behave-more-consistently-when-target-arch-optflags-a.patch b/0001-Behave-more-consistently-when-target-arch-optflags-a.patch
new file mode 100644
index 0000000..efb6e0f
--- /dev/null
+++ b/0001-Behave-more-consistently-when-target-arch-optflags-a.patch
@@ -0,0 +1,53 @@
+From b1c99cc21dd8dc984734cd2a66e48a5676280dee Mon Sep 17 00:00:00 2001
+Message-ID: <b1c99cc21dd8dc984734cd2a66e48a5676280dee.1692617135.git.pmatilai@redhat.com>
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Mon, 21 Aug 2023 13:42:43 +0300
+Subject: [PATCH] Behave more consistently when target arch %optflags are not
+ defined
+
+You're about to fall into a deep dark hole, proceed at your own risk.
+
+When building for a target architecture with no defined %optflags
+(such as noarch), one would think that %optflags would be empty. Not so in
+rpm, instead we get %optflags for the detected architecture, and there
+are packages which rely on this behavior. And in this particular dark
+corner, buildarchtranslate is not applied so one can get drastically
+different %optflags than you'd get without an explicit --target, on the
+same system. Which can break builds.
+
+None of this makes any sense whatsoever, but lets at least try to be
+consistent about it. When we fall back to detected architecture
+%optflags, at least use the ones after buildarchtranslate to return
+consistent data within a host.
+
+This supposedly fixes the case where our newly added x86_64
+subarchitecture definitions haven't been overridden in vendor config and
+somebody's noarch package uses cmake to install data, and falls over due
+to nonsensical optflags from rpm. Or something like that.
+
+Initial report: https://bugzilla.redhat.com/show_bug.cgi?id=2231727
+---
+ lib/rpmrc.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/lib/rpmrc.c b/lib/rpmrc.c
+index 8a829709b..f8a7aee8c 100644
+--- a/lib/rpmrc.c
++++ b/lib/rpmrc.c
+@@ -1685,6 +1685,13 @@ static void rpmRebuildTargetVars(rpmrcCtx ctx,
+ * XXX Make sure that per-arch optflags is initialized correctly.
+ */
+ { const char *optflags = rpmGetVarArch(ctx, RPMVAR_OPTFLAGS, ca);
++ /*
++ * If not defined for the target arch, fall back to current arch
++ * definitions, with buildarchtranslate applied.
++ */
++ if (optflags == NULL) {
++ optflags = rpmGetVarArch(ctx, RPMVAR_OPTFLAGS, NULL);
++ }
+ if (optflags != NULL) {
+ rpmPopMacro(NULL, "optflags");
+ rpmPushMacro(NULL, "optflags", NULL, optflags, RMIL_RPMRC);
+--
+2.41.0
+
diff --git a/rpm.spec b/rpm.spec
index c9c1ea7..c55a05a 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -27,7 +27,7 @@
%global rpmver 4.18.92
#global snapver rc1
-%global baserelease 1
+%global baserelease 2
%global sover 10
%global srcver %{rpmver}%{?snapver:-%{snapver}}
@@ -139,6 +139,7 @@ rpm-4.18.92-disable-sysusers.patch
rpm-4.18.90-weak-user-group.patch
# Patches already upstream:
+0001-Behave-more-consistently-when-target-arch-optflags-a.patch
# ...
# These are not yet upstream
@@ -612,6 +613,9 @@ fi
%doc %{_defaultdocdir}/rpm/API/
%changelog
+* Mon Aug 21 2023 Panu Matilainen <pmatilai@redhat.com> - 4.18.92-2
+- Behave more consistently when target %%optflags are not defined (#2231727)
+
* Wed Aug 02 2023 Michal Domonkos <mdomonko@redhat.com> - 4.18.92-1
- Update to 4.19 beta
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-23 9:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 9:35 [rpms/rpm] pmatilai-v6: Behave more consistently when target %%optflags are not defined (#2231727) Panu Matilainen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox