pg_resetwal.c: duplicate '0' in hex character set for -l option validation

From: jinbinge <jinbinge(at)126(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: pg_resetwal.c: duplicate '0' in hex character set for -l option validation
Date: 2026-03-02 02:13:38
Message-ID: 5d04a537.1970.19cac5292a7.Coremail.jinbinge@126.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In pg_resetwal.c, around line 310, there's a minor redundancy in the character set string for validating the -l option argument.

The current code is:

case 'l':
if (strspn(optarg, "01234567890ABCDEFabcdef") != XLOG_FNAME_LEN)
{
pg_log_error("invalid argument for option %s", "-l");
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
exit(1);
}

The string "01234567890ABCDEFabcdef" contains a duplicated '0' in the digit portion ("01234567890" instead of "0123456789").

While this redundancy doesn't affect functionality (the allowed character set remains unchanged and still properly validates

hexadecimal digits 0-9, A-F, a-f), it could cause confusion for code readers.

For improved clarity and to follow conventional hexadecimal representation, I suggest using the standard character set:

"0123456789ABCDEFabcdef". This change would be purely cosmetic with no behavioral impact, but would eliminate the unnecessary duplication.

Thanks for considering this minor improvement.

Regards,
Jinbinge

Attachment Content-Type Size
v1-0001-Fix-duplicate-0-in-hex-character-set-for-l-option.patch application/octet-stream 907 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-03-02 02:15:36 Re: Defects with invalid stats data for expressions in extended stats
Previous Message Fujii Masao 2026-03-02 02:09:22 Re: [Patch]Add tab completion for DELETE ... USING