bug in rpm spec parsing

Michal Moskal malekith at pld-linux.org
Wed Jul 16 22:26:08 CEST 2003


Could somebody subscribed forward this to rpm-list?

RPM fails to parse macros with names matching if* (or endif* and else*
for that matter) in some specific conditions.

The problem is that if line starts with "%if" (notice no blank after %if), 
it's treated as conditional.

Because of this bug (or feature?) %ifdef macro like:

  %ifdef()        %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}}

has chance to work. But it wouldn't have worked if it was called
%whendef or something like this.

I believe this should either documented or fixed. The offending code
is after build/parseSpec.c:281.

Example:

#v+
Summary:	.
Name:		test
Version:	1.0
Release:	1
License:	none
Group:		Applications
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%description

%prep
%define if_foo echo foo
%if 0
%if_foo
%endif
exit 0
#v-

[malekith at roke SPECS]$ rpmbuild test.spec 
error: Unclosed %if
[malekith at roke SPECS]$ 

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv
: When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h



More information about the pld-devel-en mailing list