<p>There's a lot of expansion going on in the %expr macro. Witness this:</p>
<p>./rpm --eval '%{expr: "%%%%%%%%"}'<br>
%</p>
<p>The string gets expanded</p>
<ul>
<li>at the start of doFoo when it expands the argument</li>
<li>in rdToken when it parses a string</li>
<li>at the end of doFoo  because of issue <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="254352447" data-permission-text="Issue title is private" data-url="https://github.com/rpm-software-management/rpm/issues/313" data-hovercard-type="issue" data-hovercard-url="/rpm-software-management/rpm/issues/313/hovercard" href="https://github.com/rpm-software-management/rpm/issues/313">#313</a></li>
</ul>
<p>I'm somewhat surprised that rdToken expands strings and that this hasn't messed up some <code>%if</code> statements yet.<br>
It's also somewhat inconsistent that the integer case does not do expansion.</p>
<p>I kind of like to have the expansion in rdToken instead of doFoo because:</p>
<ul>
<li>It makes <code>"%str"</code> work when %str contains a <code>"</code> character.</li>
<li>It allows to have short circuit semantics</li>
</ul>

<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/834?email_source=notifications&email_token=ADLPZU2MNJQXGJYGLC6MICDQJC7BRA5CNFSM4IVR4MZ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKVOPQA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ADLPZUZPXDFNNL6UOP7L5RTQJC7BRANCNFSM4IVR4MZQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/ADLPZU2JYEVVC276QMXU6WTQJC7BRA5CNFSM4IVR4MZ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKVOPQA.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/834?email_source=notifications\u0026email_token=ADLPZU2MNJQXGJYGLC6MICDQJC7BRA5CNFSM4IVR4MZ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKVOPQA",
"url": "https://github.com/rpm-software-management/rpm/issues/834?email_source=notifications\u0026email_token=ADLPZU2MNJQXGJYGLC6MICDQJC7BRA5CNFSM4IVR4MZ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKVOPQA",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>