From 2f7e139534de54fb19fa46edf7eeb7ecf00d8284 Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 17 Dec 2019 22:35:30 -0500 Subject: [PATCH] Error if option prefix and index total are not both defined. They are both required for indexed options. --- build/lib/pgBackRestBuild/Config/Data.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/lib/pgBackRestBuild/Config/Data.pm b/build/lib/pgBackRestBuild/Config/Data.pm index 07b7923b9..22f2c0707 100644 --- a/build/lib/pgBackRestBuild/Config/Data.pm +++ b/build/lib/pgBackRestBuild/Config/Data.pm @@ -2612,6 +2612,13 @@ foreach my $strCommand (sort(keys(%{$rhCommandDefine}))) #################################################################################################################################### foreach my $strKey (sort(keys(%hConfigDefine))) { + # Error if prefix and index total are not both defined + if ((defined($hConfigDefine{$strKey}{&CFGDEF_PREFIX}) && !defined($hConfigDefine{$strKey}{&CFGDEF_INDEX_TOTAL})) || + (!defined($hConfigDefine{$strKey}{&CFGDEF_PREFIX}) && defined($hConfigDefine{$strKey}{&CFGDEF_INDEX_TOTAL}))) + { + confess &log(ASSERT, "CFGDEF_PREFIX and CFGDEF_INDEX_TOTAL must both be defined (or neither) for option '${strKey}'"); + } + # If the define is a scalar then copy the entire define from the referenced option if (defined($hConfigDefine{$strKey}{&CFGDEF_INHERIT})) {