Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgOM3-00Fc5t-I3 for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Sep 2023 11:48:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qgOM1-00GshF-2c for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Sep 2023 11:48:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgOM0-00Gsgb-Oq for pgsql-hackers@lists.postgresql.org; Wed, 13 Sep 2023 11:48:20 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgOLw-004KI1-J8 for pgsql-hackers@lists.postgresql.org; Wed, 13 Sep 2023 11:48:19 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 6B3932FAD426 for ; Wed, 13 Sep 2023 13:48:13 +0200 (CEST) Received: from s979.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id 5C7682E291B0 for ; Wed, 13 Sep 2023 13:48:13 +0200 (CEST) Received: from s898.loopia.se (unknown [172.22.191.6]) by s979.loopia.se (Postfix) with ESMTP id 5A77110BC441 for ; Wed, 13 Sep 2023 13:48:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.01 X-Spam-Level: X-Spam-Status: No, score=-1.01 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=disabled Received: from s980.loopia.se ([172.22.191.5]) by s898.loopia.se (s898.loopia.se [172.22.190.17]) (amavisd-new, port 10024) with UTF8LMTP id Sy4JDIJYcEil for ; Wed, 13 Sep 2023 13:48:13 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s980.loopia.se (Postfix) with ESMTPSA id DEDBE22016C4 for ; Wed, 13 Sep 2023 13:48:12 +0200 (CEST) From: Daniel Gustafsson Content-Type: multipart/mixed; boundary="Apple-Mail=_38390E7B-ABC9-484E-9D64-60943944913A" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: Quoting filename in using facing log messages Message-Id: <080EEABE-6645-4A46-AB20-6285ADAC44FE@yesql.se> Date: Wed, 13 Sep 2023 13:48:12 +0200 To: PostgreSQL Hackers X-Mailer: Apple Mail (2.3696.120.41.1.3) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_38390E7B-ABC9-484E-9D64-60943944913A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Looking at ZQFUGOuS5DU4DsE4@paquier.xyz 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 --Apple-Mail=_38390E7B-ABC9-484E-9D64-60943944913A Content-Disposition: attachment; filename=quote_file_errmsg.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="quote_file_errmsg.diff" Content-Transfer-Encoding: 7bit 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); } --Apple-Mail=_38390E7B-ABC9-484E-9D64-60943944913A--