pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: [PATCH] pg_upgrade: report the reason for failing to open the cluster version file
Date: Wed, 26 Feb 2020 10:48:44 +0900
Message-ID: <20200226014844.GF17153@paquier.xyz> (raw)
In-Reply-To: <87mu96w7c5.fsf@wibble.ilmari.org>
References: <87pne2w98h.fsf@wibble.ilmari.org>
	<44115C15-EE49-4BDE-A976-2901384B5E60@yesql.se>
	<87mu96w7c5.fsf@wibble.ilmari.org>

On Tue, Feb 25, 2020 at 11:55:06PM +0000, Dagfinn Ilmari Mannsåker wrote:
> @@ -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);

Here I think that it would be better to just use "could not open
file" as we know that we are dealing with a version file already
thanks to 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);

No objection to this one.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (11+ messages)  latest in thread

Message-ID: <20200226014844.GF17153@paquier.xyz>
Permalink:  ../20200226014844.GF17153@paquier.xyz/
Also on:    postgresql.org/message-id/20200226014844.GF17153@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: michael@paquier.xyz, ilmari@ilmari.org, daniel@yesql.se, pgsql-hackers@lists.postgresql.org
  Subject: Re: [PATCH] pg_upgrade: report the reason for failing to open the cluster version file
  In-Reply-To: <20200226014844.GF17153@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox