diff options
author | Michael Schroeder <mls@suse.de> | 2020-10-14 12:02:29 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2020-12-10 13:28:07 +0200 |
commit | d811af03472c7b184df03c6ecff9040d9d554bbc (patch) | |
tree | 1244dfcece06c6c0912ba66676d38fe348f4f69d | |
parent | 92ebd48ae84f6f179535037be49e739c91e9fa74 (diff) | |
download | rpm-d811af03472c7b184df03c6ecff9040d9d554bbc.tar.gz |
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)
-rw-r--r-- | rpmio/macro.c | 1 | ||||
-rw-r--r-- | 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 |