pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedSmall fixes for incorrect error messages
8+ messages / 3 participants
[nested] [flat]
Commits from this thread:
2026-02-07 1653ce5236 cff2ef9845 5449fd261e a7bdbbadac 9dcd0b3de1 3e7bb39df7 Further error message fix
2026-02-06 74a116a79b acfa422c3c 67ad4387b2 977a17a3eb 4ec943f7dc d32e171609 Fix some error message inconsistencies
* Small fixes for incorrect error messages
@ 2026-02-05 06:51 zengman <zengman@halodbtech.com>
0 siblings, 2 replies; 8+ messages in thread
From: zengman @ 2026-02-05 06:51 UTC (permalink / raw)
To: pgsql-hackers; +Cc: Michael Paquier <michael@paquier.xyz>
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: download all (3 files, .tar.gz)
0001-Fix-error-message-for-non-absolute-new-directory-in-.patch (application/octet-stream, 989B) download
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
0002-Fix-error-message-in-copy_file_blocks-to-reference-s.patch (application/octet-stream, 799B) download
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
0003-Fix-error-message-in-slurpFile-to-clarify-file-statu.patch (application/octet-stream, 810B) download
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
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Small fixes for incorrect error messages
@ 2026-02-05 10:28 Michael Paquier <michael@paquier.xyz>
parent: zengman <zengman@halodbtech.com>
1 sibling, 1 reply; 8+ messages in thread
From: Michael Paquier @ 2026-02-05 10:28 UTC (permalink / raw)
To: zengman <zengman@halodbtech.com>; +Cc: pgsql-hackers
On Thu, Feb 05, 2026 at 02:51:05PM +0800, zengman wrote:
> I found a few easily overlooked error messages worth fixing, as follows:
Good catches. Obviously a copy-pasto for the first and third ones,
and a thinko for the second one.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Small fixes for incorrect error messages
@ 2026-02-06 06:44 Michael Paquier <michael@paquier.xyz>
parent: Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 8+ messages in thread
From: Michael Paquier @ 2026-02-06 06:44 UTC (permalink / raw)
To: zengman <zengman@halodbtech.com>; +Cc: pgsql-hackers
On Thu, Feb 05, 2026 at 07:28:00PM +0900, Michael Paquier wrote:
> Good catches. Obviously a copy-pasto for the first and third ones,
> and a thinko for the second one.
Fixed these ones.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Small fixes for incorrect error messages
@ 2026-02-06 07:54 zengman <zengman@halodbtech.com>
parent: Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 8+ messages in thread
From: zengman @ 2026-02-06 07:54 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-hackers
> Fixed these ones.
Thanks a lot for your help with this! I previously reported another similar issue �C could you please take a moment to look at it? Maybe we could fix it along the way.
https://www.postgresql.org/message-id/flat/tencent_6D253E6F517F8F85796F0D9D@qq.com
--
regards,
Man Zeng
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Small fixes for incorrect error messages
@ 2026-02-07 08:57 Peter Eisentraut <peter@eisentraut.org>
parent: zengman <zengman@halodbtech.com>
1 sibling, 1 reply; 8+ messages in thread
From: Peter Eisentraut @ 2026-02-07 08:57 UTC (permalink / raw)
To: zengman <zengman@halodbtech.com>; pgsql-hackers; +Cc: Michael Paquier <michael@paquier.xyz>
On 05.02.26 07:51, zengman wrote:
> ```
> 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);
> ```
It doesn't make sense to "stat a file for reading". The changed message
should probably just be
> + pg_fatal("could not stat file \"%s\": %m",
> fullpath);
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Small fixes for incorrect error messages
@ 2026-02-07 09:24 zengman <zengman@halodbtech.com>
parent: Peter Eisentraut <peter@eisentraut.org>
0 siblings, 1 reply; 8+ messages in thread
From: zengman @ 2026-02-07 09:24 UTC (permalink / raw)
To: Peter Eisentraut <peter@eisentraut.org>; pgsql-hackers; +Cc: Michael Paquier <michael@paquier.xyz>
> It doesn't make sense to "stat a file for reading". The changed message
> should probably just be
> + pg_fatal("could not stat file \"%s\": %m",
> fullpath);
You're right. I was careless earlier, my apologies.
--
regards,
Man Zeng
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Small fixes for incorrect error messages
@ 2026-02-07 22:03 Peter Eisentraut <peter@eisentraut.org>
parent: zengman <zengman@halodbtech.com>
0 siblings, 1 reply; 8+ messages in thread
From: Peter Eisentraut @ 2026-02-07 22:03 UTC (permalink / raw)
To: zengman <zengman@halodbtech.com>; pgsql-hackers; +Cc: Michael Paquier <michael@paquier.xyz>
On 07.02.26 10:24, zengman wrote:
>> It doesn't make sense to "stat a file for reading". The changed message
>> should probably just be
>> + pg_fatal("could not stat file \"%s\": %m",
>> fullpath);
>
> You're right. I was careless earlier, my apologies.
Ok, I have fixed this.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Small fixes for incorrect error messages
@ 2026-02-08 23:11 Michael Paquier <michael@paquier.xyz>
parent: Peter Eisentraut <peter@eisentraut.org>
0 siblings, 0 replies; 8+ messages in thread
From: Michael Paquier @ 2026-02-08 23:11 UTC (permalink / raw)
To: Peter Eisentraut <peter@eisentraut.org>; +Cc: zengman <zengman@halodbtech.com>; pgsql-hackers
On Sat, Feb 07, 2026 at 11:03:36PM +0100, Peter Eisentraut wrote:
> On 07.02.26 10:24, zengman wrote:
>> You're right. I was careless earlier, my apologies.
>
> Ok, I have fixed this.
Thanks for the fix. (I was away from my laptop.)
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2026-02-08 23:11 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-02-05 06:51 Small fixes for incorrect error messages zengman <zengman@halodbtech.com>
2026-02-05 10:28 ` Michael Paquier <michael@paquier.xyz>
2026-02-06 06:44 ` Michael Paquier <michael@paquier.xyz>
2026-02-06 07:54 ` zengman <zengman@halodbtech.com>
2026-02-07 08:57 ` Peter Eisentraut <peter@eisentraut.org>
2026-02-07 09:24 ` zengman <zengman@halodbtech.com>
2026-02-07 22:03 ` Peter Eisentraut <peter@eisentraut.org>
2026-02-08 23:11 ` Michael Paquier <michael@paquier.xyz>
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