<p>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:</p>
<pre><code>$ rpm --eval '
> %define foo %%%%
> %global bar %%%%
> %foo percent, %bar percent'

%% percent, % percent
</code></pre>
<p>Is that documented anywhere?</p>
<p>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:</p>
<pre><code>%{literal:%foo}       - expands to the unexpanded body, i.e. `%foo`
%{quotepercent:%foo}  - expands the body and then doubles all % chars, i.e. '%%%%'
</code></pre>
<p>(I do not like the name <code>quotepercent</code>, though)</p>
<p>With those macros, <code>%global foo %{literal:...}</code> would be exactly like %define but at global level, whereas <code>%global foo %{quotepercent:...}</code> would only expand at the macro definition.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/rpm-software-management/rpm/issues/1049?email_source=notifications&email_token=ADLPZUYQDQCOGQ74IQKPTC3RBKKPRA5CNFSM4KQI3CDKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILFKO4Q">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ADLPZU3YXEH2B26HKVRF6ATRBKKPRANCNFSM4KQI3CDA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ADLPZU7JEXY52UMNX7O7XW3RBKKPRA5CNFSM4KQI3CDKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILFKO4Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/rpm-software-management/rpm/issues/1049?email_source=notifications\u0026email_token=ADLPZUYQDQCOGQ74IQKPTC3RBKKPRA5CNFSM4KQI3CDKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILFKO4Q",
"url": "https://github.com/rpm-software-management/rpm/issues/1049?email_source=notifications\u0026email_token=ADLPZUYQDQCOGQ74IQKPTC3RBKKPRA5CNFSM4KQI3CDKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILFKO4Q",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>