[Rpm-maint] [rpm-software-management/rpm] %global expands twice (#1049)

Panu Matilainen notifications at github.com
Wed Feb 5 11:30:51 UTC 2020

It's mentioned in https://rpm.org/user_doc/macros.html:
> Note that %define and %global differ in more ways than just scope: the body of a %define’d macro is lazily expanded (ie when used), but the body of %global is expanded at definition time. It’s possible to use %%-escaping to force lazy expansion of %global.

Might even be added by myself, but that's actually a pretty lousy explanation. Yes, body of %global is expanded at the time of definition but to use a macro is to expand it, so any remaining macros in %global's body will be expanded on use. To do anything else would seem strange to me.

As for %{literal:...}, there's already a ticket requesting that functionality (#582). Name-bikeshedding aside, I've nothing against adding such a feature.

I can live with %{quotepercent:...} too, I just wonder if there should instead be a macro type that does *not* expand on use. Eg

%literal foo %{blablah}

(whether its called %literal, %constant or whatever)

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200205/9e6095a1/attachment.html>

More information about the Rpm-maint mailing list