Skip to content

Too many levels of recursion in macro expansion error when calling Specfile.update_version() #402

@nforro

Description

@nforro

Trivial reproducer:

# recursive macro definition
%global cflags "-O3 %{cflags}"

Name:           test
Version:        0.1
Release:        %autorelease
Summary:        Test package

License:        MIT

%description
Test package

%changelog
%autochangelog
spec = Specfile("test.spec")
spec.update_version("0.2")

This raises specfile.exceptions.RPMException: Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration..

A workaround is to define the macro (even to an empty value):

spec = Specfile("test.spec", macros=[("cflags", "")])
spec.update_version("0.2")

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/fedoraRelated to Fedora ecosystemcomplexity/single-taskRegular task; should be done within daysgain/lowDoesn't bring much value to usersimpact/lowAffects only few of the userskind/bugAn unexpected problem or behaviorworkaround-existsThere is a workaround that can be used in the meantime

    Type

    No type

    Projects

    Status

    backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions