Oh wow, I knew that %global expands right away when defining the macro, but I 
somehow didn't expect that it expands again when the macro is used:
```
$ rpm --eval '
> %define foo %%%%
> %global bar %%%%
> %foo percent, %bar percent'

%% percent, % percent
```
Is that documented anywhere?

Anyway, I'm pretty sure that changing this will break most packages that use 
%global instead of %define because some guidelines said so, but I'm wondering 
if we should add two new macros to make it easier to use %global in a safe way:
```
%{literal:%foo}       - expands to the unexpanded body, i.e. `%foo`
%{quotepercent:%foo}  - expands the body and then doubles all % chars, i.e. 
'%%%%'
```
(I do not like the name `quotepercent`, though)

With those macros, `%global foo %{literal:...}` would be exactly like %define 
but at global level, whereas `%global foo %{quotepercent:...}` would only 
expand at the macro definition.



-- 
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/issues/1049
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to