On Tue, Jun 10, 2008 at 8:29 PM, Jeff Johnson <n3npq@mac.com> wrote:
>
> On Jun 7, 2008, at 1:15 PM, Dan Nicholson wrote:
>
>> On Sat, Jun 7, 2008 at 12:00 AM, Ralf S. Engelschall
>> <rse+rpm-devel@rpm5.org> wrote:
>>>
>>> I cannot reproduce this under OpenPKG's RPM 5.1.2 and on a FreeBSD
>>> platform, too:
>>>
>>> | $ openpkg rpm --version
>>> | rpm (OpenPKG RPM) 5.1.2
>>> | $ openpkg rpm -q perl
>>> | perl-5.10.0-20080413
>>> | $ openpkg rpm -q perl-util
>>> | perl-util-5.10.0-20080528
>>
>> The issue occurs when querying for an _uninstalled_ package with the
>> same name prefix. So, in your case, probably searching for "perl-foo"
>> would be a good test.
>>
>
> Ah, this patch will likely fix your segfault:
>
> Index: mire.c
> ===================================================================
> RCS file: /v/rpm/cvs/rpm/rpmio/mire.c,v
> retrieving revision 1.41
> diff -u -b -B -w -p -r1.41 mire.c
> --- mire.c 12 Mar 2008 19:41:13 -0000 1.41
> +++ mire.c 11 Jun 2008 03:18:52 -0000
> @@ -350,7 +350,6 @@ int mireRegcomp(miRE mire, const char *
> mire->pattern = xstrdup(pattern);
>
> switch (mire->mode) {
> - case RPMMIRE_DEFAULT:
> case RPMMIRE_STRCMP:
> break;
> case RPMMIRE_PCRE:
> @@ -372,6 +371,7 @@ int mireRegcomp(miRE mire, const char *
> rc = -99;
> #endif
> break;
> + case RPMMIRE_DEFAULT:
> case RPMMIRE_REGEX:
> mire->preg = xcalloc(1, sizeof(*mire->preg));
> if (mire->cflags == 0)
>
>
> The underlying issue is what type of match should be attached
> to RPMMIRE_DEFAULT. I can tell from the constructed "^foo$"
> pattern that a RE is being attempted. However, at some point
> I changed my mind and decided that an RE was overkill when
> only a strcmp(3) is needed. However the odd case of querying
> non-existent uninstalled packages never got found until now.
>
> The other, better, way to fix is what I will likely check-in tomorrow,
> mapping RPMMIRE_DEFAULT onto a strcmp as I intended,
> and changing the code in rpmdb/rpmdb.c to not bother building
> the "^foo$" RE.
>
> Apologies for not finding the issue sooner.
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.
The issue can be boiled down to just using tmire. Here's output
building rpm with --as-needed + your patch (same as without your
patch):
$ echo foo | ./tmire --strcmp .
$ echo foo | ./tmire --regex .
Segmentation fault
$ echo foo | ./tmire --fnmatch .
$ echo foo | ./tmire --pcre .
foo
Here's output building without --as-needed + your patch:
$ echo foo | ./tmire --strcmp .
$ echo foo | ./tmire --regex .
foo
$ echo foo | ./tmire --fnmatch .
$ echo foo | ./tmire --pcre .
foo
So, your patch might be the right behavior, but my actual segfault is
coming from somewhere else. I'll just shut off --as-needed for now.
--
Dan
Received on Wed Jun 11 05:56:59 2008