Ignore (with warning) unknown vars in --options

This commit is contained in:
Richard Hansen 2024-06-29 02:34:28 -04:00
parent 1f31b0e570
commit 89c84f9f07

View file

@ -2002,6 +2002,11 @@ sub init_config {
# TODO: This might grab an arbitrary protocol-specific variable, which could cause # TODO: This might grab an arbitrary protocol-specific variable, which could cause
# surprising behavior. # surprising behavior.
my $def = $variables{'merged'}{$k}; my $def = $variables{'merged'}{$k};
if (!$def) {
warning("ignoring unknown setting '$k=$globals{$k}'");
delete($globals{$k});
next;
}
# TODO: Isn't $globals{$k} guaranteed to be defined here? Otherwise $k wouldn't appear in # TODO: Isn't $globals{$k} guaranteed to be defined here? Otherwise $k wouldn't appear in
# %globals. # %globals.
my $ovalue = $globals{$k} // $def->{'default'}; my $ovalue = $globals{$k} // $def->{'default'};