You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-05 00:28:52 +02:00
Fix incorrect error message for duplicate options in configuration files.
Duplicating a non-multi-value option was not throwing the correct message when the option was a boolean. The reason was that the option was being validated as a boolean before the multi-value check was being done. The validation code assumed it was operating on a string but was instead operating on a string list causing an assertion to fail. Since it's not safe to do the multi-value check so late, move it up to the command-line and configuration file parse phases instead. Reported by Jesper St John.
This commit is contained in:
@ -646,7 +646,7 @@ testRun(void)
|
||||
strLstAdd(argList, strNew("--compress-level=3"));
|
||||
TEST_ERROR(
|
||||
configParse(strLstSize(argList), strLstPtr(argList), false), OptionInvalidError,
|
||||
"option 'compress-level' cannot have multiple arguments");
|
||||
"option 'compress-level' cannot be set multiple times");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
argList = strLstNew();
|
||||
@ -966,7 +966,19 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(configParse(strLstSize(argList), strLstPtr(argList), false),
|
||||
OptionInvalidError,
|
||||
"option 'pg1-path' cannot have multiple arguments");
|
||||
"option 'pg1-path' cannot be set multiple times");
|
||||
|
||||
// Also test with a boolean option since this gets converted immediately and will blow up if it is multi
|
||||
storagePutNP(
|
||||
storageNewWriteNP(storageLocalWrite(), configFile),
|
||||
bufNewZ(
|
||||
"[db]\n"
|
||||
"start-fast=y\n"
|
||||
"start-fast=n\n"));
|
||||
|
||||
TEST_ERROR(configParse(strLstSize(argList), strLstPtr(argList), false),
|
||||
OptionInvalidError,
|
||||
"option 'start-fast' cannot be set multiple times");
|
||||
|
||||
// Test that log levels are set correctly when reset is enabled, then set them back to harness defaults
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user