Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jm1xb-0006fd-96 for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jun 2020 21:20:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jm1xZ-0001Aw-FY for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jun 2020 21:20:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jm1xZ-0001Ap-8k for pgsql-hackers@lists.postgresql.org; Thu, 18 Jun 2020 21:20:33 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jm1xX-0003S7-3w for pgsql-hackers@postgresql.org; Thu, 18 Jun 2020 21:20:32 +0000 Received: by mail-qt1-x844.google.com with SMTP id y1so5647328qtv.12 for ; Thu, 18 Jun 2020 14:20:30 -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=ZwgRIkWJQ2qS29hEPTgA10OCLw9aAK7X0TyGOHhP9no=; b=KEhM1xbT90tDdd1hciaMEeeaXF9n5GNr+uh2TT4N6SUxasVccPnbVAw6BG9MR3JBAu 87siBxsDzIrmQWDviClq/xrqXYvajzPivuC9ztN+ydT/B4yZYrrRO+aruLquW7u8EF2H 8RbKIsQhAdA5j5d+fRvHPGSn8ngEc+n5MS68zMj3ZqfYHOBhIa3HQLaUW3ML6BNyMBpy ecCD3LKHBNZTTuCsLZH3bi6Z+YwbT6TNqfBUKhu4a1bh5h+NL2VErZO8F5EBN0ZckPeJ FrIxi6In2oXmoHQH2jGrWcn9j+CZWkFjEE+9r9TiZ/Q75kP9G2eo3gMHJYdP6fYfIn9G LMLw== 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=ZwgRIkWJQ2qS29hEPTgA10OCLw9aAK7X0TyGOHhP9no=; b=T+pEYSuNzlyfLq3xl8yAjV6e/TCV32x7RTl2eWCDng3R5/LvE4tRbm0pojPoRl7VjY idmRVqdi6GAA7pHsHuVPOsucn1hOPOSZxwodwd8AfC1H07WfuExPSQUh2xV80/ODY68J MJXT8r0Qa9NaXXik0S5r6/viT/o3yWAYpGGYm9fNEqLAzorQC+v1PzTh4TTzOmvfrUzE DxWZYg0YZ0aeF3qHVClRmmWZl0+C80xkvLh8v1ZDCw0jNlZUhiQafD8h4lYZEIkPxqMu qlPk5XGyYqKAY5DBe7Q2HYXzOEk2lF0FeVKUiiPDUtO9855g4ISj4YyL1yGi9Hws0YbT Ki2g== X-Gm-Message-State: AOAM531obFEpr3GACD93iGIpkZUZXEaFSWgqOkmQcn9LkSiwbyQSagUz b1EYyX4Xu6eQRjZwpQWwFTnTfA== X-Google-Smtp-Source: ABdhPJwyb3BpgfXxEd9gt6oNbqiwDynTkVtnTwTRh8LmfbTczbSAfiJG6hXI5mhVFyXhjwyftWDwLw== X-Received: by 2002:aed:29c5:: with SMTP id o63mr213058qtd.386.1592515230152; Thu, 18 Jun 2020 14:20:30 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id m14sm4486840qke.99.2020.06.18.14.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 14:20:29 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 1EB7B2A3ADD; Thu, 18 Jun 2020 17:20:27 -0400 (-04) Date: Thu, 18 Jun 2020 17:20:27 -0400 From: Alvaro Herrera To: Justin Pryzby Cc: pgsql-hackers@postgresql.org, Kunshchikov Vladimir Subject: Re: pg_dump, gzwrite, and errno Message-ID: <20200618212027.GA17103@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200611153753.GU14879@telsasoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Jun-11, Justin Pryzby wrote: > --- a/src/bin/pg_dump/pg_backup_directory.c > +++ b/src/bin/pg_dump/pg_backup_directory.c > @@ -347,8 +347,12 @@ _WriteData(ArchiveHandle *AH, const void *data, size_t dLen) > lclContext *ctx = (lclContext *) AH->formatData; > > if (dLen > 0 && cfwrite(data, dLen, ctx->dataFH) != dLen) > + { > + if (errno == 0) > + errno = ENOSPC; > fatal("could not write to output file: %s", > get_cfp_error(ctx->dataFH)); > + } > } This seems correct to me. (I spent a long time looking at zlib sources to convince myself that it does work with compressed files too). There are more calls to cfwrite in pg_backup_directory.c though -- we should patch them all. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services