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 1kXc7J-00012I-L7 for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Oct 2020 03:27:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kXc7I-0007x6-GQ for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Oct 2020 03:27:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXc7I-0007vs-AV for pgsql-bugs@lists.postgresql.org; Wed, 28 Oct 2020 03:27:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXc7G-0004gD-7u for pgsql-bugs@lists.postgresql.org; Wed, 28 Oct 2020 03:27:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 09S3R5Tg1224125; Tue, 27 Oct 2020 23:27:07 -0400 From: Tom Lane To: kensuke.okamura@kantei.co.jp cc: pgsql-bugs@lists.postgresql.org, Bruce Momjian Subject: Re: BUG #16688: psql removes only LF without CR at end of backquotes on windows. In-reply-to: <16688-c649c7b69cd7e6f8@postgresql.org> References: <16688-c649c7b69cd7e6f8@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 28 Oct 2020 01:58:57 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1224123.1603855625.1@sss.pgh.pa.us> Date: Tue, 27 Oct 2020 23:27:05 -0400 Message-ID: <1224124.1603855625@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > psql removes only LF without CR at end of backquotes on windows. Hmm, seems like b654714f9 missed this. psqlscanslash.l has fd = popen(cmd, PG_BINARY_R); ... /* strip any trailing newline */ if (cmd_output.len > 0 && cmd_output.data[cmd_output.len - 1] == '\n') cmd_output.len--; 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. regards, tom lane