From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | kensuke(dot)okamura(at)kantei(dot)co(dot)jp, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #16688: psql removes only LF without CR at end of backquotes on windows. |
Date: | 2020-10-28 03:29:42 |
Message-ID: | 20201028032942.GA21830@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, Oct 27, 2020 at 11:27:05PM -0400, Tom Lane wrote:
> PG Bug reporting form <noreply(at)postgresql(dot)org> 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.
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.
--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2020-10-28 05:18:21 | Re: BUG #16577: Segfault on altering a table located in a dropped tablespace |
Previous Message | Tom Lane | 2020-10-28 03:27:05 | Re: BUG #16688: psql removes only LF without CR at end of backquotes on windows. |