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

Michael Schroeder mls at suse.de
Tue May 17 13:27:43 UTC 2011


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.

Cheers,
  Michael.

-- 
Michael Schroeder                                   mls at suse.de
SUSE LINUX Products GmbH,  GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: safemacro.diff
Type: text/x-patch
Size: 623 bytes
Desc: not available
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20110517/9a18e527/attachment.bin>


More information about the Rpm-maint mailing list