[Rpm-maint] [rpm-software-management/rpm] Collapse unexpanded macro definitions (#1198) (#1343)

Michal Domonkos notifications at github.com
Mon Aug 24 15:21:45 UTC 2020


Since the body of a newly defined macro may span multiple lines and
contain %if expressions, we need to make sure the line parser does not
try to interpret those when the corresponding %define or %global macro
appears in a false %if branch and is therefore left unexpanded in the
line buffer.

This is usually not a problem since any macros found in the body itself
would not be expanded anyway, but it can break the syntax check for
conditionals, which follows after expansion.  This is because, with the
recently introduced support for line-continuation markers in %if
expressions (commit 5f4fdce), the parser would be tricked into thinking
that the markers belong to the %if expression itself and collapse them
into a single line, including the matching %endif, and then complain
about the missing %endif (which must be on a separate line).

Instead, similarly to %if, we should collapse the %define/%global macro
itself so that the line parser doesn't pass through the body at all.

A side effect of this change (of commit 5f4fdce from a year ago, in
fact) is that %if constructs are no longer syntax-checked within macros
defined in false %if branches, but that's arguably correct behavior,
since they only come into existence when their definition macro (%define
or %global) is actually expanded, and should merely be treated as text
values until that point.

Fixes: #1198
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1343

-- Commit Summary --

  * Collapse unexpanded macro definitions (#1198)

-- File Changes --

    M build/parseSpec.c (6)
    M build/rpmbuild_internal.h (4)
    A tests/data/SPECS/ifmultiline-macro.spec (22)
    M tests/rpmbuild.at (9)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1343.patch
https://github.com/rpm-software-management/rpm/pull/1343.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1343
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200824/01d3e865/attachment.html>


More information about the Rpm-maint mailing list