From d811af03472c7b184df03c6ecff9040d9d554bbc Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 14 Oct 2020 12:02:29 +0200 Subject: Treat unparsable macros like undefined macros This seems to be the intention of the code but it did not work because macro parsing was resumed at the wrong point of the input string. Without this commit, "%{}" expanded to "%" instead of "%{}". (cherry picked from commit 6de7374bb86d59ad8ca577c1d16776057c3eba73) --- rpmio/macro.c | 1 - tests/rpmmacro.at | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rpmio/macro.c b/rpmio/macro.c index 4d3697fd7..0e63f68a4 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -1474,7 +1474,6 @@ expandMacro(MacroBuf mb, const char *src, size_t slen) mbErr(mb, 1, _("A %% is followed by an unparseable macro\n")); #endif - s = se; continue; } diff --git a/tests/rpmmacro.at b/tests/rpmmacro.at index 80d7ee207..c67d96ede 100644 --- a/tests/rpmmacro.at +++ b/tests/rpmmacro.at @@ -6,10 +6,13 @@ AT_BANNER([RPM macros]) AT_SETUP([simple rpm --eval]) AT_KEYWORDS([macros]) AT_CHECK([ -runroot rpm --define "this that" --eval '%{this}' +runroot rpm --define "this that" --eval '%{this}' --eval '%not_defined' --eval '%{not_defined}' --eval '%{}' ], [0], [that +%not_defined +%{not_defined} +%{} ]) AT_CLEANUP -- cgit v1.2.1