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
v1-0001-Fix-duplicate-0-in-hex-character-set-for-l-option.patch
Description: Binary data
