Re: BUG #16688: psql removes only LF without CR at end of backquotes on windows.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: kensuke(dot)okamura(at)kantei(dot)co(dot)jp
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: BUG #16688: psql removes only LF without CR at end of backquotes on windows.
Date: 2020-10-28 03:27:05
Message-ID: 1224124.1603855625@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2020-10-28 03:29:42 Re: BUG #16688: psql removes only LF without CR at end of backquotes on windows.
Previous Message Kyotaro Horiguchi 2020-10-28 02:14:10 Re: Non-Materialized CTE bug?