diff --git a/backport-Require-macro-filenames-to-end-in-alphanum-char.patch b/backport-Require-macro-filenames-to-end-in-alphanum-char.patch new file mode 100644 index 0000000000000000000000000000000000000000..d9d6d0d4e7f43ac0a6152e974b329e51f27ec2ef --- /dev/null +++ b/backport-Require-macro-filenames-to-end-in-alphanum-char.patch @@ -0,0 +1,58 @@ +From 63e3061fa2471c663bed43d02f97c80953dfc9f7 Mon Sep 17 00:00:00 2001 +From: Michal Domonkos +Date: Wed, 23 Oct 2024 15:45:07 +0200 +Subject: [PATCH] Require macro filenames to end in alphanum char + +--- + rpmio/macro.c | 4 +++- + tests/rpmmacro.at | 17 +++++++++++++++++ + 2 files changed, 20 insertions(+), 1 deletion(-) + +diff --git a/rpmio/macro.c b/rpmio/macro.c +index 4239f21..e905920 100644 +--- a/rpmio/macro.c ++++ b/rpmio/macro.c +@@ -1956,9 +1956,11 @@ rpmInitMacros(rpmMacroContext mc, const char * macrofiles) + + /* Read macros from each file. */ + for (path = files; *path; path++) { ++ size_t len = strlen(*path); + if (rpmFileHasSuffix(*path, ".rpmnew") || + rpmFileHasSuffix(*path, ".rpmsave") || +- rpmFileHasSuffix(*path, ".rpmorig")) { ++ rpmFileHasSuffix(*path, ".rpmorig") || ++ (len > 0 && !risalnum((*path)[len - 1]))) { + continue; + } + (void) loadMacroFile(mc, *path); +diff --git a/tests/rpmmacro.at b/tests/rpmmacro.at +index 8374f18..b717974 100644 +--- a/tests/rpmmacro.at ++++ b/tests/rpmmacro.at +@@ -2,6 +2,23 @@ + # + AT_BANNER([RPM macros]) + ++# ------------------------------ ++AT_SETUP([macro path: skip editor backups]) ++AT_KEYWORDS([macros]) ++RPMTEST_SETUP ++RPMTEST_CHECK([ ++echo '%this that' > $RPMTEST/$RPM_CONFIGDIR_PATH/macros.d/macros.this ++runroot rpm --eval '%{this}' ++mv $RPMTEST/$RPM_CONFIGDIR_PATH/macros.d/macros.this{,~} ++runroot rpm --eval '%{this}' ++], ++[0], ++[that ++%{this} ++], ++[]) ++RPMTEST_CLEANUP ++ + # ------------------------------ + AT_SETUP([simple rpm --eval]) + AT_KEYWORDS([macros]) +-- +2.43.0 + diff --git a/rpm.spec b/rpm.spec index 4c2141f4e15e39e1dbbffdd65ea25b56333586c9..16a9379b61a0b353f89372c07b82c0a339ca9544 100644 --- a/rpm.spec +++ b/rpm.spec @@ -1,6 +1,6 @@ Name: rpm Version: 4.18.2 -Release: 21 +Release: 22 Summary: RPM Package Manager License: GPL-2.0-or-later URL: https://rpm.org/ @@ -61,6 +61,7 @@ Patch6037: backport-Fix-a-memory-leak-on-rpmdb-importdb.patch Patch9000: Add-digest-list-plugin.patch Patch9001: Add-IMA-digest-list-support.patch Patch9002: Support-sm2p256v1-of-ECDSA-and-sm3-of-hash.patch +Patch9003: backport-Require-macro-filenames-to-end-in-alphanum-char.patch BuildRequires: gcc autoconf automake libtool make gawk popt-devel openssl-devel readline-devel BuildRequires: zlib-devel zstd-devel >= 1.3.8 xz-devel bzip2-devel libarchive-devel ima-evm-utils-devel @@ -346,6 +347,9 @@ make clean %exclude %{_mandir}/man8/rpmspec.8* %changelog +* Wed Nov 27 2024 tenglei - 4.18.2-22 +- sync patches from upstream to solve: Some edit issues in temporary macro files where macros can take effect + * Tue Nov 26 2024 hugel - 4.18.2-21 - sync patches from upstream