Re: Requesting external_pid_file with postgres -C when not initialized lead to coredump

From: alain radix <alain(dot)radix(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Requesting external_pid_file with postgres -C when not initialized lead to coredump
Date: 2016-06-22 15:15:47
Message-ID: CA+YdpwxPUADrmxSD7+Td=uOshMB1KkDN7G7cf+FGmNjjxMhjbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yes Michael,

You're right, I aw this yesterday but couldn't make a patch.

Here is a new patch with postmaster.c modification so that it check about a
empty string instead of a null pointer.

The meaning is no more to avoid a core dump as you've done a change for
that but to have the same result with postgres -C as with a request to
pg_settings, an empty string when the parameter is not set.

It seems a lot better to me that different ways to request the same
parameter should return the same answer.

Actually, setting from a request to pg_settings an empty string in
postgresql.conf for external_pid_file would lead to an error for the
postmaster.

To values of parameter should be the same reported in pg_settings and
postgres -C and should be a valid settings in postgresql.conf
So, that if you create a postgresql.conf from pg_settings or postresql -C,,
it would would be a valid one.

So, the patch make an empty string valid in all places and shouldn't cause
problem with existing installations.

Regards.

Alain Radix

On 21 June 2016 at 23:45, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:

> On Wed, Jun 22, 2016 at 2:02 AM, Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
> > alain radix wrote:
> >> So, here is my first patch for PostgreSQL.
> >
> > Looking forward to further ones,
>
> A comment on this patch: this is an incorrect approach anyway.
> PostmasterMain relies on this value being NULL to decide if this PID
> file should be written or not, so this patch applied as-is would
> result in a message outputted to stderr if the logic is not changed
> there.
> --
> Michael
>

--
Alain Radix

Attachment Content-Type Size
external_pid_file.patch application/octet-stream 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-06-22 15:18:20 Re: Hash Indexes
Previous Message Robert Haas 2016-06-22 15:14:44 Re: Hash Indexes