You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-27 00:21:08 +02:00
Fix issue passing --no-config to embedded Perl.
Reported by Ibrahim Edib Kokdemir.
This commit is contained in:
@ -22,6 +22,14 @@
|
||||
|
||||
<p>Fix <br-option>--target-action</br-option> and <br-option>--recovery-option</br-option> options being reported as invalid when restoring with <br-option>--type=immediate</br-option>.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-ideator id="kokdemir.ibrahim.edib"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Fix issue passing <br-option>--no-config</br-option> to embedded Perl.</p>
|
||||
</release-item>
|
||||
</release-bug-list>
|
||||
|
||||
<release-improvement-list>
|
||||
@ -4198,6 +4206,11 @@
|
||||
<contributor-id type="github">nikhilchandra-kulkarni</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="kokdemir.ibrahim.edib">
|
||||
<contributor-name-display>Ibrahim Edib Kokdemir</contributor-name-display>
|
||||
<contributor-id type="github">Edib</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="lardiere.sebastien">
|
||||
<contributor-name-display>Lardi&egrave;re S&eacute;bastien</contributor-name-display>
|
||||
<contributor-id type="github">slardiere</contributor-id>
|
||||
|
@ -20,46 +20,50 @@ perlOptionJson()
|
||||
if (!cfgOptionValid(optionId))
|
||||
continue;
|
||||
|
||||
// Output option
|
||||
if (strSize(result) != 1)
|
||||
strCat(result, ",");
|
||||
|
||||
strCatFmt(result, "\"%s\":{", cfgOptionName(optionId));
|
||||
String *option = strNew("");
|
||||
|
||||
// Output source unless it is default
|
||||
if (cfgOptionSource(optionId) != cfgSourceDefault)
|
||||
{
|
||||
strCat(result, "\"source\":\"");
|
||||
strCat(option, "\"source\":\"");
|
||||
|
||||
if (cfgOptionSource(optionId) == cfgSourceParam)
|
||||
strCat(result, "param");
|
||||
strCat(option, "param");
|
||||
else
|
||||
strCat(result, "config");
|
||||
strCat(option, "config");
|
||||
|
||||
strCat(result, "\"");
|
||||
|
||||
// Add a comma if another define will be added
|
||||
if (cfgOptionTest(optionId))
|
||||
strCat(result, ",");
|
||||
strCat(option, "\"");
|
||||
}
|
||||
|
||||
// If option was negated
|
||||
if (cfgOptionNegate(optionId))
|
||||
strCatFmt(result, "\"negate\":%s", strPtr(varStrForce(varNewBool(true))));
|
||||
{
|
||||
// Add comma if needed
|
||||
if (strSize(option) != 0)
|
||||
strCat(option, ",");
|
||||
|
||||
strCatFmt(option, "\"negate\":%s", strPtr(varStrForce(varNewBool(true))));
|
||||
}
|
||||
else
|
||||
{
|
||||
// If option is reset then add flag
|
||||
if (cfgOptionReset(optionId))
|
||||
strCatFmt(result, "\"reset\":%s", strPtr(varStrForce(varNewBool(true))));
|
||||
{
|
||||
// Add comma if needed
|
||||
if (strSize(option) != 0)
|
||||
strCat(option, ",");
|
||||
|
||||
strCatFmt(option, "\"reset\":%s", strPtr(varStrForce(varNewBool(true))));
|
||||
}
|
||||
|
||||
// If has a value
|
||||
if (cfgOptionTest(optionId))
|
||||
{
|
||||
// If option is reset, then add a comma separator before setting the value
|
||||
if (cfgOptionReset(optionId))
|
||||
strCat(result, ",");
|
||||
// Add comma if needed
|
||||
if (strSize(option) != 0)
|
||||
strCat(option, ",");
|
||||
|
||||
strCat(result, "\"value\":");
|
||||
strCat(option, "\"value\":");
|
||||
|
||||
switch (cfgDefOptionType(cfgOptionDefIdFromId(optionId)))
|
||||
{
|
||||
@ -67,13 +71,13 @@ perlOptionJson()
|
||||
case cfgDefOptTypeFloat:
|
||||
case cfgDefOptTypeInteger:
|
||||
{
|
||||
strCat(result, strPtr(varStrForce(cfgOption(optionId))));
|
||||
strCat(option, strPtr(varStrForce(cfgOption(optionId))));
|
||||
break;
|
||||
}
|
||||
|
||||
case cfgDefOptTypeString:
|
||||
{
|
||||
strCatFmt(result, "\"%s\"", strPtr(cfgOptionStr(optionId)));
|
||||
strCatFmt(option, "\"%s\"", strPtr(cfgOptionStr(optionId)));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -82,19 +86,19 @@ perlOptionJson()
|
||||
const KeyValue *valueKv = cfgOptionKv(optionId);
|
||||
const VariantList *keyList = kvKeyList(valueKv);
|
||||
|
||||
strCat(result, "{");
|
||||
strCat(option, "{");
|
||||
|
||||
for (unsigned int listIdx = 0; listIdx < varLstSize(keyList); listIdx++)
|
||||
{
|
||||
if (listIdx != 0)
|
||||
strCat(result, ",");
|
||||
strCat(option, ",");
|
||||
|
||||
strCatFmt(
|
||||
result, "\"%s\":\"%s\"", strPtr(varStr(varLstGet(keyList, listIdx))),
|
||||
option, "\"%s\":\"%s\"", strPtr(varStr(varLstGet(keyList, listIdx))),
|
||||
strPtr(varStr(kvGet(valueKv, varLstGet(keyList, listIdx)))));
|
||||
}
|
||||
|
||||
strCat(result, "}");
|
||||
strCat(option, "}");
|
||||
|
||||
break;
|
||||
}
|
||||
@ -103,17 +107,17 @@ perlOptionJson()
|
||||
{
|
||||
StringList *valueList = strLstNewVarLst(cfgOptionLst(optionId));
|
||||
|
||||
strCat(result, "{");
|
||||
strCat(option, "{");
|
||||
|
||||
for (unsigned int listIdx = 0; listIdx < strLstSize(valueList); listIdx++)
|
||||
{
|
||||
if (listIdx != 0)
|
||||
strCat(result, ",");
|
||||
strCat(option, ",");
|
||||
|
||||
strCatFmt(result, "\"%s\":true", strPtr(strLstGet(valueList, listIdx)));
|
||||
strCatFmt(option, "\"%s\":true", strPtr(strLstGet(valueList, listIdx)));
|
||||
}
|
||||
|
||||
strCat(result, "}");
|
||||
strCat(option, "}");
|
||||
|
||||
break;
|
||||
}
|
||||
@ -121,7 +125,11 @@ perlOptionJson()
|
||||
}
|
||||
}
|
||||
|
||||
strCat(result, "}");
|
||||
// Add option to main JSON blob
|
||||
if (strSize(result) != 1)
|
||||
strCat(result, ",");
|
||||
|
||||
strCatFmt(result, "\"%s\":{%s}", cfgOptionName(optionId), strPtr(option));
|
||||
}
|
||||
|
||||
strCat(result, "}");
|
||||
|
@ -21,6 +21,10 @@ testRun()
|
||||
cfgOptionValidSet(cfgOptCompress, true);
|
||||
cfgOptionSet(cfgOptCompress, cfgSourceParam, varNewBool(true));
|
||||
|
||||
cfgOptionValidSet(cfgOptConfig, true);
|
||||
cfgOptionNegateSet(cfgOptConfig, true);
|
||||
cfgOptionSet(cfgOptConfig, cfgSourceParam, NULL);
|
||||
|
||||
cfgOptionValidSet(cfgOptOnline, true);
|
||||
cfgOptionNegateSet(cfgOptOnline, true);
|
||||
cfgOptionSet(cfgOptOnline, cfgSourceParam, varNewBool(false));
|
||||
@ -30,7 +34,7 @@ testRun()
|
||||
|
||||
cfgOptionValidSet(cfgOptBackupStandby, true);
|
||||
cfgOptionResetSet(cfgOptBackupStandby, true);
|
||||
cfgOptionSet(cfgOptBackupStandby, cfgSourceDefault, varNewBool(false));
|
||||
cfgOptionSet(cfgOptBackupStandby, cfgSourceParam, varNewBool(false));
|
||||
|
||||
cfgOptionValidSet(cfgOptProtocolTimeout, true);
|
||||
cfgOptionSet(cfgOptProtocolTimeout, cfgSourceParam, varNewDbl(1.1));
|
||||
@ -48,9 +52,10 @@ testRun()
|
||||
strPtr(perlOptionJson()),
|
||||
"{"
|
||||
"\"archive-queue-max\":{\"source\":\"param\",\"value\":999999999999},"
|
||||
"\"backup-standby\":{\"reset\":true,\"value\":false},"
|
||||
"\"backup-standby\":{\"source\":\"param\",\"reset\":true,\"value\":false},"
|
||||
"\"compress\":{\"source\":\"param\",\"value\":true},"
|
||||
"\"compress-level\":{\"source\":\"config\",\"value\":3},"
|
||||
"\"config\":{\"source\":\"param\",\"negate\":true},"
|
||||
"\"online\":{\"source\":\"param\",\"negate\":true},"
|
||||
"\"pg1-host\":{\"reset\":true},"
|
||||
"\"protocol-timeout\":{\"source\":\"param\",\"value\":1.1},"
|
||||
|
Reference in New Issue
Block a user