Bug 1475439 - RPM build errors: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.
Summary: RPM build errors: Too many levels of recursion in macro expansion. It is ...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: redhat-rpm-config
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Florian Festi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1482509 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-26 16:59 UTC by udo
Modified: 2017-08-21 13:19 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-29 06:34:38 UTC
Type: Bug


Attachments (Terms of Use)

Description udo 2017-07-26 16:59:13 UTC
Description of problem:
SPEC files that worked perfectly well with a Fedora 24 environment give errors like in the summary after upgrading to fedora 26.

Version-Release number of selected component (if applicable):
rpm-build-4.13.0.1-5.fc26.x86_64

How reproducible:
Upgrade to Fedora 26.
Try to build mythtv from git source using the packaging https://github.com/MythTV/packaging system

Actual results:
SPEC files give us:
RPM build errors:     Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.

Expected results:
No such messages, proper executed build.

Additional info:

Comment 1 Igor Gnatenko 2017-07-26 17:46:31 UTC
Please write exact steps how to reproduce.

Comment 2 udo 2017-07-27 02:41:05 UTC
have MythTV git in /usr/src/mythtv, branch fixes/0.27
have packaging git in /usr/src/packaging, branch fixes/0.27
enter /usr/src/packaging/rpm
run buildmyth


[root@recorder src]# cd packaging/rpm/
[root@recorder rpm]# ./build_myth.sh 
Fetching latest information from git repository.
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 8 (delta 3), reused 8 (delta 3), pack-reused 0
Unpacking objects: 100% (8/8), done.
From git://github.com/MythTV/mythtv
   b2a2ccf5c2..4381e686c4  fixes/29   -> origin/fixes/29
Building 0.27.6.1 (latest revision)
Updating mythtv.spec _gitver to 0.27.6.1
Updating mythweb.spec _gitver to 0.27.6.1
Creating tarball from git clones at /usr/src/mythtv
/usr/src/packaging/rpm/mythtv/mythweb-0.27.6.tar.bz2
warning: bogus date in %changelog: Wed Mar 12 2012 Chris Petersen <cpetersen@mythtv.org> 0.25-0.1.git
warning: bogus date in %changelog: Sun Mar 03 2012 Chris Petersen <cpetersen@mythtv.org> 0.25-0.1.git
error: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.
error: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.XqhvCd
/var/tmp/rpm-tmp.XqhvCd: line 5: unexpected EOF while looking for matching `"'
error: Bad exit status from /var/tmp/rpm-tmp.XqhvCd (%prep)


RPM build errors:
    bogus date in %changelog: Wed Mar 12 2012 Chris Petersen <cpetersen@mythtv.org> 0.25-0.1.git
    bogus date in %changelog: Sun Mar 03 2012 Chris Petersen <cpetersen@mythtv.org> 0.25-0.1.git
    Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.
    Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.
    Bad exit status from /var/tmp/rpm-tmp.XqhvCd (%prep)

real	0m0,039s
user	0m0,028s
sys	0m0,004s
MythWeb build error.
Creating tarballs from git clones at /usr/src/mythtv
/usr/src/packaging/rpm/mythtv/mythtv-0.27.6.tar.bz2
/usr/src/packaging/rpm/mythtv/mythplugins-0.27.6.tar.bz2
error: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.
error: line 967:     --extra-cflags="%{optflags} -fomit-frame-pointer" \
    --extra-cxxflags="%{optflags} -fomit-frame-pointer" \
%endif


real	0m0,071s
user	0m0,036s
sys	0m0,004s
MythTV build error.
[root@recorder rpm]# 

[root@recorder packaging]# cat /var/tmp/rpm-tmp.XqhvCd
#!/bin/sh

  RPM_SOURCE_DIR="/usr/src/packaging/rpm/mythtv"
  RPM_BUILD_DIR="/root/rpmbuild/BUILD"
  RPM_OPT_FLAGS="-march=k8 -mtune=k8 -msse -msse2 -msse3 -m3dnow -march=k8 -mtune=k8 -msse -msse2 -msse3 -m3dnow -march=k8 -mtune=k8 -msse -msse2 -msse3 -m3dnow -march=k8 -mtune=k8 -msse -msse2 -msse3 -m3dnow -march=k8 -mtune=k8 -msse -msse2 -msse3 -m3dnow -march=k8 -mtune=k8 -msse -msse2 -msse3 -m3dnow cd '/root/rpmbuild/BUILD'
rm -rf 'mythweb-0.27.6'
/usr/bin/mkdir -p mythweb-0.27.6
cd 'mythweb-0.27.6'
/usr/bin/bzip2 -dc '/usr/src/packaging/rpm/mythtv/mythweb-0.27.6.tar.bz2' | /usr/bin/tar -xof - 
STATUS=$?
if [ $STATUS -ne 0 ]; then
  exit $STATUS
fi
/usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .

# Delete any git control files
    find . -name .git\* -exec rm {} \+

# Fix up permissions for MythWeb
    chmod -R g-w mythweb/*

# Remove unwanted execute bits from php mythweb files
    find mythweb/ -name '*.php' -exec chmod -x {} \+


################################################################################

exit 0[root@recorder packaging]#


Notice missing quotation near the end of the RPM_OPT_FLAGS line.

Comment 3 Igor Gnatenko 2017-07-27 20:57:07 UTC
I can't reproduce this. rpmspec -P doesn't fail here.

moreover, requiring developer to review many thousands of lines of some 3rd-party broken spec file and cloning 323.46 MiB git repository and installing gazillions of dependencies is not really good thing.

Please report this bug to MythTV developers.

Comment 4 udo 2017-07-28 02:36:40 UTC
I see:
[root@recorder rpm]# rpmspec -P mythtv.spec 
error: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.
error: line 967:     --extra-cflags="%{optflags} -fomit-frame-pointer" \
    --extra-cxxflags="%{optflags} -fomit-frame-pointer" \
%endif

So what is causing this?
What files can I check and what should I look for?
What did change with the upgrade that could influence this?

Comment 5 udo 2017-07-28 02:37:40 UTC
Also:

[root@recorder rpm]# rpmspec -P mythweb.spec 
warning: bogus date in %changelog: Wed Mar 12 2012 Chris Petersen <cpetersen@mythtv.org> 0.25-0.1.git
warning: bogus date in %changelog: Sun Mar 03 2012 Chris Petersen <cpetersen@mythtv.org> 0.25-0.1.git
error: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.

Comment 6 Igor Gnatenko 2017-07-28 04:49:19 UTC
(In reply to udo from comment #4)
> I see:
> [root@recorder rpm]# rpmspec -P mythtv.spec 
> error: Too many levels of recursion in macro expansion. It is likely caused
> by recursive macro declaration.
> error: line 967:     --extra-cflags="%{optflags} -fomit-frame-pointer" \
>     --extra-cxxflags="%{optflags} -fomit-frame-pointer" \
> %endif
> 
> So what is causing this?
No idea.
> What files can I check and what should I look for?
*.spec
> What did change with the upgrade that could influence this?
Fedora might started defining some new macro which doesn't play with %define well, but works with %global.

(In reply to udo from comment #5)
> Also:
> 
> [root@recorder rpm]# rpmspec -P mythweb.spec 
> warning: bogus date in %changelog: Wed Mar 12 2012 Chris Petersen
> <cpetersen@mythtv.org> 0.25-0.1.git
> warning: bogus date in %changelog: Sun Mar 03 2012 Chris Petersen
> <cpetersen@mythtv.org> 0.25-0.1.git
> error: Too many levels of recursion in macro expansion. It is likely caused
> by recursive macro declaration.

It is MythTV bug.

Comment 7 udo 2017-07-28 04:52:29 UTC
FWIW:
[root@recorder rpm]# rpm -qa|grep ^rpm|while read a; do
> rpm -V $a
> done
[root@recorder rpm]# 

This shows that all rpm-related rpms (and a few 'extra' ones) are unmodified on this box and are installed as intended.
Right?

Comment 8 Igor Gnatenko 2017-07-28 04:54:35 UTC
(In reply to udo from comment #7)
> FWIW:
> [root@recorder rpm]# rpm -qa|grep ^rpm|while read a; do
> > rpm -V $a
> > done
> [root@recorder rpm]# 
> 
> This shows that all rpm-related rpms (and a few 'extra' ones) are unmodified
> on this box and are installed as intended.
> Right?

Yes, and please stop re-opening bug. This is not support forum.

Comment 9 udo 2017-07-28 04:58:19 UTC
Furthermore, w.r.t. your %global suggestion, after replacing %define by %global:

[root@recorder rpm]# grep define mythweb.spec
[root@recorder rpm]# rpmspec -q -v mythweb.spec 
error: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.
mythweb-0.27.6-0.1.git.1.fc26.x86_64
mythweb-debuginfo-0.27.6-0.1.git.1.fc26.x86_64

So I see no change here.

Comment 10 Igor Gnatenko 2017-07-28 04:59:21 UTC
Report this bug to upstream.

Comment 11 udo 2017-07-28 05:03:49 UTC
Isn't rpm a redhat product?

Comment 12 Igor Gnatenko 2017-07-28 05:04:39 UTC
(In reply to udo from comment #11)
> Isn't rpm a redhat product?

MythTV is not part of Fedora.

Comment 13 udo 2017-07-28 05:14:17 UTC
We are looking at the spec files. Not at the source tree.
Nothing more about MythTV.
You suggested, without real explanation, that %define should be replaced by %global.
So I did that.
And the rpmspec still complains.

I did not change MyhthTV source while I upgraded to Fedora 26.
So the change must be in Fedora.
When things start functioning differently, or perhaps stop functioning completely, by such an upgrade, how to contact rpm upstream?
Isn't redhat the rpm developer?

Comment 14 udo 2017-07-29 02:59:40 UTC
[root@recorder ~]# cat .rpmrc 
#
#optflags: x86_64 %{__global_cflags} -m64 -mtune=nocona
optflags: x86_64 -march=k8 -mtune=k8 -msse -msse2 -msse3 -m3dnow %{__global_cflags} -m64 

[root@recorder ~]# mv .rpmrc rpmrc
[root@recorder ~]# cd /usr/src/packaging/rpm/
[root@recorder rpm]# rpmspec -q mythweb.spec 
mythweb-0.27.6-0.1.git.1.fc26.x86_64
mythweb-debuginfo-0.27.6-0.1.git.1.fc26.x86_64
[root@recorder rpm]# 

I.e.: no error.
So what is wrong about the config in .rpmrc?
It used to work very well for years.

Comment 15 udo 2017-07-29 05:08:49 UTC
In /usr/lib/rpm/redhat/macros we find:

 %__global_cflags        %{optflags}

That explains the recursion.
But it does not explain the change here; the .rpmrc has worked well for years and redhat/fedora/rpm-dev/... changed the macros.

So yes the problem was caused by redhat/fedora/rpm-dev/... .

Why didn't you ask me about rpm configuration?

Comment 16 Igor Gnatenko 2017-07-29 06:34:38 UTC
(In reply to udo from comment #15)
> In /usr/lib/rpm/redhat/macros we find:
> 
>  %__global_cflags        %{optflags}
> 
> That explains the recursion.
> But it does not explain the change here; the .rpmrc has worked well for
> years and redhat/fedora/rpm-dev/... changed the macros.
> 
> So yes the problem was caused by redhat/fedora/rpm-dev/... .
> 
> Why didn't you ask me about rpm configuration?
Because this is not support forum.

There is clearly no bug in here. Macros are changing over the time, it is expected. If this breaks your local configuration, it is not problem of RPM.

Comment 17 udo 2017-07-29 10:02:14 UTC
It /is/ a bug, in multiple ways:
- Nobody asked or consulted me about this change (duh! I am as unreachable as the fedora thing)
- You did not explain this change
- You did not ask me about any local config besides the contents of the (verified!) rpms to help solve the issue
- You wrote it was mythtv
- You gave me a hard time by all this.

And then I find a but about reorganizing them cflags stuff: https://bugzilla.redhat.com/show_bug.cgi?id=1393492
So yes it as a mess (see above) and yes the mess comes with a mess in solving all this.

Comment 18 Panu Matilainen 2017-08-21 13:19:45 UTC
*** Bug 1482509 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.