On Tue, Jun 10, 2008 at 8:56 PM, Dan Nicholson <dbn.lists@gmail.com> wrote:
>
> Thanks for the patch, but I just figured out today that the issue came
> down to the use of -Wl,--as-needed. I can't determine where the issue
> is, but I have a hunch it has something to do with attempting to build
> with pcreposix but actually having glibc's regex being used. The
> segfault only seems to be triggered when using RPMMIRE_REGEX.
And now I've come upon this old thread:
http://rpm5.org/community/rpm-devel/1554.html
This is definitely the problem. When --as-needed is used, libc is
bound first to tmire, causing regcomp and friends to be resolved
through libc rather than libpcreposix.
$ readelf -d tmire-as-needed | grep pcreposix
$ ldd tmire-as-needed | grep -e libc.so -e pcreposix
libc.so.6 => /lib/libc.so.6 (0xb7d79000)
libpcreposix.so.0 => /usr/lib/libpcreposix.so.0 (0xb7c74000)
$ LD_PRELOAD=libpcreposix.so ldd ./tmire-as-needed | grep -e libc.so
-e pcreposix
libpcreposix.so => /usr/lib/libpcreposix.so (0xb7fb9000)
libc.so.6 => /lib/libc.so.6 (0xb7df8000)
$ readelf -d tmire-no-as-needed | grep pcreposix
0x00000001 (NEEDED) Shared library: [libpcreposix.so.0]
$ ldd tmire-no-as-needed | grep -e libc.so -e pcreposix
libpcreposix.so.0 => /usr/lib/libpcreposix.so.0 (0xb7ddc000)
libc.so.6 => /lib/libc.so.6 (0xb79a8000)
$ echo foo | ./tmire-as-needed .
Segmentation fault
$ echo foo | ./tmire-no-as-needed .
foo
$ echo foo | LD_PRELOAD=libpcreposix.so ./tmire-as-needed .
foo
--
Dan
Received on Wed Jun 11 09:00:42 2008