Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j6k2k-0006Qk-8e for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Feb 2020 23:55:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j6k2j-0004xm-2L for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Feb 2020 23:55:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j6k2i-0004xf-MO for pgsql-hackers@lists.postgresql.org; Tue, 25 Feb 2020 23:55:12 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j6k2g-0007xj-Ak for pgsql-hackers@lists.postgresql.org; Tue, 25 Feb 2020 23:55:11 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 189FF21F18; Tue, 25 Feb 2020 18:55:09 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 25 Feb 2020 18:55:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h= from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=fm1; bh=dcBWYKHLh3WFnB9FWPmPTzBEGe vT+OTp+d6uxWijPeY=; b=wZ70HsLFN6b8SlBGOCmYKTAbfkNCMMgAVDAWBcWMA1 G3L2bwYxgtSWd9/QNuLakQY5FSdEjlYJSMeRNR1i0miFXYCv0EwDGceEy+r/XiQK toBsBeaZgN4g/tEuwc2bIURFmEuizi0e7IJ81Iirt7xXOUIG+rYD8tNQVz/Ebtcb CjhWDF5DjN13cD5rmzBx3zHVR2eERFxOibmi4p5K1DZzhpFejKbD1wa8C+kt30L8 UWzQ4/Nd3pB8eNbvwekyrFsXxxO2CWDHnDWTMKHNmQ5kL79v7HYJ8JlMJXBb9odm cu2fTGSOhI8LmJrHuSjVgRco3Ol4zzk1sNkdDGiZipFw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=dcBWYK HLh3WFnB9FWPmPTzBEGevT+OTp+d6uxWijPeY=; b=f9hiuMS8JQKl0nvseO5J4a GfWZDFK0zGPatee5z2jXAD3QDD8b1NaI3bQmqPHCmnNvYpJcVonmdIEcug7vQLYz Pzo9WASkUnK1wXqAalyRyT1kMc2Oj9FklMKt7BQS+6n5JUXMKtR2we3C0CovMwp/ F+M5I2XeDTkraUrb8y5EVyouGNXPhyGCRUlII3HnthcK9uTIpOY8gSCwfwaLKiTM okFLkTGAN+8jnSqQ6CNQ5N9zJYurw8V+U/UJFeQ3yL2iD/RXLVPUa7t7TpMyqmZE 61NP/NfuZc5xE33y3xb274M0gpanBCVM1ZgSc1rRUsTsKBOtoZuWuAiI1hPJrTxg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrleefgdduiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufhffjgfkfgggtgesmhdtreertderjeenucfhrhhomhepihhlmhgrrhhi sehilhhmrghrihdrohhrghculdffrghgfhhinhhnucfklhhmrghrihcuofgrnhhnshonkh gvrhdmnecukfhppeegiedrgeefrdduhedrvdehvdenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehilhhmrghrihesihhlmhgrrhhirdhorhhg X-ME-Proxy: Received: from wibble.ilmari.org (wibble.ilmari.org [46.43.15.252]) by mail.messagingengine.com (Postfix) with ESMTPA id 215893280059; Tue, 25 Feb 2020 18:55:08 -0500 (EST) From: ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) To: Daniel Gustafsson Cc: pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] pg_upgrade: report the reason for failing to open the cluster version file References: <87pne2w98h.fsf@wibble.ilmari.org> <44115C15-EE49-4BDE-A976-2901384B5E60@yesql.se> Date: Tue, 25 Feb 2020 23:55:06 +0000 In-Reply-To: <44115C15-EE49-4BDE-A976-2901384B5E60@yesql.se> (Daniel Gustafsson's message of "Wed, 26 Feb 2020 00:31:26 +0100") Message-ID: <87mu96w7c5.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=-=-= Content-Type: text/plain Daniel Gustafsson writes: > A few lines further down from this we report an error in case we are unable to > parse the file in question: > > pg_fatal("could not parse PG_VERSION file from %s\n", cluster->pgdata); > > Should the pgdata argument be quoted there as well, like \"%s\", to make it > consistent for how we report filenames and directories in pg_upgrade? Good point, I agree we should. Updated patch attached. - ilmari -- "A disappointingly low fraction of the human race is, at any given time, on fire." - Stig Sandbeck Mathisen --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v2-0001-pg_upgrade-add-m-to-version-file-open-failure-mes.patch From a503ffdb1499e73bfb75373a9af2e766e279beeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= Date: Tue, 25 Feb 2020 18:07:14 +0000 Subject: [PATCH v2] pg_upgrade: add %m to version file open failure message Also quote the file name in the error messages. --- src/bin/pg_upgrade/server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c index e244256501..be604d3351 100644 --- a/src/bin/pg_upgrade/server.c +++ b/src/bin/pg_upgrade/server.c @@ -164,11 +164,11 @@ get_major_server_version(ClusterInfo *cluster) snprintf(ver_filename, sizeof(ver_filename), "%s/PG_VERSION", cluster->pgdata); if ((version_fd = fopen(ver_filename, "r")) == NULL) - pg_fatal("could not open version file: %s\n", ver_filename); + pg_fatal("could not open version file \"%s\": %m\n", ver_filename); if (fscanf(version_fd, "%63s", cluster->major_version_str) == 0 || sscanf(cluster->major_version_str, "%d.%d", &v1, &v2) < 1) - pg_fatal("could not parse PG_VERSION file from %s\n", cluster->pgdata); + pg_fatal("could not parse PG_VERSION file from \"%s\"\n", cluster->pgdata); fclose(version_fd); -- 2.22.0 --=-=-=--