Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1da7up-0007W0-OC for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Jul 2017 22:02:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1da7up-0003iA-Am for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Jul 2017 22:02:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1da7ul-0003Vn-OP for pgsql-hackers@postgresql.org; Tue, 25 Jul 2017 22:02:51 +0000 Received: from mail-qk0-x22a.google.com ([2607:f8b0:400d:c09::22a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1da7ui-0008T2-UM for pgsql-hackers@postgresql.org; Tue, 25 Jul 2017 22:02:50 +0000 Received: by mail-qk0-x22a.google.com with SMTP id q130so36018198qka.4 for ; Tue, 25 Jul 2017 15:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=q58nXtDWE8f9Lv2ayYi6uoYqJ5piE5NC2wNj9e7c1jY=; b=T3ycfonUimTP2t0zsddhPU0IviA6vZYDcQneU1JCJR24nSkCy1Io1YZWYjHbSaP8pU V4s4uTMLnqxGtcBV3ISQNVA7JCrZPoKlKdkuGvTwJAjb1AuZWhkwwyHPFNA/WIsvGLn9 rmHycEv+aUkT4LzVpK2eQ4fXmsHVfd3Py9qhvNIVOhDcmioiSxVhtWiw4xdddZs/l64X jMs9oP5ncB37SNSd+i5mowD+kJNF5g2/PKsV2HulfdcNPnVGAIc2XQDQWbD7If/YUJBH Dmrqan/h2fTXaRpo3EEgAjAa8aQRvWTeNW5I8Igr2/RgyEnoKJbLhwoKPZ9m0y72J/0V 1CXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=q58nXtDWE8f9Lv2ayYi6uoYqJ5piE5NC2wNj9e7c1jY=; b=MZ9WjM+j8KwNczspzJGf+/fV3/ZM3ZQmQm9ETX52ZAO4Ncybit6xpgQTiuicrucC9s QgWwucWGxZU0L8rT786sLGazLlRTGzt4wh0bpKTgfPIGCrs9dS7rgbUPMLSDJVuShHGD ycbOUiDT5+xEEE1fv8znacv6K//1+JbRIUn5cV6Wronzvgw5ghqPCmrSs1gnTQEjHD5r EZLJ7gmMJw6Uyc6z7Wk99Y2oFyq2QtRaMo4klMGPVTW9AFqu8ds+PWtrDhPWc0ot5Sfm fNmCGnDySDEvpQ0/Un2yChbAw1dIPNLRpUDhQxl7geo28GQYuabVzv8N8235sz8etyfw RU6w== X-Gm-Message-State: AIVw112R1c90qoMP0S2A2mr2q1yu/qvaliLq3a4qDQHGr+nlurhB7bb8 CAy8Tzh1+H+08WxJ X-Received: by 10.55.43.160 with SMTP id r32mr25661274qkr.47.1501020167804; Tue, 25 Jul 2017 15:02:47 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([190.217.209.130]) by smtp.gmail.com with ESMTPSA id b11sm10873321qtb.87.2017.07.25.15.02.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Jul 2017 15:02:47 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 6C1B1320; Tue, 25 Jul 2017 18:02:34 -0400 (-04) Date: Tue, 25 Jul 2017 18:02:34 -0400 From: Alvaro Herrera To: Kunshchikov Vladimir Cc: "pgsql-hackers@postgresql.org" Subject: Re: [patch] pg_dump/pg_restore zerror() and strerror() mishap Message-ID: <20170725220234.x2fprth7taeb6oc3@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1498120508308.9826@infotecs.ru> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Kunshchikov Vladimir wrote: > Errors should be like this: > pg_restore: [compress_io] could not read from input file: d3/2811.dat.gz: invalid distance too far back > > Attached small fix for this issue. After looking at this patch, I don't like it very much. In particular, I don't like the way you've handled the WRITE_ERROR_EXIT macro in pg_backup_directory.c by undef'ing the existing one and creating it anew. The complete and correct definition should reside in one place (pg_backup_archiver.h), instead of being split in two and being defined differently. Another point is that you broke the comment on the definition of struct cfp "this is opaque to callers" by moving it to the header file precisely with the point of making it transparent to callers. We need some better idea there. I think it can be done by making compress_io.c responsible of handing over the error message through some new function (something very simple like "if compressedfp then return get_gz_error else strerror" should suffice). Also, I needed to rebase your patch over a recent pgindent run, though that's a pretty small change. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers