Re: Current CVS tip segfaulting - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Current CVS tip segfaulting
Date
Msg-id 20040501170435.GC2333@dcc.uchile.cl
Whole thread Raw
In response to Re: Current CVS tip segfaulting  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Apr 30, 2004 at 11:36:36PM -0400, Tom Lane wrote:
> Alvaro Herrera Munoz <alvherre@dcc.uchile.cl> writes:
> > strace'ing the postmaster suggested me that the dbname string in
> > utils/init/postinit.c, the InitPostgres function, is the culprit.
> > In fact, if I apply the following patch to tcop/postgres.c the
> > whole thing stops happening.
> 
> >         else if (argc - optind == 1)
> > !           dbname = argv[optind];
> > ...
> >         else if (argc - optind == 1)
> > !           dbname = pstrdup(argv[optind]);
> 
> Surely this is a red herring --- that code path does not even execute
> except in the case of a standalone backend.

Yes, I figured that out later (the normal path uses -p instead).  In
fact I then took out the pstrdup() and the fault wasn't happening; so I
recompiled all over again, without the pstrdup and it was back.

I think maybe there's something clobbering argv.  I thought about
tracing that with gdb but never got to it.  I will do that now and
report back.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El miedo atento y previsor es la madre de la seguridad" (E. Burke)


pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: Plan for feature freeze?
Next
From: Alvaro Herrera
Date:
Subject: Re: Weird prepared stmt behavior