Re: 9.2 beta2 - pg_ctl crashes on Win32 when neither PGDATA nor -D specified

Поиск
Список
Период
Сортировка
От Edmund Horner
Тема Re: 9.2 beta2 - pg_ctl crashes on Win32 when neither PGDATA nor -D specified
Дата
Msg-id CAMyN-kD12kDaZuyp-CY_ZeFd2+HoFmc+YXGRtpX=vy+VU=ygZw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: 9.2 beta2 - pg_ctl crashes on Win32 when neither PGDATA nor -D specified  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On 12 June 2012 14:51, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Edmund Horner <ejrh00@gmail.com> writes:
>> On 12 June 2012 14:23, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> Hm, that patch seems to be several bricks shy of a load. =A0I will fix
>>> two obvious bugs in it:
>>> (1) not dump core on boxes where printf("%s", NULL) dumps core;
>
>> I saw that, but I couldn't decide if it was the actual problem in my
>> case. =A0Later parts of adjust_data_dir appeared to be running (looking
>> at file system activity).
>
> The weird thing is that if it's not dumping core, the first fopen would
> presumably be trying to open "/postgresql.conf", which generally ought
> to fail and thus mask any problems in the rest of adjust_data_dir().
> Have you by any chance got a postgresql.conf laying about in your root
> directory?

I don't, and I couldn't see any file system requests for
postgresql.conf either (though I thought that might be because it's
failing to find a bogus parent path first e.g. something like
"(null)/postgresql.conf".  But I think it's just a problem in the
snprintf statements after all:

I've managed to run it in the MSVC debugger, using the packaged pdb
files.  So it does seem to be crashing on the first snprintf
statement.

     pg_ctl.exe!fmtstr(char * value=3D0x00000000, int leftjust=3D0, int
minlen=3D1, int maxwidth=3D0, int pointflag=3D0, PrintfTarget *
target=3D0x00000000)  Line 779 + 0x6 bytes    C
     pg_ctl.exe!dopr(PrintfTarget * target=3D0x0081f72c, const char *
format=3D0x0040b948, char * args=3D0x00000000)  Line 715 + 0x1c bytes    C
     pg_ctl.exe!pg_snprintf(char * str=3D0x0081fb5c, unsigned int
count=3D1024, const char * fmt=3D0x0040b948, ...)  Line 171 + 0x35 bytes    C
>    pg_ctl.exe!adjust_data_dir()  Line 1902    C
     pg_ctl.exe!main(int argc=3D2, char * * argv=3D0x00da4fe0)  Line 2189    C
     pg_ctl.exe!__tmainCRTStartup()  Line 555 + 0x17 bytes    C
     kernel32.dll!7c817067()=20=09
     [Frames below may be incorrect and/or missing, no symbols loaded for
kernel32.dll]

I'm not sure I can find the exact source version pg_ctl.c that was
compiled -- I get an off-by-one error around line 1902 using the
source from a few days ago.

1900    /* If there is no postgresql.conf, it can't be a config-only dir */
1901    snprintf(filename, sizeof(filename), "%s/postgresql.conf", pg_confi=
g);
1902    if ((fd =3D fopen(filename, "r")) =3D=3D NULL)

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 9.2 beta2 - pg_ctl crashes on Win32 when neither PGDATA nor -D specified
Следующее
От: Edmund Horner
Дата:
Сообщение: Re: PostgreSQL 9.2 beta1's pg_upgrade fails on Windows XP