pgsql: Fix pg_dump's errno checking for zlib I/O

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix pg_dump's errno checking for zlib I/O
Date: 2017-08-02 22:28:48
Message-ID: E1dd28G-00005J-Tt@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Fix pg_dump's errno checking for zlib I/O

Some error reports were reporting strerror(errno), which for some error
conditions coming from zlib are wrong, resulting in confusing reports
such as
pg_restore: [compress_io] could not read from input file: Success
which makes no sense. To correctly extract the error message we need to
use gzerror(), so let's do that.

This isn't as comprehensive or as neat as I would like, but at least it
should improve things in many common cases. The zlib abstraction in
compress_io does not seem to be applied consistently enough; we could
perhaps improve that, but it seems master-only material, not a bug fix
for back-patching.

This problem goes back all the way, but I decided to apply back to 9.4
only, because older branches don't contain commit 14ea89366 which this
change depends on.

Authors: Vladimir Kunschikov, Álvaro Herrera
Discussion: https://postgr.es/m/1498120508308.9826@infotecs.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4d57e83816778c6f61ea35c697f937a6f9c3c3de

Modified Files
--------------
src/bin/pg_dump/compress_io.c | 24 +++++++++++++++++++++++-
src/bin/pg_dump/compress_io.h | 1 +
src/bin/pg_dump/pg_backup_directory.c | 10 +++++++---
src/bin/pg_dump/pg_backup_tar.c | 8 +++++++-
4 files changed, 38 insertions(+), 5 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2017-08-03 02:09:46 Re: [COMMITTERS] pgsql: Fix pg_dump's errno checking for zlib I/O
Previous Message Tom Lane 2017-08-02 20:55:26 pgsql: Add pgtcl back to the list of externally-maintained client inter

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2017-08-02 22:36:00 Re: [patch] pg_dump/pg_restore zerror() and strerror() mishap
Previous Message Andres Freund 2017-08-02 21:47:00 Re: Why does logical replication launcher exit with exit code 1?