Created attachment 688536 [details]
patch to correct the problem
In a spec file, under a %files section, add a %caps tag that uses a wildcard:
Then run `rpmbuild -ba SPECS/pkg.spec`
rpmbuild reliably crashes:
*** glibc detected *** rpmbuild: double free or corruption (fasttop): 0x0000000000691d30 ***
======= Backtrace: =========
#0 0x00007f6cdf0dc8a5 in raise () from /lib64/libc.so.6
#1 0x00007f6cdf0de085 in abort () from /lib64/libc.so.6
#2 0x00007f6cdf119fe7 in __libc_message () from /lib64/libc.so.6
#3 0x00007f6cdf11f916 in malloc_printerr () from /lib64/libc.so.6
#4 0x00007f6ce146c439 in rfree (ptr=<value optimized out>) at rpmmalloc.c:78
#5 0x00007f6ce1b164a0 in freeFileList (fileList=0x6cedb0, count=<value optimized out>)
#6 0x00007f6ce1b19eb9 in processPackageFiles (spec=<value optimized out>,_
pkg=<value optimized out>, installSpecialDoc=4, test=0) at files.c:1995
#7 0x00007f6ce1b1aeb7 in processBinaryFiles (spec=0x6439e0, installSpecialDoc=4, test=0)
#8 0x00007f6ce1b1548e in buildSpec (ts=0x643600, spec=0x6439e0, what=223, test=0) at build.c:257
#9 0x000000000040309a in buildForTarget (ts=0x643600, arg=<value optimized out>,_
ba=0x7f6ce1d37b80) at build.c:278
#10 0x0000000000403330 in build (ts=0x643600, arg=0x7fff315a8753 "SPECS/httpd.spec",_
ba=0x7f6ce1d37b80, rcfile=0x0) at build.c:312
#11 0x0000000000403de8 in main (argc=3, argv=<value optimized out>) at rpmqv.c:694
The problem is that a pointer to the caps definition is copied into the data structure for each file it applies to. freeFileList then tries to free this pointer repeatedly.
The attached patch corrects the problem by making a copy of the caps data for each file it applies to.
I thought that I should add that this bug is not limited to wildcards, and appears to a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=877512 (which is fixed in rawhide).
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release. Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.