Re: tsearch2 regression test failures

Lists: pgsql-hackers
From: Magnus Hagander <magnus(at)hagander(dot)net>
To: "Teodor Sigaev ;" <teodor(at)sigaev(dot)ru>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: tsearch2 regression test failures
Date: 2007-03-24 14:07:57
Message-ID: 460530BD.8030505@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

tsearch2 regression tests are also failing on win32/msvc, with attached
diffs.

Any pointers on where to start? ;)

//Magnus

Attachment Content-Type Size
regression.diffs text/plain 16.7 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch2 regression test failures
Date: 2007-03-26 00:44:30
Message-ID: 1503.1174869870@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> tsearch2 regression tests are also failing on win32/msvc, with attached
> diffs.
> Any pointers on where to start? ;)

FWIW, it looks like it failed to reject stopwords. Is it possible you
ran it in an environment that would make it pick the Russian stopword
list?

regards, tom lane


From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch2 regression test failures
Date: 2007-03-26 10:32:26
Message-ID: 4607A13A.5010804@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> FWIW, it looks like it failed to reject stopwords. Is it possible you
Right.

I suppose the problem is with '\r\n'... Try attached patch.
--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

Attachment Content-Type Size
ttt text/plain 558 bytes

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch2 regression test failures
Date: 2007-03-26 10:58:21
Message-ID: 20070326105821.GC1533@svr2.hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Mar 26, 2007 at 02:32:26PM +0400, Teodor Sigaev wrote:
> >FWIW, it looks like it failed to reject stopwords. Is it possible you
> Right.
>
> I suppose the problem is with '\r\n'... Try attached patch.
> --
> Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
> WWW:
> http://www.sigaev.ru/

> *** ./contrib/tsearch2/stopword.c.orig Mon Mar 26 14:25:16 2007
> --- ./contrib/tsearch2/stopword.c Mon Mar 26 14:28:25 2007
> ***************
> *** 47,53 ****
>
> while (fgets(buf, sizeof(buf), hin))
> {
> ! buf[strlen(buf) - 1] = '\0';
> pg_verifymbstr(buf, strlen(buf), false);
> if (*buf == '\0')
> continue;
> --- 47,57 ----
>
> while (fgets(buf, sizeof(buf), hin))
> {
> ! pbuf = buf;
> ! while( !isspace( *pbuf ) )
> ! pbuf++;
> ! *pbuf = '\0';
> !
> pg_verifymbstr(buf, strlen(buf), false);
> if (*buf == '\0')
> continue;

Yup, that solved the problem, thanks.

Wouldn't it be more efficiently written to walk the string backwards until
!isspace instead? Not sure that it matters at all, but then you'll
normallyi never step over more than two bytes...

//Magnus


From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch2 regression test failures
Date: 2007-03-26 11:10:05
Message-ID: 4607AA0D.907@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> Yup, that solved the problem, thanks.
I'll commit extended patch - there is one more place with the same bug.

> Wouldn't it be more efficiently written to walk the string backwards until
> !isspace instead? Not sure that it matters at all, but then you'll
> normallyi never step over more than two bytes...
It doesn't significant matter - file reads once per backend lifetime.

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/


From: "Magnus Hagander" <magnus(at)hagander(dot)net>
To: teodor(at)sigaev(dot)ru
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org
Subject: Re: tsearch2 regression test failures
Date: 2007-03-26 11:16:31
Message-ID: 20070326111642.D5FACDCC740@svr2.hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> > Yup, that solved the problem, thanks.> I'll commit extended patch - there is one more place with the same bug.

Ok, thanks.

> Wouldn't it be more efficiently written to walk the string backwards until
> > !isspace instead? Not sure that it matters at all, but then you'll
> > normallyi never step over more than two bytes...
> It doesn't significant matter - file reads once per backend lifetime.
>

ok.

/Magnus


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch2 regression test failures
Date: 2007-03-26 13:18:31
Message-ID: 15035.1174915111@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Teodor Sigaev <teodor(at)sigaev(dot)ru> writes:
> ! pbuf = buf;
> ! while( !isspace( *pbuf ) )
> ! pbuf++;
> ! *pbuf = '\0';

Surely the loop needs to look like

while (*pbuf && !isspace(*pbuf))
pbuf++;

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Teodor Sigaev <teodor(at)sigaev(dot)ru>, Magnus Hagander <magnus(at)hagander(dot)net>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: tsearch2 regression test failures
Date: 2007-03-26 13:35:28
Message-ID: 4607CC20.1020107@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Teodor Sigaev <teodor(at)sigaev(dot)ru> writes:
>
>> ! pbuf = buf;
>> ! while( !isspace( *pbuf ) )
>> ! pbuf++;
>> ! *pbuf = '\0';
>>
>
> Surely the loop needs to look like
>
> while (*pbuf && !isspace(*pbuf))
> pbuf++;
>
>
Yes.

But in any case, I am having difficulty in understanding why we are
seeing a CR at all - the file should be opened in text mode, which
should translate CR-LF in the file to a simple LF in the buffer. So
regardless of the odd behavior of CVSNT, which presumabye caused this
mess, it's rather strange.

Can someone please explain?

cheers

andrew