1
0
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:
David Steele
2019-03-09 11:03:47 +02:00
parent cad6fedb7b
commit 60fe5b7365
9 changed files with 82 additions and 0 deletions

View File

@ -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));