Re: [GENERAL] PG crash on simple query, story continues

Поиск
Список
Период
Сортировка
От Maksim Likharev
Тема Re: [GENERAL] PG crash on simple query, story continues
Дата
Msg-id 56510AAEF435D240958D1CE8C6B1770A016D2DB0@mailc03.aurigin.com
обсуждение исходный текст
Ответы Re: [GENERAL] PG crash on simple query, story continues  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
So following modification seems to fixed all PG (7.3/7.3.3)crashes on
Solaris ( NON C LOCALE )

selfuncs.c line 2356:

I changed:
xfrmsize = strlen(val) + 32;    /*arbitrary pad value here...*/
to
xfrmsize = strxfrm(NULL, val, 0) + 32;

so basically instead of wild guess of transformed string size I asking
"strxfrm" for that.

+32 out my desperation, strxfrm(NULL, val, 0) + 1 should be fine ( have
not tested that )...

Out of curiosity:
Really interesting, following condition seems to be impossible anymore,
of cause if something went terribly wrong,

die here, return original string, return empty string?

if (xfrmlen >= xfrmsize) {
    pfree(xfrmstr);
    xfrmstr = (char *) palloc(xfrmlen + 1);
    xfrmlen = strxfrm(xfrmstr, val, xfrmlen + 1);
}


Again fixed all crashes on Sun 5.8 ( PG 7.3.3, en_US locale, LATIN1
encoding )  Generic Patch...

P.S
NO SUPPORT, NO WARRANTY, NO NOTHING, just for you information.

Regards.

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Tuesday, July 08, 2003 3:58 PM
To: Maksim Likharev
Cc: pgsql-general@postgresql.org; pgsql-hackers@postgresql.org
Subject: Re: [GENERAL] PG crash on simple query, story continues


"Maksim Likharev" <mlikharev@aurigin.com> writes:
>      On failure, strxfrm() returns (size_t)-1.

Not according to the Single Unix Specification, Linux, or HP-UX;
I don't have any others to check.  But anyway, that is not causing
your problem, since palloc(0) would complain not dump core.

> I am on SunOS 5.8,

Solaris, eh?  IIRC, it was Solaris that we last heard about broken
strxfrm on.  Better check to see if Sun has a fix for this.

            regards, tom lane

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Enke, Michael"
Дата:
Сообщение: Re: again: Bug #943: Server-Encoding from
Следующее
От: Tom Lane
Дата:
Сообщение: Re: table-level and row-level locks.