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 1hqgND-0006NG-CG for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Jul 2019 16:13:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hqgNB-0001Bg-6X for pgsql-bugs@arkaria.postgresql.org; Thu, 25 Jul 2019 16:13:41 +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 1hqgNA-00019O-Ut for pgsql-bugs@lists.postgresql.org; Thu, 25 Jul 2019 16:13:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hqgN8-0002wr-Q4 for pgsql-bugs@lists.postgresql.org; Thu, 25 Jul 2019 16:13:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x6PGDWst029488; Thu, 25 Jul 2019 12:13:32 -0400 From: Tom Lane To: Michael Paquier 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 In-reply-to: <5805.1561750411@sss.pgh.pa.us> References: <81d9d421-6947-7111-a1dc-cfd99cd3ae53@geomaster.pt> <23215.1560977098@sss.pgh.pa.us> <20190620031218.GC2660@paquier.xyz> <20190620070319.GH2660@paquier.xyz> <0a9fcd30-5ae2-7e5f-ac1d-60d14a2ebb63@geomaster.pt> <20190621004233.GA1626@paquier.xyz> <3383.1561078113@sss.pgh.pa.us> <25605.1561652435@sss.pgh.pa.us> <20190628031056.GA1797@paquier.xyz> <5805.1561750411@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 28 Jun 2019 15:33:31 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29486.1564071212.1@sss.pgh.pa.us> Date: Thu, 25 Jul 2019 12:13:32 -0400 Message-ID: <29487.1564071212@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > Michael Paquier writes: >> I really think that >> we should stick with the approach of only removing \r when it is >> followed by \n as we basically want to be able to counter the text >> mode of Windows when something external wrote files read by our code, >> where \n has been magically transformed to \r\n. > As I said, I'm not convinced that filtering \r only where it's actually > adjacent to \n is sufficient, even on Windows. To suppose that it is > sufficient, you'd have to assume that fgets() guarantees not to split > the \r and \n across buffer boundaries, which I doubt that it does. > (If it does do that, it would break some other assumptions we have about > whether the buffer gets filled completely.) Hearing nothing further on this, I went ahead with the patch as I had it on HEAD, and a tweaked version of your patch on the back branches. regards, tom lane