pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: zengman <zengman@halodbtech.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Michael Paquier <michael@paquier.xyz>
Subject: Small fixes for incorrect error messages
Date: Thu, 5 Feb 2026 14:51:05 +0800
Message-ID: <tencent_1EE1430B1E6C18A663B8990F@qq.com> (raw )
Hi all,
I found a few easily overlooked error messages worth fixing, as follows:
01
```
if (!is_absolute_path(tsmap->new_dir))
- pg_fatal("old directory is not an absolute path in tablespace mapping: %s",
+ pg_fatal("new directory is not an absolute path in tablespace mapping: %s",
tsmap->new_dir);
```
02
```
if (rb < 0)
- pg_fatal("could not read from file \"%s\": %m", dst);
+ pg_fatal("could not read from file \"%s\": %m", src);
```
03
```
if (fstat(fd, &statbuf) < 0)
- pg_fatal("could not open file \"%s\" for reading: %m",
+ pg_fatal("could not stat file \"%s\" for reading: %m",
fullpath);
```
--
regards,
Man Zeng
Attachments:
[application/octet-stream] 0001-Fix-error-message-for-non-absolute-new-directory-in-.patch (989B, ../tencent_1EE1430B1E6C18A663B8990F@qq.com/2-0001-Fix-error-message-for-non-absolute-new-directory-in-.patch)
download | inline diff:
From f321a5e188a9e40863fd4c49f1896bab623b2432 Mon Sep 17 00:00:00 2001
From: Man Zeng <zengman@halodbtech.com>
Date: Thu, 5 Feb 2026 14:15:07 +0800
Subject: [PATCH 1/3] Fix error message for non-absolute new directory in
tablespace mapping
---
src/bin/pg_combinebackup/pg_combinebackup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c
index 918b8b35646..b9f26ce782e 100644
--- a/src/bin/pg_combinebackup/pg_combinebackup.c
+++ b/src/bin/pg_combinebackup/pg_combinebackup.c
@@ -501,7 +501,7 @@ add_tablespace_mapping(cb_options *opt, char *arg)
tsmap->old_dir);
if (!is_absolute_path(tsmap->new_dir))
- pg_fatal("old directory is not an absolute path in tablespace mapping: %s",
+ pg_fatal("new directory is not an absolute path in tablespace mapping: %s",
tsmap->new_dir);
/* Canonicalize paths to avoid spurious failures when comparing. */
--
2.45.2
[application/octet-stream] 0002-Fix-error-message-in-copy_file_blocks-to-reference-s.patch (799B, ../tencent_1EE1430B1E6C18A663B8990F@qq.com/3-0002-Fix-error-message-in-copy_file_blocks-to-reference-s.patch)
download | inline diff:
From 6ef7ec541a97c6f94b7089f23ad42b4fb750678d Mon Sep 17 00:00:00 2001
From: Man Zeng <zengman@halodbtech.com>
Date: Thu, 5 Feb 2026 14:18:57 +0800
Subject: [PATCH 2/3] Fix error message in copy_file_blocks to reference source
file
---
src/bin/pg_combinebackup/copy_file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/pg_combinebackup/copy_file.c b/src/bin/pg_combinebackup/copy_file.c
index dd3c0dc1c89..0287d6e87df 100644
--- a/src/bin/pg_combinebackup/copy_file.c
+++ b/src/bin/pg_combinebackup/copy_file.c
@@ -210,7 +210,7 @@ copy_file_blocks(const char *src, const char *dst,
}
if (rb < 0)
- pg_fatal("could not read from file \"%s\": %m", dst);
+ pg_fatal("could not read from file \"%s\": %m", src);
pg_free(buffer);
close(src_fd);
--
2.45.2
[application/octet-stream] 0003-Fix-error-message-in-slurpFile-to-clarify-file-statu.patch (810B, ../tencent_1EE1430B1E6C18A663B8990F@qq.com/4-0003-Fix-error-message-in-slurpFile-to-clarify-file-statu.patch)
download | inline diff:
From 0ebdb00dbf53187aabbf7980118eb6c2b5a747de Mon Sep 17 00:00:00 2001
From: Man Zeng <zengman@halodbtech.com>
Date: Thu, 5 Feb 2026 14:22:01 +0800
Subject: [PATCH 3/3] Fix error message in slurpFile to clarify file status
check
---
src/bin/pg_rewind/file_ops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/pg_rewind/file_ops.c b/src/bin/pg_rewind/file_ops.c
index 356e23a3080..7de2195a4fa 100644
--- a/src/bin/pg_rewind/file_ops.c
+++ b/src/bin/pg_rewind/file_ops.c
@@ -327,7 +327,7 @@ slurpFile(const char *datadir, const char *path, size_t *filesize)
fullpath);
if (fstat(fd, &statbuf) < 0)
- pg_fatal("could not open file \"%s\" for reading: %m",
+ pg_fatal("could not stat file \"%s\" for reading: %m",
fullpath);
len = statbuf.st_size;
--
2.45.2
view thread (8+ messages) latest in thread
Message-ID: <tencent_1EE1430B1E6C18A663B8990F@qq.com>
Permalink: ../tencent_1EE1430B1E6C18A663B8990F@qq.com/
Also on: postgresql.org/message-id/tencent_1EE1430B1E6C18A663B8990F@qq.com
copy link · copy postgr.es · copy git am
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: zengman@halodbtech.com, michael@paquier.xyz
Subject: Re: Small fixes for incorrect error messages
In-Reply-To: <tencent_1EE1430B1E6C18A663B8990F@qq.com>
* 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