You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-05 00:28:52 +02:00
Fix help when a valid option is invalid for the specified command.
Getting help for a valid option that was invalid for the command would segfault. Add a check to ensure the option is valid for the command's default role.
This commit is contained in:
@ -307,6 +307,14 @@ testRun(void)
|
||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "parse bogus option");
|
||||
TEST_ERROR(helpRender(), OptionInvalidError, "option 'BOGUS' is not valid for command 'archive-push'");
|
||||
|
||||
argList = strLstNew();
|
||||
strLstAddZ(argList, "/path/to/pgbackrest");
|
||||
strLstAddZ(argList, CFGCMD_HELP);
|
||||
strLstAddZ(argList, CFGCMD_ARCHIVE_PUSH);
|
||||
strLstAddZ(argList, CFGOPT_PROCESS);
|
||||
TEST_RESULT_VOID(harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)), "parse option invalid for command");
|
||||
TEST_ERROR(helpRender(), OptionInvalidError, "option 'process' is not valid for command 'archive-push'");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
const char *optionHelp = strZ(strNewFmt(
|
||||
"%s - 'archive-push' command - 'buffer-size' option help\n"
|
||||
|
Reference in New Issue
Block a user