rpmbuild fails on nested user-defined %if* macros

Mike Miller mtmiller at ieee.org
Tue Oct 2 02:44:56 UTC 2012

Hi, a regression has come up between rpmbuild 4.9 and 4.10 and I want to
know if this was intentional or not. Here is an artificial test-case
spec file that illustrates the regression:

%define if_some_value() %{expand:%if "%{_some_value}" == "%1" || "%{_some_value}" == "%2"}
Summary: Test case spec file for LP #1058378
Name: test-pkg
Version: 1.0.0
Release: 1
License: GPL
Group: Development/Languages
Test case spec file for LP #1058378
%if_some_value foo bar
echo first case
%if_some_value shibboleet
echo second case
echo third case

If the first conditional is false, there is no problem. If the first
conditional is true (e.g. rpmbuild -D"_some_value foo"), rpmbuild 4.9
succeeds but 4.10 fails with

error: /home/mike/lp-1058378.spec:19: Got a %endif with no %if

So it looks to me like user-defined %if* macros are supported, but not
if one appears in the false branch of a conditional. I think this commit


is responsible for the change in behavior that produces this error, but
I'm not sure if the intention was to continue supporting such
user-defined %if* macros or not. Can someone clarify? Thanks.

Original bug report: https://bugs.launchpad.net/bugs/1058378


More information about the Rpm-list mailing list