Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXsLW-0007ER-Dx for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Oct 2020 20:47:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kXsLV-0003NT-Ag for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Oct 2020 20:47:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXsLV-0003NM-4s for pgsql-bugs@lists.postgresql.org; Wed, 28 Oct 2020 20:47:01 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXsLS-0007i0-Oe for pgsql-bugs@lists.postgresql.org; Wed, 28 Oct 2020 20:47:00 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kXsLO-0003Oe-Vu; Wed, 28 Oct 2020 16:46:54 -0400 Date: Wed, 28 Oct 2020 16:46:54 -0400 From: Bruce Momjian To: Tom Lane Cc: kensuke.okamura@kantei.co.jp, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16688: psql removes only LF without CR at end of backquotes on windows. Message-ID: <20201028204654.GD3239@momjian.us> References: <16688-c649c7b69cd7e6f8@postgresql.org> <1224124.1603855625@sss.pgh.pa.us> <20201028032942.GA21830@momjian.us> <1441558.1603910379@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441558.1603910379@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Oct 28, 2020 at 02:39:39PM -0400, Tom Lane wrote: > Bruce Momjian writes: > > On Tue, Oct 27, 2020 at 11:27:05PM -0400, Tom Lane wrote: > >> But rather than mess with that newline-chomping code, I'm > >> inclined to wonder why we're using PG_BINARY_R for input > >> that we clearly expect to be textual. Most of our other > >> popen's do not do that. > >> > >> Bruce, this seems to date to 98e9775a3 ... don't suppose > >> you remember that? I see the point about control-Z in text > >> files, but I wonder how plausible that is for popen cases. > > > It seems safe for popen to use TEXT mode, and it might help with > > encoding conversion. I don't think I made a popen distinction when I > > was working in this area. > > I double-checked, and verified that our only other popen() calls > that use binary mode are dealing with COPY data. It seems appropriate > to do so in that case, partly because the data might indeed be binary > and partly because we have adequate newline recognition logic in copy.c. > But it does seem best to uniformly use plain "r" or "w" for other > popen's. So I've fixed this that way. Thanks. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee