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 1j6jQG-0005f4-6g for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Feb 2020 23:15:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j6jPH-0002yo-0g for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Feb 2020 23:14:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j6jPF-0002uY-85 for pgsql-hackers@lists.postgresql.org; Tue, 25 Feb 2020 23:14:26 +0000 Received: from [66.111.4.25] (helo=out1-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j6jPB-0001Ef-3Q for pgsql-hackers@lists.postgresql.org; Tue, 25 Feb 2020 23:14:24 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 45A2821FD7 for ; Tue, 25 Feb 2020 18:14:09 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 25 Feb 2020 18:14:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h= from:to:subject:date:message-id:mime-version:content-type; s= fm1; bh=puqAnCp8q7TA3vAV5/CcxDHKWesW838ZWlulSFjd6a0=; b=oOxYGOR2 Z3o4CMtZrZopIiiXbIH4trOoLXQW8NzzDPoiFYRd2eAFASdKKC2ilO3eUkhI6m9c Yy9eep+H+/d7jBskz3aDHkBhq0dDmHI6Z8ZXdt/A5SfOg9tG5cTuYOPJbYlUCJXr 7aMfA9FMmWsM+bVU0R/MtTkCDtFV7wzUxQ6igDtHKZe7l674cIQOX5wMlWlwp9s7 yqAwwuFVe2l9LW3vPuEZLhQGvL9rSzJBLsMN3D/bBeQaL2f3boMmD/PIPpPCOkxi HvIwixCnwX1n31Blldt9tF418gtNM4sL4mCNc2h9UOfwC1Silm061a/Vzs20gc0l 9PQII0OZCIZC5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=puqAnCp8q7TA3vAV5/CcxDHKWesW8 38ZWlulSFjd6a0=; b=y2e34U5XHVERfk4YJePoP6wDQEEz5h6DB+zp2TYj1bbf5 bl+IdxyhFY57e4gfXI7JCQ8zT4CEcTUUZnC8OUo+l/AONlMausmGX7Srh1Lo92Df JPwboqIkdzt0JKwdgJz6eGkOdDaIeRMFiW7vXRshZjKeVPgI2NMRg2q2OQTO/XkF FnALpVq0FUz2vjAoZ6t9N2wx2KeGoXSQ7xjEuiyNlw9Zhz5ThhtHbDElOudceI2D Ax/6l1iFp+f+ycm5+mE/ABXJ39LdHWpc6v95052RRi7qRwuGvXfwr+VwFl26BRJW bagR7ZayoNFO8mI+XEFIsZesbSbQTrUVuJGICCcpA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrleefgddtkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgfgggtsehmtderredtre ejnecuhfhrohhmpehilhhmrghrihesihhlmhgrrhhirdhorhhgucdlffgrghhfihhnnhcu kfhlmhgrrhhiucforghnnhhsnohkvghrmdenucfkphepgeeirdegfedrudehrddvhedvne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhlmhgr rhhisehilhhmrghrihdrohhrgh X-ME-Proxy: Received: from wibble.ilmari.org (wibble.ilmari.org [46.43.15.252]) by mail.messagingengine.com (Postfix) with ESMTPA id 3D7A73060BD1 for ; Tue, 25 Feb 2020 18:14:08 -0500 (EST) From: ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) To: pgsql-hackers@lists.postgresql.org Subject: [PATCH] pg_upgrade: report the reason for failing to open the cluster version file Date: Tue, 25 Feb 2020 23:14:06 +0000 Message-ID: <87pne2w98h.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="=-=-=" X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.25 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=-=-= Content-Type: text/plain Hi Hackers, The other day I was helping someone with pg_upgrade on IRC, and they got a rather unhelpful error message: ERROR: could not open version file /path/to/new/cluster/PG_VERSION It would have saved some minutes of debugging time if that had included the reason why the open failed, so here's a patch to do so. - ilmari -- - Twitter seems more influential [than blogs] in the 'gets reported in the mainstream press' sense at least. - Matt McLeod - That'd be because the content of a tweet is easier to condense down to a mainstream media article. - Calle Dybedahl --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-pg_upgrade-add-m-to-version-file-open-failure-messag.patch From 84b99582a3447213f666c2f6f52c22ef518d82d5 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] pg_upgrade: add %m to version file open failure message --- src/bin/pg_upgrade/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c index e244256501..c9b56ae175 100644 --- a/src/bin/pg_upgrade/server.c +++ b/src/bin/pg_upgrade/server.c @@ -164,7 +164,7 @@ 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) -- 2.22.0 --=-=-=--