[Rpm-maint] Macro change while expanding the macro itself

Panu Matilainen pmatilai at laiskiainen.org
Wed May 18 06:19:36 UTC 2011

On 05/17/2011 04:27 PM, Michael Schroeder wrote:
> And another patch to be discussed. We've got an esotheric macro
> usage that deletes its own definition while it is expanded.
> Here's a demo:
> $ cat ~/.rpmmacros
> %package %?_suse_insert_debug_package%%package
> %_suse_insert_debug_package \
>    %undefine _suse_insert_debug_package \
>    %debug_package
> $ rpm --eval %package
>    %debug_packag%package
> For some reason this worked in rpm-4.8 (probably because of a
> memory leak). I guess it was also broken if the macro is changed
> instead of the %undefine.
> Anyway, this should either work or procuce an error. Currently
> it accesses already freed memory, which is bad.
> A small patch to make it work is attached.

Nice catch, thanks! Applied.

The regression comes from the false assumption in this commit I think:

This will make for a fun additional test-case as well.

	- Panu -

More information about the Rpm-maint mailing list