Daniel Gustafsson <dan...@yesql.se> 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
>From a503ffdb1499e73bfb75373a9af2e766e279beeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilm...@ilmari.org> 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