tsearch2 regression test failures

Started by Magnus Haganderabout 19 years ago8 messageshackers
Jump to latest
#1Magnus Hagander
magnus@hagander.net

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

Any pointers on where to start? ;)

//Magnus

Attachments:

regression.diffstext/plain; name=regression.diffsDownload+58-55
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#1)
Re: tsearch2 regression test failures

Magnus Hagander <magnus@hagander.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

#3Teodor Sigaev
teodor@sigaev.ru
In reply to: Tom Lane (#2)
Re: tsearch2 regression test failures

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@sigaev.ru
WWW: http://www.sigaev.ru/

Attachments:

ttttext/plain; name=tttDownload+6-6
#4Magnus Hagander
magnus@hagander.net
In reply to: Teodor Sigaev (#3)
Re: tsearch2 regression test failures

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@sigaev.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

#5Teodor Sigaev
teodor@sigaev.ru
In reply to: Magnus Hagander (#4)
Re: tsearch2 regression test failures

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@sigaev.ru
WWW: http://www.sigaev.ru/

#6Magnus Hagander
magnus@hagander.net
In reply to: Teodor Sigaev (#5)
Re: tsearch2 regression test failures

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

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Teodor Sigaev (#3)
Re: tsearch2 regression test failures

Teodor Sigaev <teodor@sigaev.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

#8Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#7)
Re: tsearch2 regression test failures

Tom Lane wrote:

Teodor Sigaev <teodor@sigaev.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