On 12 June 2012 14:51, Tom Lane <t...@sss.pgh.pa.us> wrote:
> Edmund Horner <ejr...@gmail.com> writes:
>> On 12 June 2012 14:23, Tom Lane <t...@sss.pgh.pa.us> wrote:
>>> Hm, that patch seems to be several bricks shy of a load.  I 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.  Later 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=0x00000000, int leftjust=0, int
minlen=1, int maxwidth=0, int pointflag=0, PrintfTarget *
target=0x00000000)  Line 779 + 0x6 bytes        C
        pg_ctl.exe!dopr(PrintfTarget * target=0x0081f72c, const char *
format=0x0040b948, char * args=0x00000000)  Line 715 + 0x1c bytes       C
        pg_ctl.exe!pg_snprintf(char * str=0x0081fb5c, unsigned int
count=1024, const char * fmt=0x0040b948, ...)  Line 171 + 0x35 bytes    C
>       pg_ctl.exe!adjust_data_dir()  Line 1902 C
        pg_ctl.exe!main(int argc=2, char * * argv=0x00da4fe0)  Line 2189        
C
        pg_ctl.exe!__tmainCRTStartup()  Line 555 + 0x17 bytes   C
        kernel32.dll!7c817067()         
        [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_config);
1902    if ((fd = fopen(filename, "r")) == NULL)

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to