From Bugzilla Helper: User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.17-14 i686) After upgrading to rpm-4.0.2-7x from "Red Hat Updates", 'rpm -bb' started dumping core for most of my .spec files. Further investigation shows that this happens whenever the file contains a macro expansion with parameters, the most common being '%setup -n <directory>'. The crash does not occur when a parameterised macro is expanded without actually passing any parameters. Reproducible: Always Steps to Reproduce: 1. rpm -bb rpmCrash.spec (rpmCrash.spec will be attached to this report) Actual Results: Segmentation fault (core dumped) Expected Results: Wrote: /usr/src/redhat/RPMS/i386/ks-provoke-0-1ks.i386.rpm
Created attachment 15746 [details] .spec file that provokes crash
Created attachment 15747 [details] Core file produced by 'rpm -bb rpmCrash.spec'
Yup. Here's the patch (already fixed on the rpm-4_0 branch in CVS): Index: macro.c =================================================================== RCS file: /cvs/devel/rpm/rpmio/macro.c,v retrieving revision 2.53.2.6 retrieving revision 2.53.2.7 diff -u -r2.53.2.6 -r2.53.2.7 --- macro.c 2001/01/19 01:55:17 2.53.2.6 +++ macro.c 2001/03/23 16:18:12 2.53.2.7 @@ -801,7 +801,7 @@ /* Build argv array */ argv = (const char **) alloca((argc + 1) * sizeof(char *)); be[-1] = ' '; /* be - 1 == b + strlen(b) == buf + strlen(buf) */ - buf[0] = '\0'; + be[0] = '\0'; b = buf; for (c = 0; c < argc; c++) { argv[c] = b;
*** Bug 41089 has been marked as a duplicate of this bug. ***