pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jorge Gustavo Rocha <jgr@geomaster.pt>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2
Date: Thu, 20 Jun 2019 12:12:18 +0900
Message-ID: <20190620031218.GC2660@paquier.xyz> (raw)
In-Reply-To: <23215.1560977098@sss.pgh.pa.us>
References: <15827-e6ba53a3a7ed543c@postgresql.org>
	<82491.1559409563@sss.pgh.pa.us>
	<e12a23c6-5e00-3fa6-6179-681336130361@geomaster.pt>
	<1473.1560866085@sss.pgh.pa.us>
	<fcb5c34c-cf5f-6dc9-c68e-6b297f073b79@geomaster.pt>
	<CA+mi_8aBnLKypX2Ttksg8JEhApBo=JpF6P_STQGp-FOvDpn6Yw@mail.gmail.com>
	<81d9d421-6947-7111-a1dc-cfd99cd3ae53@geomaster.pt>
	<23215.1560977098@sss.pgh.pa.us>

On Wed, Jun 19, 2019 at 04:44:58PM -0400, Tom Lane wrote:
> Ah-hah!  That explains much.  So a non-invasive fix would be to force
> parseServiceFile to open the file in text mode; I think this would
> work for that:
> 
> -	f = fopen(serviceFile, "r");
> +	f = fopen(serviceFile, "rt");
> 
> I don't think that that's really a good solution, because it does little
> to prevent the same problem from reappearing elsewhere.  But if we wanted
> the smallest possible fix that might do.

Actually I think that something like 40cfe86 may be a solution to look
at (combined with 0ba06e0 except for the portions enforcing the text
flags like in initdb).  This stuff found its way only in 12~, but
having us switching to the concurrent-safe version for fopen() that we
bundle in port/ has the advantage to take care of this issue, because
on HEAD, if 'b' or 't' are not defined, then we enforce to text mode.
Still back-patching that is sensitive and we have known that hard last
year..

The discussion here is on 10, and the password file has does not
enforce the flag either because it filters '\r' by itself.  So another
solution may be to do the same thing as what's done in
passwordFromFile()?
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../20190620031218.GC2660@paquier.xyz/2-signature.asc)
  download

view thread (23+ messages)  latest in thread

Message-ID: <20190620031218.GC2660@paquier.xyz>
Permalink:  ../20190620031218.GC2660@paquier.xyz/
Also on:    postgresql.org/message-id/20190620031218.GC2660@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, tgl@sss.pgh.pa.us, jgr@geomaster.pt, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2
  In-Reply-To: <20190620031218.GC2660@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox