Make logged_events/logger config options lockable

This commit is contained in:
Xavier Delaruelle
2024-04-21 20:37:21 +02:00
parent d5dfe6caaa
commit 2d6cfa25a8
6 changed files with 30 additions and 12 deletions

View File

@@ -1034,8 +1034,8 @@ instance :instopt:`--without-modulepath<--with-modulepath>`):
Ignore environment variable superseding value for the listed configuration
options. Accepted option names in CONFIGLIST are :mconfig:`extra_siteconfig`
and :mconfig:`implicit_default` (each option name should be separated by
whitespace character). (default=)
, :mconfig:`implicit_default`, :mconfig:`logged_events` and :mconfig:`logger`
(each option name should be separated by whitespace character). (default=)
This installation option defines the default value of the
:mconfig:`locked_configs` configuration option which cannot not be changed
@@ -1045,6 +1045,9 @@ instance :instopt:`--without-modulepath<--with-modulepath>`):
.. versionadded:: 4.3
.. versionchanged:: 5.5
Configs ``logged_events`` and ``logger`` added
.. instopt:: --with-logged-events=EVENTLIST
Events to log. Accepted event names in EVENTLIST are ``all_eval``,

9
configure vendored
View File

@@ -359,9 +359,10 @@ Optional Packages:
--with-locked-configs=CONFIGLIST
ignore environment variable superseding value for
listed configuration options. accepted option names
in CONFIGLIST are \`extra_siteconfig' and
\`implicit_default' (each option name in CONFIGLIST
should be separated by \` ') []
in CONFIGLIST are \`extra_siteconfig',
\`implicit_default', \`logged_events' and \`logger'
(each option name in CONFIGLIST should be separated
by \` ') [$lockedconfigs]
--with-unload-match-order=VALUE
when unloading a module if multiple loaded modules
match the request, unload module loaded first
@@ -768,7 +769,7 @@ for arg in "$@"; do
fi ;;
--with-locked-configs*|--disable-locked-configs)
lockedconfigs=$(get_package_value "$arg") ;
allowedval=" extra_siteconfig implicit_default " ;
allowedval=" extra_siteconfig implicit_default logged_events logger " ;
for val in $lockedconfigs; do
if [ "${allowedval// $val /}" = "$allowedval" ]; then
echo_error "Bad value for option \`--with-locked-configs'"\

View File

@@ -4636,7 +4636,9 @@ ENVIRONMENT
This environment variable value supersedes the default value set in the
:mconfig:`logged_events` configuration option. It can be defined with the
:subcmd:`config` sub-command.
:subcmd:`config` sub-command. This environment variable is ignored if
:mconfig:`logged_events` has been declared locked in
:mconfig:`locked_configs` configuration option.
.. only:: html
@@ -4649,7 +4651,9 @@ ENVIRONMENT
This environment variable value supersedes the default value set in the
:mconfig:`logger` configuration option. It can be defined with the
:subcmd:`config` sub-command.
:subcmd:`config` sub-command. This environment variable is ignored if
:mconfig:`logger` has been declared locked in :mconfig:`locked_configs`
configuration option.
If :envvar:`MODULES_LOGGER` variable is set to an empty string, logger
will not be launched.

View File

@@ -14,6 +14,9 @@
# superseding
#lappendConf locked_configs implicit_default
# uncomment the following line to forbid log config options superseding
#lappendConf locked_configs logged_events logger
# define specific variables in modulefile interpreter context
#set modulefile_extra_vars {varname1 value1 varname2 value2}

View File

@@ -106,9 +106,9 @@ array set g_config_defs [list\
list_terse_output {MODULES_LIST_TERSE_OUTPUT {@listterseoutput@} 0 l\
{header idx variant alias indesym sym tag key} {} {} eltlist}\
locked_configs {{} {@lockedconfigs@} 0 o}\
logged_events {MODULES_LOGGED_EVENTS {@loggedevents@} 0 l {all_eval\
logged_events {MODULES_LOGGED_EVENTS {@loggedevents@} 1 l {all_eval\
req_eval req_cmd} {} {} eltlist}\
logger {MODULES_LOGGER {@loggercmd@} 0 s}\
logger {MODULES_LOGGER {@loggercmd@} 1 s}\
mcookie_check {MODULES_MCOOKIE_CHECK always 0 s {eval always}}\
mcookie_version_check {MODULES_MCOOKIE_VERSION_CHECK\
@mcookieversioncheck@ 0 b {0 1}}\

View File

@@ -233,6 +233,8 @@ array set configvalidkind [list\
array set configlockable [list\
extra_siteconfig 1\
implicit_default 1\
logged_events 1\
logger 1\
]
array set configkind [list\
@@ -582,11 +584,16 @@ foreach param [array names configkind] {
# append test
set ans [list [list set $configvar($param) $configset($param):$val]]
testouterr_cmd sh "config $param +$val" $ans {}
set tserr [err_conflocked $param]
testouterr_cmd sh "config $param +$val"\
[if_configlocked $param ERR $ans]\
[if_configlocked $param $tserr {}]
# subtract test
set ans [list [list set $configvar($param) {}]]
testouterr_cmd sh "config $param -$configset($param)" $ans {}
testouterr_cmd sh "config $param -$configset($param)"\
[if_configlocked $param ERR $ans]\
[if_configlocked $param $tserr {}]
}
}