public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniel Gustafsson <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Quoting filename in using facing log messages
Date: Wed, 13 Sep 2023 13:48:12 +0200
Message-ID: <[email protected]> (raw)
Looking at [email protected] I noticed that we had a a few instances
of filenames in userfacing log messages (ie not elog or DEBUGx etc) not being
quoted, where the vast majority are quoted like \"%s\". Any reason not to
quote them as per the attached to be consistent across all log messages?
--
Daniel Gustafsson
Attachments:
[application/octet-stream] quote_file_errmsg.diff (1.3K, ../[email protected]/2-quote_file_errmsg.diff)
download | inline diff:
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index f6f8adc72a..50cd165289 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -2248,7 +2248,7 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
errno = save_errno;
ereport(PANIC,
(errcode_for_file_access(),
- errmsg("could not write to log file %s "
+ errmsg("could not write to log file \"%s\" "
"at offset %u, length %zu: %m",
xlogfname, startoffset, nleft)));
}
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index b9acfed3b7..a3535bdfa9 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -418,11 +418,11 @@ WALDumpReadPage(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen,
if (errinfo.wre_errno != 0)
{
errno = errinfo.wre_errno;
- pg_fatal("could not read from file %s, offset %d: %m",
+ pg_fatal("could not read from file \"%s\", offset %d: %m",
fname, errinfo.wre_off);
}
else
- pg_fatal("could not read from file %s, offset %d: read %d of %d",
+ pg_fatal("could not read from file \"%s\", offset %d: read %d of %d",
fname, errinfo.wre_off, errinfo.wre_read,
errinfo.wre_req);
}
view thread (2+ messages)
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: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Quoting filename in using facing log messages
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox