Skip to content

Commit b0ec61c

Browse files
Quote filenames in error messages
The majority of all filenames are quoted in user facing error and log messages, but a few were still printed without quotes. While these filenames do not risk causing any ambiguity as their format is strict, quote them anyways to be consistent across all logs. Also concatenate a message to keep it one line to make it easier to grep for in the code. Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/080EEABE-6645-4A46-AB20-6285ADAC44FE@yesql.se
1 parent be6f7cd commit b0ec61c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,8 +2248,7 @@ XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
22482248
errno = save_errno;
22492249
ereport(PANIC,
22502250
(errcode_for_file_access(),
2251-
errmsg("could not write to log file %s "
2252-
"at offset %u, length %zu: %m",
2251+
errmsg("could not write to log file \"%s\" at offset %u, length %zu: %m",
22532252
xlogfname, startoffset, nleft)));
22542253
}
22552254
nleft -= written;

src/bin/pg_waldump/pg_waldump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,11 @@ WALDumpReadPage(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen,
418418
if (errinfo.wre_errno != 0)
419419
{
420420
errno = errinfo.wre_errno;
421-
pg_fatal("could not read from file %s, offset %d: %m",
421+
pg_fatal("could not read from file \"%s\", offset %d: %m",
422422
fname, errinfo.wre_off);
423423
}
424424
else
425-
pg_fatal("could not read from file %s, offset %d: read %d of %d",
425+
pg_fatal("could not read from file \"%s\", offset %d: read %d of %d",
426426
fname, errinfo.wre_off, errinfo.wre_read,
427427
errinfo.wre_req);
428428
}

0 commit comments

Comments
 (0)