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: Fix pg_current_logfile() to not emit a carriage return on Window
Date: Thu, 09 Jul 2020 20:03:05 +0000
Message-ID: <E1jtcl7-0007KY-0S@gemulon.postgresql.org> (raw)

Fix pg_current_logfile() to not emit a carriage return on Windows.

Due to not having our signals straight about CRLF vs. LF line
termination, the output of pg_current_logfile() included a trailing
\r on Windows.  To fix, force the file descriptor it uses into text
mode.

While here, move a couple of local variable declarations to make
the function's logic clearer.

In v12 and v13, also back-patch the test added by 1c4e88e2f so that
this function has some test coverage.  However, the 004_logrotate.pl
test script doesn't exist before v12, and it didn't seem worth adding
to older branches just for this.

Per report from Thomas Kellerer.  Back-patch to v10 where this
function was added.

Discussion: https://postgr.es/m/412ae8da-76bb-640f-039a-f3513499e53d@gmx.net

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2564e2d08546dfedc1482e10205be58a20ffe3cc

Modified Files
--------------
src/backend/utils/adt/misc.c      | 19 ++++++++++++-------
src/bin/pg_ctl/t/004_logrotate.pl |  6 +++++-
2 files changed, 17 insertions(+), 8 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1jtcl7-0007KY-0S@gemulon.postgresql.org>
Permalink:  ../E1jtcl7-0007KY-0S@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jtcl7-0007KY-0S@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: Fix pg_current_logfile() to not emit a carriage return on Window
  In-Reply-To: <E1jtcl7-0007KY-0S@gemulon.postgresql.org>
  References: <E1jtcl7-0007KY-0S@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