Re: [BUGS] BUG #2195: log_min_messages crash server when in DEBUG3 to

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Milen A(dot) Radev" <milen(at)radev(dot)net>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #2195: log_min_messages crash server when in DEBUG3 to
Date: 2006-01-31 21:20:55
Message-ID: 200601312120.k0VLKtO08488@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > The problem is that for EXEC_BACKEND, which is the default for WIN32 and
> > what I used for testing, progname is NULL because we do not set it after
> > the fork/exec. Most versions of printf report "(null)" for a null
> > argument to printf("%s"), but our port/snprintf.c version aborts, which
> > is probably better in terms of finding bugs.
>
> Good catch.
>
> > The attached patch fixes the problem by setting progname early in
> > main(), like we do for all other applications.
>
> It'd probably be best to strdup() argv[0], because of the likelihood
> that the argv area will get clobbered at some point by ps_status.c.
> It was OK to have a private static in postmaster.c, because the
> postmaster doesn't ever call ps_status.c, but if we are going to expose
> the variable in child processes it needs to be more globally valid.
>
> I see that get_progname strdup's its argument in some cases but not
> all --- so simplest fix is to make it always do so.

OK, new version that updates get_progname to always strdup().

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 4.7 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2006-01-31 21:54:24 Re: BUG #2220: PostgreSQL-JDBC 8.1-404 fails to compile with
Previous Message Michael Fuhr 2006-01-31 20:37:30 Re: BUG #2224: unlogical syntax error

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-01-31 21:42:22 Re: pg_restore COPY error handling
Previous Message Tom Lane 2006-01-31 20:26:03 Re: [BUGS] BUG #2195: log_min_messages crash server when in DEBUG3 to