[PATCH] Stricter macro substitution syntax

Alexey Tourbin alexey.tourbin at gmail.com
Mon Jan 21 20:26:14 UTC 2013


On Tue, Jan 22, 2013 at 12:14 AM, Alexey Tourbin
<alexey.tourbin at gmail.com> wrote:
> This change introduces a separate routine to parse for valid macro
> names.  Valid macro names are either regular 3+ character identifiers,
> or special names: "S", "P", "0", "#", "*", "**", macro options such as
> "-o" and "-o*", and macro arguments such as "1".  Other names are not
> valid.  This fixes a number of bugs seen earlier due to sloppy name
> parsing: "%_libdir*" and "%01" were not expanded (these are now expanded
> to e.g. "/usr/lib64*" and "<name>1", as expected).  This also fixes
> bugs in as-is substitution: "%!foo" was expanded to "%foo", and likewise
> "%!!!" was expanded to "%" (and to "%<garbage>" at EOL).
>
> Also, bad names in %name and %{name...} substitutions are now handled
> differently.  In %name form, the name is parsed tentatively; a silent
> fall-back to as-is substitution is provisioned when no valid name can
> be obtain.  In %{name...} form, a failure to obtain a valid name is now
> a syntax error.  Furthermore, only 3 variants are syntactically valid:
> %{name} proper, %{name:...}, and %{name ...}.  This renders invalid
> ambiguous macro substitutions such as the one found in FC18 lvm2.spec:
>
> Requires: util-linux >= %{util-linux_version}
> error: Invalid macro syntax: %{util-linux_version}

Hi there again.
Here is the full list of FC18 packages for which this new syntax error
is triggered.

beefy-miracle-kde-theme.spec
Requires:       beefy-miracle-backgrounds-kde >= %{backgrounds-kde-version}
error: Invalid macro syntax: %{backgrounds-kde-version}
error: line 19: Requires:       beefy-miracle-backgrounds-kde >=

freeradius.spec
    e.g. %{Tunnel-Type:1} and %{Tunnel-Type:1[0]} now work.
error: Invalid macro syntax: %{Tunnel-Type:1}
error: line 678:     e.g.

gnome-keyring-sharp.spec
# svn co -r %{svn-rev} \
error: Invalid macro syntax: %{svn-rev}
error: line 15: # svn co -r

lvm2.spec
Requires: util-linux >= %{util-linux_version}
error: Invalid macro syntax: %{util-linux_version}
error: line 437: Requires: util-linux >=

openwsman.spec
[ -d %{buildroot/}%{ruby_vendorlib} ] && rm -f
%{buildroot}/%{ruby_vendorlib}/openwsmanplugin.rb
error: Invalid macro syntax: %{buildroot/}
error: line 178: [ -d

parboiled.spec
#cp -p %{SOURCE?} %{name}-scala/pom.xml
error: Invalid macro syntax: %{SOURCE?}
error: line 69: #cp -p

perl-Class-Prototyped.spec
%global __provides_exclude
%{?__provides_exclude?__provides_exclude|}^perl\\(My[^\\)]*Class\\)$
%global __requires_exclude
%{?__requires_exclude?__requires_exclude|}^perl\\(Class::Prototyped::Graph\\)$
%global __requires_exclude_from
%{?__requires_exclude_from?__requires_exclude_from|}%{_docdir}/examples
error: Invalid macro syntax: %{?__provides_exclude?__provides_exclude|}
error: Macro %__provides_exclude failed to expand
error: Invalid macro syntax: %{?__requires_exclude?__requires_exclude|}
error: Macro %__requires_exclude failed to expand
error: Invalid macro syntax:
%{?__requires_exclude_from?__requires_exclude_from|}
error: Macro %__requires_exclude_from failed to expand

perl-DBD-Mock.spec
%global __requires_exclude
%{?__requires_exclude|%__requires_exclude|}^perl\\(DBI\\)$
error: Invalid macro syntax: %{?__requires_exclude|%__requires_exclude|}
error: Macro %__requires_exclude failed to expand

perl-DBI.spec
%global __requires_exclude
%{?__requires_exclude|%__requires_exclude|}^perl\\(RPC::|^perl\\(Coro|^perl\\(MLDB\\)|^perl\\(SQL::Statement\\)
error: Invalid macro syntax: %{?__requires_exclude|%__requires_exclude|}
error: Macro %__requires_exclude failed to expand

perl-File-FnMatch.spec
%global __provides_exclude %{%?__provides_exclude:__provides_exclude|}FnMatch.so
error: Invalid macro name: %{%?__provides_exclude:__provides_exclude|}
error: Macro %__provides_exclude failed to expand

perl-PlRPC.spec
%global __requires_exclude
%{?__requires_exclude|%__requires_exclude|}^perl\\(Net::Daemon\\)$
error: Invalid macro syntax: %{?__requires_exclude|%__requires_exclude|}
error: Macro %__requires_exclude failed to expand

perl-SystemC-Vregs.spec
%global __requires_exclude
%{?__requires_exclude?%__requires_exclude|}^perl\\(Verilog::Language\\)$
error: Invalid macro syntax: %{?__requires_exclude?%__requires_exclude|}
error: Macro %__requires_exclude failed to expand

perl-Tk-Getopt.spec
%global __requires_exclude
%{?__requires_exclude|%__requires_exclude|}^perl\\(Tk::PathEntry\\)
error: Invalid macro syntax: %{?__requires_exclude|%__requires_exclude|}
error: Macro %__requires_exclude failed to expand

php-pecl-imagick.spec
- Module install/uninstall actions surround with %%if
0%{?pecl_(un)?install:1} ... %%endif
error: Invalid macro syntax: %{?pecl_(un)?install:1}
error: line 158: - Module install/uninstall actions surround with %if 0

python-transifex.spec
rm -rf %{buildroot}%{python-sitelib}/transifex/tests
error: Invalid macro syntax: %{python-sitelib}
error: line 30: rm -rf
/usr/src/RPM/BUILDROOT/python-transifex-0.1.6-2.fc18.x86_64

spherical-cow-kde-theme.spec
Requires:       spherical-cow-backgrounds-kde >= %{backgrounds-kde-version}
error: Invalid macro syntax: %{backgrounds-kde-version}
error: line 19: Requires:       spherical-cow-backgrounds-kde >=


More information about the Rpm-list mailing list