Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, robertmhaas(at)gmail(dot)com, kondo(at)sraoss(dot)co(dot)jp, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')
Date: 2015-10-27 07:20:24
Message-ID: 20151027072024.GA683077@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Oct 26, 2015 at 09:54:03AM +0900, Tatsuo Ishii wrote:
> > Kondo's design is correct.
>
> So more proper fix looks like this?

> + /* If postmaster is listening on "*", "0.0.0.0" or "::", use 127.0.0.1 */
> + if (strcmp(host_str, "*") == 0 ||
> + strcmp(host_str, "0.0.0.0") == 0 ||
> + strcmp(host_str, "::") == 0)
> + strcpy(host_str, "127.0.0.1");

No, PQping("host='127.0.0.1'") fails to reach a listen_addresses='::' server
on many systems. Here's what I thought Kondo was proposing:

--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -649,5 +649,9 @@ test_postmaster_connection(pgpid_t pm_pid, bool do_checkpoint)

- /* If postmaster is listening on "*", use localhost */
+ /* explanation here */
if (strcmp(host_str, "*") == 0)
strcpy(host_str, "localhost");
+ else if (strcmp(host_str, "0.0.0.0") == 0)
+ strcpy(host_str, "127.0.0.1");
+ else if (strcmp(host_str, "::") == 0)
+ strcpy(host_str, "::1");

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tatsuo Ishii 2015-10-27 08:30:36 Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::')
Previous Message Tom Lane 2015-10-26 22:33:50 Re: BUG #13735: pg_get_serial_sequence can be incorrect

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2015-10-27 07:26:48 Re: Getting sorted data from foreign server
Previous Message Heikki Linnakangas 2015-10-27 06:59:00 Re: TODO list updates