pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use mode "r" for popen() in psql's evaluate_backtick().
Date: Wed, 28 Oct 2020 18:36:19 +0000
Message-ID: <E1kXqJ1-00037v-AL@gemulon.postgresql.org> (raw)

Use mode "r" for popen() in psql's evaluate_backtick().

In almost all other places, we use plain "r" or "w" mode in popen()
calls (the exceptions being for COPY data).  This one has been
overlooked (possibly because it's buried in a ".l" flex file?),
but it's using PG_BINARY_R.

Kensuke Okamura complained in bug #16688 that we fail to strip \r
when stripping the trailing newline from a backtick result string.
That's true enough, but we'd also fail to convert embedded \r\n
cleanly, which also seems undesirable.  Fixing the popen() mode
seems like the best way to deal with this.

It's been like this for a long time, so back-patch to all supported
branches.

Discussion: https://postgr.es/m/16688-c649c7b69cd7e6f8@postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9eb2503391da1d0a17d3116a5a49e4f73b1af84f

Modified Files
--------------
src/bin/psql/psqlscanslash.l | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1kXqJ1-00037v-AL@gemulon.postgresql.org>
Permalink:  ../E1kXqJ1-00037v-AL@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kXqJ1-00037v-AL@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Use mode "r" for popen() in psql's evaluate_backtick().
  In-Reply-To: <E1kXqJ1-00037v-AL@gemulon.postgresql.org>
  References: <E1kXqJ1-00037v-AL@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox