Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdnVo-0004r2-7k for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Jun 2019 03:13:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hdnVl-0007yq-Ts for pgsql-bugs@arkaria.postgresql.org; Thu, 20 Jun 2019 03:13:17 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdnVl-0007ye-Ex for pgsql-bugs@lists.postgresql.org; Thu, 20 Jun 2019 03:13:17 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hdnVi-00052B-Kd for pgsql-bugs@lists.postgresql.org; Thu, 20 Jun 2019 03:13:17 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2E16122416; Wed, 19 Jun 2019 23:13:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 19 Jun 2019 23:13:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=kEkH4uRzhSthRuz9r3PZeG2sTY6 jyZr3KDGNNr2sqvk=; b=J4BWp99yjmSiKoTWkF5PmCpVhjvL3BrA/tA53/uluX/ JFeJ6c0y0E2rzAe04Z3XRjMhPH+235oEr5GrjDQZdeM6XC9bMa1ckC/6LBDb1QGc RSEBHWEMYOXMuqB3ptgetaImsf7ZrWOKHo8cqmOqbtbidLK+rLv3Cwhbxf+nwD5G rYFqo54crjplcNDTn/MglzKpDUIHVCBvP5VGFFsOFIBLEtkhw5kpnQyvLfc3lsJ6 A7gq0FreMQvE/trBUDKVLIxolJw2P3yYqSidfISg8CnMhi0KTx1GnGdr30YTUAbH sBGUdaVr0cxKMP6xl0UYBXjVn57269UpMpQQqv4M+eA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=kEkH4u RzhSthRuz9r3PZeG2sTY6jyZr3KDGNNr2sqvk=; b=QC4Rs1BInO5a0ysZisohAD 0SvJCOESOEgfKE4ligg2Q4KcNuToD7t0IE+c3B8lJ3PJ1KOoc68ox/UqV5x7+R0R QrrV9e3h6C2vGIqvoGnSr7Nk6qBQ2P4qxZK2KqVwp/fdDXq9O8ircNK4DNjVMFpo eT29HtezMMHbKfhfAKYXaOUNceLblgU1V1IMXvG92E1pd4D2ho0gbh2gJPFOKETG p5e++luvIYMoNN3S79MoDArP6gzfM5SAwrzo3eULyh1BiqyUDjkbyDYlGF+PKWvJ aTu7utMs9bQyNkvkLuRBwP03CMzAieQ3Rf5PIP4vs6HZNo947x58d+7455VCUf9g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrtdefgdeiiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepfffhvf fukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhi vghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecukfhppeduuddurddutd dvrddukedtrddukeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehp rghquhhivghrrdighiiinecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 214C3380079; Wed, 19 Jun 2019 23:12:48 -0400 (EDT) Date: Thu, 20 Jun 2019 12:12:18 +0900 From: Michael Paquier To: Tom Lane Cc: Jorge Gustavo Rocha , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15827: Unable to connect on Windows using pg_services.conf using Python psycopg2 Message-ID: <20190620031218.GC2660@paquier.xyz> References: <15827-e6ba53a3a7ed543c@postgresql.org> <82491.1559409563@sss.pgh.pa.us> <1473.1560866085@sss.pgh.pa.us> <81d9d421-6947-7111-a1dc-cfd99cd3ae53@geomaster.pt> <23215.1560977098@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="adJ1OR3c6QgCpb/j" Content-Disposition: inline In-Reply-To: <23215.1560977098@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --adJ1OR3c6QgCpb/j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: >=20 > - f =3D fopen(serviceFile, "r"); > + f =3D fopen(serviceFile, "rt"); >=20 > 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 --adJ1OR3c6QgCpb/j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl0K+ZIACgkQnvQgOdby QH26dw/9GidkGz9MMlkUpT0WUJU9ZKRRnvFmVg9Pkxs96sc+ggRGeBPIZw2mEaoi uZuP5OaZ+5bZNtOhicyMY3o5gLCfK21Ob42hLNWfOlsDcy7v7CR0HDfEAm6aYfqg SEDDCo+nTf/XefjPHqgzB47I1p7SmE87K+aInEMda5CZLD6vJLQNlAuDh0VJ6tkL efYcPbjGXLhdsLWPBYuPLd8EHU4IK2oB3pMrKNdN1w35koEHehpJJnthOKT3L+mg 3AJbDv9SeL+FXkrMvbcc9CQdEU+mDZ9ki0XU82GR39E2CQIGJUxjsj1dc6BVrSim OdpR7s5dwr2hkLhv3dz9O3voCx1r3xHjQjg4bryzgeFu7VhEooXseAWk1mDnEsgF 1yP4UfMkrj6pUbOi2i6UhuSLwNSSYUTAT6L/mRJONa3yLgRAtWnNOakfoYJvIEje iGf4IYFzhpjp7CQz08C/iIWWU7iRfMul71Uf+dR97nsgP5di8Q8AZ34II9FNTSdm GkkImLxgjkUo0HXouyzIWD6aDpXoNE6g+eHhUEc/jkvg5X6G1dDkJqYdS4cS6+qN oF7JhsTLZH8q3oKZn2HiAOaDpN2NddWx6iZuA+POF5yMAx2BTnCPK0Azfb0/R3U/ 3yrl739ZoaOl4IHIBrQ4be3AwrrBBNlfU7If5qizSH1BMlwbhEo= =b5Sb -----END PGP SIGNATURE----- --adJ1OR3c6QgCpb/j--