Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zqya0-0002BU-Bq for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Oct 2015 07:22:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZqyZy-00032h-Px for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Oct 2015 07:21:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZqyYf-0001Z9-Dp for pgsql-hackers@postgresql.org; Tue, 27 Oct 2015 07:20:37 +0000 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZqyYY-0001X6-G8 for pgsql-hackers@postgresql.org; Tue, 27 Oct 2015 07:20:36 +0000 Received: by padhk11 with SMTP id hk11so214186819pad.1 for ; Tue, 27 Oct 2015 00:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=4adlFfSSJirdwDHnlKu2UBrQNVnsB43p7BAT2QwY/IQ=; b=Yytd0eHtkEfDPAgXAXLo0KDsM+WEND8jXBlnz9KAUG888HS/4E+Iha5957H+d3zRUC BiaWsOHfQnsnrTf0El5gru9t1V27RZs9Je5Fh2H3Ccq6oRyyVavG7SGTP91Xv9l4lFve 10bwQuLl6noQAQotyFGLMBaKbYWZ8HbwNy49Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=4adlFfSSJirdwDHnlKu2UBrQNVnsB43p7BAT2QwY/IQ=; b=IWGr9tj3YgRdomqSKuGVKwHZRJlqBynmDzbabFNVFHZbSX7TRYAd0z4JKpbKU6HskU WTTJBmEdwfV5T8bL19aXT7eiBPF3sHbWcev4sSB8Iv7ZBfMoKZHpSIsZ+VC6iehVWbm8 dfjBmMdDcAnAKuJvTjwVsFvDYQPz276ar+FWzimpMX2gCm7vzYO2loRvXS7QHSAow9j2 d6kPdnwGU+V7wqNApzZTpOBGTSqRRNv3ypD2sa7VAeCPFVqlGUu2BT8MFbL7JXrBygT2 ISMG2TmQeTinCrQcSQMNI3JcGWuxA/Sq5cCy0qLrGoyjWfU4hUQcB4eqgAvwOpZjsMbz xGig== X-Gm-Message-State: ALoCoQnLJR9nFx78CYXjDt9hQ25eJJj4JREOa+QWYTdXNnELenAbS9eY+sFLa6u2qvGS25F36P4F X-Received: by 10.66.156.169 with SMTP id wf9mr26035344pab.91.1445930427744; Tue, 27 Oct 2015 00:20:27 -0700 (PDT) Received: from tornado.leadboat.com (c-98-248-47-228.hsd1.ca.comcast.net. [98.248.47.228]) by smtp.gmail.com with ESMTPSA id ug4sm37843520pac.11.2015.10.27.00.20.26 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Oct 2015 00:20:26 -0700 (PDT) Date: Tue, 27 Oct 2015 03:20:24 -0400 From: Noah Misch To: Tatsuo Ishii Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, kondo@sraoss.co.jp, pgsql-hackers@postgresql.org Subject: Re: Re: [BUGS] BUG #13611: test_postmaster_connection failed (Windows, listen_addresses = '0.0.0.0' or '::') Message-ID: <20151027072024.GA683077@tornado.leadboat.com> References: <20151023005147.GA403745@tornado.leadboat.com> <55164.1445569167@sss.pgh.pa.us> <20151024031036.GB421105@tornado.leadboat.com> <20151026.095403.804552198762060224.t-ishii@sraoss.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151026.095403.804552198762060224.t-ishii@sraoss.co.jp> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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"); -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers