You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-05 00:28:52 +02:00
Error when parameters are passed to a command that does not accept parameters.
This behavior allowed a command like this to run without error: pgbackrest backup --stanza=db full Even though it actually performed an incremental backup in most circumstances because the `full` parameter was ignored. Instead, output an error and exit. Suggested by Jason O'Donnell.
This commit is contained in:
@ -575,6 +575,22 @@ testRun(void)
|
||||
configParse(strLstSize(argList), strLstPtr(argList), false), OptionInvalidError,
|
||||
"option '--pg1-host' requires argument");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
argList = strLstNew();
|
||||
strLstAdd(argList, strNew(TEST_BACKREST_EXE));
|
||||
strLstAdd(argList, strNew("backup"));
|
||||
strLstAdd(argList, strNew("param1"));
|
||||
TEST_ERROR(
|
||||
configParse(strLstSize(argList), strLstPtr(argList), false), ParamInvalidError, "command does not allow parameters");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
argList = strLstNew();
|
||||
strLstAdd(argList, strNew(TEST_BACKREST_EXE));
|
||||
strLstAdd(argList, strNew("help"));
|
||||
strLstAdd(argList, strNew("backup"));
|
||||
strLstAdd(argList, strNew("param1"));
|
||||
TEST_RESULT_VOID(configParse(strLstSize(argList), strLstPtr(argList), false), "ignore params when help command");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
argList = strLstNew();
|
||||
strLstAdd(argList, strNew(TEST_BACKREST_EXE));
|
||||
|
Reference in New Issue
Block a user