Perform as-is substitution for %{name} form too, again

- Commit c22d5b1299 changed the parsing
  to require a valid name in %{name} macro, but this outlaws existing
  uses such as %{foo_%{bar}_something}. Relaxing the %{name} form
  to use as-is substitution as well allows these to work again.
This commit is contained in:
Panu Matilainen 2014-02-20 10:31:35 +02:00
parent 1bdcd05008
commit df686992d7
2 changed files with 3 additions and 7 deletions

View File

@ -1106,14 +1106,12 @@ expandMacro(MacroBuf mb, const char *src, size_t slen)
}
f = parseMacroFlags(s + 1 /* skip { */, &negate, &chkexist);
fe = parseMacroName(f);
se++; /* skip } */
/* no valid name? syntax error */
/* no valid name? assume as-is substitution */
if (fe == NULL) {
rpmlog(RPMLOG_ERR,
_("Invalid macro name: %%%.*s\n"), (int)(se - s), s);
rc = 1;
mbAppend(mb, '%');
continue;
}
se++; /* skip } */
switch (*fe) {
case ':':
g = fe + 1;

View File

@ -33,11 +33,9 @@ runroot rpm --define "this that" --eval '%{?that}'
])
AT_CLEANUP
# XXX this was broken by commit c22d5b12999de6633d89828165ea3ab2112993e8
AT_SETUP([nested macro in name])
AT_KEYWORDS([macros])
AT_CHECK([
AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
runroot rpm --define "this that" --define "that_that foo" --eval '%{expand:%{%{this}_that}}'
],
[0],