Segmentation fault with postgres -C external_pid_file - Mailing list pgsql-bugs

From Jehan-Guillaume de Rorthais
Subject Segmentation fault with postgres -C external_pid_file
Date
Msg-id 20160615204036.2d35d86a@firost
Whole thread Raw
Responses Re: Segmentation fault with postgres -C external_pid_file  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-bugs
Hello,

I just found that the following command always produce a segmentation fault
when external_pid_file is kept commented:

  $ postgres -C external_pid_file
  Segmentation fault (core dumped)


Here is the full backtrace from the core file using 9.5.3:

  (gdb) bt full
  #0  strlen () at ../sysdeps/x86_64/strlen.S:106
  No locals.
  #1  0x00007fe0f397e99c in _IO_puts (str=0x0) at ioputs.c:36
        result = -1
        len = <optimized out>
  #2  0x0000000000643dc6 in PostmasterMain (argc=argc@entry=3,
  argv=argv@entry=0x297c170) at postmaster.c:827
        opt = <optimized out>
        status = <optimized out>
        userDoption = 0x0
        listen_addr_saved = 0 '\000'
        i = <optimized out>
        output_config_variable = 0x2997c90 "external_pid_file"
        __func__ = "PostmasterMain"
  #3  0x000000000046a377 in main (argc=3, argv=0x297c170) at main.c:228
  No locals.


This has been tested only with 9.5 and 9.4.

The following simple patch seems to fix this bug:

  diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
  index f249b390..0362555 100644
  --- a/src/backend/utils/misc/guc.c
  +++ b/src/backend/utils/misc/guc.c
  @@ -3269,7 +3269,7 @@ static struct config_string ConfigureNamesString[] =
                          GUC_SUPERUSER_ONLY
                  },
                  &external_pid_file,
  -               NULL,
  +               "",
                  check_canonical_path, NULL, NULL
          },


Regards,
--
Jehan-Guillaume de Rorthais
Dalibo

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #14192: pg_dump/pg_restore omit setting search_path in restored db
Next
From: Ranier VF
Date:
Subject: Use after free? in fe-connect.c:closePGconn