pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH] remove incorrect comment in pg_resetwal.c
6+ messages / 5 participants
[nested] [flat]

* [PATCH] remove incorrect comment in pg_resetwal.c
@ 2026-01-16 06:45  Gavin LYU <gavin790417@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Gavin LYU @ 2026-01-16 06:45 UTC (permalink / raw)
  To: pgsql-hackers@lists.postgresql.org

Hi Hackers,


While reading the code, I noticed an incorrect comment in the main() function
of src/bin/pg_resetwal/pg_resetwal.c.

In the block handling the -e option, there’s a comment that appears to be a
copy-paste error (line 190 and 191). It references a second %s, but none
exists in that format string. Moreover, similar argument-handling code for
other options doesn’t include such a comment.

I believe it should be removed.
Attached is a patch that fixes this issue.


Best regards,
--
Gavin LYU

Attachments:

0001-PATCH-remove-wrong-comment-in-pg_resetwal.c.patch (application/octet-stream, 1.1K) download From 7b3542b4fe4edbdab20b9a75391d86096c07aca0 Mon Sep 17 00:00:00 2001 From: Gavin LYU <gavin790417@gmail.com> Date: Fri, 16 Jan 2026 13:44:36 +0800 Subject: [PATCH] remove incorrect comment in pg_resetwal.c Remove incorrect comment in main() function of pg_resetwal.c Obviously the comment is wrong as there is no "second %s" at all. It should be a copy-paste error. Author: Gavin LYU <gavin790417@gmail.com> --- src/bin/pg_resetwal/pg_resetwal.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index b2c4b9db395..da6717990f4 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -187,8 +187,6 @@ main(int argc, char *argv[]) next_xid_epoch_val = strtouint32_strict(optarg, &endptr, 0); if (endptr == optarg || *endptr != '\0' || errno != 0) { - /*------ - translator: the second %s is a command line argument (-e, etc) */ pg_log_error("invalid argument for option %s", "-e"); pg_log_error_hint("Try \"%s --help\" for more information.", progname); exit(1); -- 2.43.0
^ permalink raw reply [nested|flat] 6+ messages in thread

* Re: [PATCH] remove incorrect comment in pg_resetwal.c
@ 2026-01-16 06:53  Michael Paquier <michael@paquier.xyz>
  parent: Gavin LYU <gavin790417@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Michael Paquier @ 2026-01-16 06:53 UTC (permalink / raw)
  To: Gavin LYU <gavin790417@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org

On Fri, Jan 16, 2026 at 02:45:42PM +0800, Gavin LYU wrote:
> In the block handling the -e option, there’s a comment that appears to be a
> copy-paste error (line 190 and 191). It references a second %s, but none
> exists in that format string. Moreover, similar argument-handling code for
> other options doesn’t include such a comment.
> 
> I believe it should be removed.

I disagree.  This note still looks helpful to me when it comes to
translation even if it is incorrect: the %s markup refers to an option
switch.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [PATCH] remove incorrect comment in pg_resetwal.c
@ 2026-01-16 10:09  David Rowley <dgrowleyml@gmail.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 2 replies; 6+ messages in thread

From: David Rowley @ 2026-01-16 10:09 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Gavin LYU <gavin790417@gmail.com>; pgsql-hackers@lists.postgresql.org

On Fri, 16 Jan 2026 at 19:53, Michael Paquier <michael@paquier.xyz> wrote:
>
> On Fri, Jan 16, 2026 at 02:45:42PM +0800, Gavin LYU wrote:
> > In the block handling the -e option, there’s a comment that appears to be a
> > copy-paste error (line 190 and 191). It references a second %s, but none
> > exists in that format string. Moreover, similar argument-handling code for
> > other options doesn’t include such a comment.
> >
> > I believe it should be removed.
>
> I disagree.  This note still looks helpful to me when it comes to
> translation even if it is incorrect: the %s markup refers to an option
> switch.

I think fixing it rather than removing it is the way to go. cc8d41511
removed the first va arg and didn't update the comment.

git diff cc8d41511~1..cc8d41511 -- */pg_resetwal.c | grep translator -C 3
@@ -156,13 +157,13 @@ main(int argc, char *argv[])
                                {
                                        /*------
                                          translator: the second %s is
a command line argument (-e, etc) */
-                                       fprintf(stderr, _("%s: invalid
argument for option %s\n"), progname, "-e");
+                                       pg_log_error("invalid argument
for option %s", "-e");
                                        fprintf(stderr, _("Try \"%s
--help\" for more information.\n"), progname);

We should delete "the second"

David





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [PATCH] remove incorrect comment in pg_resetwal.c
@ 2026-01-16 10:41  Álvaro Herrera <alvherre@kurilemu.de>
  parent: David Rowley <dgrowleyml@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Álvaro Herrera @ 2026-01-16 10:41 UTC (permalink / raw)
  To: David Rowley <dgrowleyml@gmail.com>; +Cc: Michael Paquier <michael@paquier.xyz>; Gavin LYU <gavin790417@gmail.com>; pgsql-hackers@lists.postgresql.org

On 2026-Jan-16, David Rowley wrote:

> I think fixing it rather than removing it is the way to go. cc8d41511
> removed the first va arg and didn't update the comment.
> 
> git diff cc8d41511~1..cc8d41511 -- */pg_resetwal.c | grep translator -C 3
> @@ -156,13 +157,13 @@ main(int argc, char *argv[])
>                                 {
>                                         /*------
>                                           translator: the second %s is
> a command line argument (-e, etc) */
> -                                       fprintf(stderr, _("%s: invalid
> argument for option %s\n"), progname, "-e");
> +                                       pg_log_error("invalid argument
> for option %s", "-e");
>                                         fprintf(stderr, _("Try \"%s
> --help\" for more information.\n"), progname);

Right.  So the fix is to remove the word "second".  But there are more
mistakes of the same ilk in the same commit, visible if you remove the
"-- */pg_resetwal.c" part of your command line.

So I propose to park the following in Michael's trivial fixes branch.

inline patch 1: src/bin/pg_basebackup/pg_receivewal.c, src/bin/pg_resetwal/pg_resetwal.c (+2/-2 lines) download inline-1.patchdiff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c index 4f9a7b076ca..ddfec298fb7 100644 --- a/src/bin/pg_basebackup/pg_receivewal.c +++ b/src/bin/pg_basebackup/pg_receivewal.c @@ -770,7 +770,7 @@ main(int argc, char **argv) if (replication_slot == NULL && (do_drop_slot || do_create_slot)) { - /* translator: second %s is an option name */ + /* translator: %s is an option name */ pg_log_error("%s needs a slot to be specified using --slot", do_drop_slot ? "--drop-slot" : "--create-slot"); pg_log_error_hint("Try \"%s --help\" for more information.", progname); diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index b2c4b9db395..2e3dfd7c94a 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -188,7 +188,7 @@ main(int argc, char *argv[]) if (endptr == optarg || *endptr != '\0' || errno != 0) { /*------ - translator: the second %s is a command line argument (-e, etc) */ + translator: %s is a command line argument (-e, etc) */ pg_log_error("invalid argument for option %s", "-e"); pg_log_error_hint("Try \"%s --help\" for more information.", progname); exit(1);
-- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "No tengo por qué estar de acuerdo con lo que pienso" (Carlos Caszeli) ^ permalink raw reply [nested|flat] 6+ messages in thread

* Re: [PATCH] remove incorrect comment in pg_resetwal.c
@ 2026-01-16 15:51  Fujii Masao <masao.fujii@gmail.com>
  parent: David Rowley <dgrowleyml@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Fujii Masao @ 2026-01-16 15:51 UTC (permalink / raw)
  To: David Rowley <dgrowleyml@gmail.com>; +Cc: Michael Paquier <michael@paquier.xyz>; Gavin LYU <gavin790417@gmail.com>; pgsql-hackers@lists.postgresql.org

On Fri, Jan 16, 2026 at 7:10 PM David Rowley <dgrowleyml@gmail.com> wrote:
>
> On Fri, 16 Jan 2026 at 19:53, Michael Paquier <michael@paquier.xyz> wrote:
> >
> > On Fri, Jan 16, 2026 at 02:45:42PM +0800, Gavin LYU wrote:
> > > In the block handling the -e option, there’s a comment that appears to be a
> > > copy-paste error (line 190 and 191). It references a second %s, but none
> > > exists in that format string. Moreover, similar argument-handling code for
> > > other options doesn’t include such a comment.
> > >
> > > I believe it should be removed.
> >
> > I disagree.  This note still looks helpful to me when it comes to
> > translation even if it is incorrect: the %s markup refers to an option
> > switch.
>
> I think fixing it rather than removing it is the way to go. cc8d41511
> removed the first va arg and didn't update the comment.
>
> git diff cc8d41511~1..cc8d41511 -- */pg_resetwal.c | grep translator -C 3
> @@ -156,13 +157,13 @@ main(int argc, char *argv[])
>                                 {
>                                         /*------
>                                           translator: the second %s is
> a command line argument (-e, etc) */
> -                                       fprintf(stderr, _("%s: invalid
> argument for option %s\n"), progname, "-e");
> +                                       pg_log_error("invalid argument
> for option %s", "-e");
>                                         fprintf(stderr, _("Try \"%s
> --help\" for more information.\n"), progname);
>
> We should delete "the second"

+1

Commit cc8d41511 made a similar change in pg_receivewal.c, as follows.
This should be fixed as well.

  /* translator: second %s is an option name */
- fprintf(stderr, _("%s: %s needs a slot to be specified using
--slot\n"), progname,
+ pg_log_error("%s needs a slot to be specified using --slot",

Regards,


-- 
Fujii Masao





^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: [PATCH] remove incorrect comment in pg_resetwal.c
@ 2026-01-16 22:04  Michael Paquier <michael@paquier.xyz>
  parent: Álvaro Herrera <alvherre@kurilemu.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2026-01-16 22:04 UTC (permalink / raw)
  To: Álvaro Herrera <alvherre@kurilemu.de>; +Cc: David Rowley <dgrowleyml@gmail.com>; Gavin LYU <gavin790417@gmail.com>; pgsql-hackers@lists.postgresql.org

On Fri, Jan 16, 2026 at 11:41:58AM +0100, Alvaro Herrera wrote:
> Right.  So the fix is to remove the word "second".  But there are more
> mistakes of the same ilk in the same commit, visible if you remove the
> "-- */pg_resetwal.c" part of your command line.
> 
> So I propose to park the following in Michael's trivial fixes
> branch.

Sounds about right to me.  Integrated now.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-01-16 22:04 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-01-16 06:45 [PATCH] remove incorrect comment in pg_resetwal.c Gavin LYU <gavin790417@gmail.com>
2026-01-16 06:53 ` Michael Paquier <michael@paquier.xyz>
2026-01-16 10:09   ` David Rowley <dgrowleyml@gmail.com>
2026-01-16 10:41     ` Álvaro Herrera <alvherre@kurilemu.de>
2026-01-16 22:04       ` Michael Paquier <michael@paquier.xyz>
2026-01-16 15:51     ` Fujii Masao <masao.fujii@gmail.com>

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