From cc52787220cc7cf7b8751db4c49edcb76a357c3e Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Sun, 19 Jul 2026 10:12:07 +0200 Subject: [PATCH 01/11] Add domainname configuration option Add domainname configuration option that defines the command to execute to fetch domain name that is set into the domainname state and which will be returned by "uname domain" modulefile command. Set to "domainname" by default. When configuration is modified it sets the MODULES_DOMAINNAME environment variable. Fixes #645 Signed-off-by: Xavier Delaruelle --- tcl/init.tcl.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tcl/init.tcl.in b/tcl/init.tcl.in index 273141146..f580f4c01 100644 --- a/tcl/init.tcl.in +++ b/tcl/init.tcl.in @@ -27,7 +27,7 @@ array set g_state_defs [list\ autoinit {0}\ cache_mcookie_version {5.3}\ clock_seconds { initStateClockSeconds}\ - domainname { {runCommand domainname}}\ + domainname { initStateDomainname}\ error_count {0}\ extra_siteconfig_loaded {0}\ false_rendered {0}\ @@ -97,6 +97,7 @@ array set g_config_defs [list\ colors {MODULES_COLORS {} 0 l {} {} initConfColors}\ conflict_unload {MODULES_CONFLICT_UNLOAD @conflictunload@ 0 b {0 1}}\ csh_limit {{} 4000 0 i}\ + domainname {MODULES_DOMAINNAME {domainname} 0 s}\ extra_siteconfig {MODULES_SITECONFIG 1 s {}}\ editor {MODULES_EDITOR {@editor@} 0 s {} {} initConfEditor}\ hide_auto_loaded {MODULES_HIDE_AUTO_LOADED 0 0 b {0 1}}\ @@ -517,6 +518,10 @@ proc initStateLinkedEnvvars {} { return [array get ::g_linkedEnvvars] } +proc initStateDomainname {} { + return [runCommand {*}[getConf domainname]] +} + # Determine if logging need to be started proc initStateLogging {} { set logger_not_empty [string length [lindex [getConf logger] 0]] From b478fbd5696382b7969b2f16aab2857e9ded91bb Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Sun, 19 Jul 2026 10:34:44 +0200 Subject: [PATCH 02/11] install: add --with-domainname{,-opts} configure options Introduce the --with-domainname and --with-domainname-opts configure options to choose at installation time the default domainname command and its options to fetch domain. Default domainname is 'domainname' and its default options are ''. Signed-off-by: Xavier Delaruelle --- Makefile | 7 +++++++ Makefile.inc.in | 4 ++++ configure | 30 +++++++++++++++++++++++++++++- site.exp.in | 7 +++++++ tcl/init.tcl.in | 2 +- 5 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fbe092472..be3ecc4ca 100644 --- a/Makefile +++ b/Makefile @@ -315,6 +315,12 @@ else loggercmd := $(logger) endif +ifneq ($(domainnameopts),) + domainnamecmd := $(domainname) $(domainnameopts) +else + domainnamecmd := $(domainname) +endif + ifeq ($(color),y) setcolor := auto else @@ -457,6 +463,7 @@ sed -e 's|@prefix@|$(prefix)|g' \ -e 's|@loggedevents@|$(loggedevents)|g' \ -e 's|@loggercmd@|$(loggercmd)|g' \ -e 's|@pagercmd@|$(pagercmd)|g' \ + -e 's|@domainnamecmd@|$(domainnamecmd)|g' \ -e 's|@paginate@|$(setpaginate)|g' \ -e 's|@verbosity@|$(verbosity)|g' \ -e 's|@color@|$(setcolor)|g' \ diff --git a/Makefile.inc.in b/Makefile.inc.in index 6aca1ca78..29ee6019e 100644 --- a/Makefile.inc.in +++ b/Makefile.inc.in @@ -68,6 +68,10 @@ usemanpath := @usemanpath@ # compress ChangeLog file compressedchangelog := @compressedchangelog@ +# domainname setup +domainname := @domainname@ +domainnameopts := @domainnameopts@ + # logger setup loggedevents := @loggedevents@ logger := @logger@ diff --git a/configure b/configure index 66b5ade05..56d593519 100755 --- a/configure +++ b/configure @@ -42,12 +42,13 @@ zshcompletiondir tcllinter tcllinteropts nagelfardatadir nagelfaraddons \ stickypurge uniquenameloaded abortonerror sourcecache logger loggeropts \ loggedevents conflictunload spideroutput spiderterseoutput spiderindepth \ emacsdatadir emacsaddons requirevia compressedchangelog paginate initenvvars \ -setpythonpath appendpythonpath" +setpythonpath appendpythonpath domainname domainnameopts" libarglist=() # flags to know if argument has been specified on command-line defpageropts=1 defloggeropts=1 +defdomainnameopts=1 # set argument default values prefix=/usr/local/Modules @@ -100,6 +101,8 @@ VERSION= RELEASE= # shellcheck disable=SC2034 initconfin=etcdir +domainname='domainname' +domainnameopts='' loggedevents= logger='logger' loggeropts='-t modules' @@ -387,6 +390,13 @@ Optional Packages: Rendition (SGR) code (elements in SGRLIST are separated by \`:') [$darkbgcolors] + --with-domainname=BIN name or full path of default domainname program to use + use to fetch domain name returned by \`uname domain' + (can be superseded at run-time by environment + variable) [$domainname] + --with-domainname-opts=OPTLIST + settings to apply to default domainname program + [$domainnameopts] --with-editor=BIN name or full path of default editor program to use to edit modulefiles [$editor] --with-fishcompletiondir=DIR @@ -850,6 +860,11 @@ for arg in "$@"; do check_and_get_package_value "initconfin" "$arg" "$allowedval" ;; --with-tclsh=*|--without-tclsh) tclshbin=$(get_package_value "$arg") ;; + --with-domainname=*|--without-domainname) + domainname=$(get_package_value "$arg" "") ;; + --with-domainname-opts=*|--without-domainname-opts) + domainnameopts=$(get_package_value "$arg" "") + defdomainnameopts=0 ;; --with-logger=*|--without-logger) logger=$(get_package_value "$arg" "") ;; --with-logger-opts=*|--without-logger-opts) @@ -1131,6 +1146,19 @@ check_requirement 'basename' '' "PATH=$binsearchpath" # shellcheck disable=SC2034 BASENAME=$reqpath +# get domainname program location from standard PATHs or /usr/local/bin +# or validate location passed as argument +if [ -n "$domainname" ]; then + check_requirement "$domainname" '' "PATH=$binsearchpath" + domainname=$reqpath +fi +# adapt domainname program settings dependings of specified args +# code not needed at the moment as no options defined by default, but useful if changed in the future +if [ $defdomainnameopts -eq 1 ] && [ "${domainname##*/}" != 'domainname' ]; then + domainnameopts='' + echo_warning "As chosen domainname is not \`domainname', default domainname options are cleared" +fi + # get logger program location from standard PATHs or /usr/local/bin # or validate location passed as argument if [ -n "$logger" ]; then diff --git a/site.exp.in b/site.exp.in index dc7963f58..a38bebbc8 100644 --- a/site.exp.in +++ b/site.exp.in @@ -58,6 +58,13 @@ if {$install_loggeropts ne {}} { append install_loggercmd " $install_loggeropts" } +set install_domainname "@domainname@" +set install_domainnameopts "@domainnameopts@" +set install_domainnamecmd $install_domainname +if {$install_domainnameopts ne {}} { + append install_domainnamecmd " $install_domainnameopts" +} + set install_verbosity "@verbosity@" set install_color "@color@" diff --git a/tcl/init.tcl.in b/tcl/init.tcl.in index f580f4c01..66571f6a7 100644 --- a/tcl/init.tcl.in +++ b/tcl/init.tcl.in @@ -97,7 +97,7 @@ array set g_config_defs [list\ colors {MODULES_COLORS {} 0 l {} {} initConfColors}\ conflict_unload {MODULES_CONFLICT_UNLOAD @conflictunload@ 0 b {0 1}}\ csh_limit {{} 4000 0 i}\ - domainname {MODULES_DOMAINNAME {domainname} 0 s}\ + domainname {MODULES_DOMAINNAME {@domainnamecmd@} 0 s}\ extra_siteconfig {MODULES_SITECONFIG 1 s {}}\ editor {MODULES_EDITOR {@editor@} 0 s {} {} initConfEditor}\ hide_auto_loaded {MODULES_HIDE_AUTO_LOADED 0 0 b {0 1}}\ From 940d156e960176976097a6847b8ea529df88d00c Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Mon, 20 Jul 2026 09:19:22 +0200 Subject: [PATCH 03/11] init: add domainname config to completion script Signed-off-by: Xavier Delaruelle --- init/Makefile | 2 +- init/fish_completion | 2 +- init/zsh-functions/_module.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/init/Makefile b/init/Makefile index 675c57935..e30fc1513 100644 --- a/init/Makefile +++ b/init/Makefile @@ -136,7 +136,7 @@ comp_lint_opts := -a -i --all --icase comp_modtosh_opts := --auto --no-auto --force -f --icase -i comp_path_opts := -d --delim --duplicates comp_rm_path_opts := -d --delim --index -comp_config_opts := --dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement init_envvars info_extension linked_envvars list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277 +comp_config_opts := --dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact domainname editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement init_envvars info_extension linked_envvars list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277 define translate-in-script $(ECHO_GEN) diff --git a/init/fish_completion b/init/fish_completion index 4e50f9ac1..9a670cd9f 100644 --- a/init/fish_completion +++ b/init/fish_completion @@ -87,7 +87,7 @@ complete -c module -n '__fish_module_use_stashlist' -f -a "(module stashlist --c /Stash collection list\$/d; \ /:\$/d; \ /:ERROR:/d;')" -complete -c module -n '__fish_module_use_config' -f -a "--dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement init_envvars info_extension linked_envvars list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277" +complete -c module -n '__fish_module_use_config' -f -a "--dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact domainname editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement init_envvars info_extension linked_envvars list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277" complete -f -n '__fish_module_no_subcommand' -c module -a 'help' --description 'Print this or modulefile(s) help info' complete -f -n '__fish_module_no_subcommand' -c module -a 'avail' --description 'List all or matching available modules' diff --git a/init/zsh-functions/_module.in b/init/zsh-functions/_module.in index 3be62d9c5..bb80c0836 100644 --- a/init/zsh-functions/_module.in +++ b/init/zsh-functions/_module.in @@ -378,7 +378,7 @@ _module() { _arguments \ '--dump-state[Report each state value of current Modules execution]' \ '--reset[Unset environment variable relative to configuration key]' \ - '1:configuration key:(abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement init_envvars info_extension linked_envvars list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277)' \ + '1:configuration key:(abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact domainname editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement init_envvars info_extension linked_envvars list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days non_exportable_tags pager paginate path_entry_reorder protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277)' \ && ret=0 ;; (edit) From 7b3efa5379bfb63eb058b7ad8751ab6b81d7b1bd Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Mon, 20 Jul 2026 09:28:52 +0200 Subject: [PATCH 04/11] ts: test domainname config option Signed-off-by: Xavier Delaruelle --- testsuite/install.00-init/010-environ.exp | 3 +++ testsuite/modules.00-init/010-environ.exp | 3 +++ testsuite/modules.70-maint/220-config.exp | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/testsuite/install.00-init/010-environ.exp b/testsuite/install.00-init/010-environ.exp index e2fbfd8a6..848056570 100644 --- a/testsuite/install.00-init/010-environ.exp +++ b/testsuite/install.00-init/010-environ.exp @@ -94,6 +94,9 @@ setenv_var MODULES_PAGINATE 1 unsetenv_var MODULES_LOGGED_EVENTS unsetenv_var MODULES_LOGGER +# clean any domainname configuration +unsetenv_var MODULES_DOMAINNAME + # clean any environment variable-specific configuration setenv_var MODULES_INIT_ENVVARS {} unsetenv_var MODULES_PROTECTED_ENVVARS diff --git a/testsuite/modules.00-init/010-environ.exp b/testsuite/modules.00-init/010-environ.exp index 93a6fe8a7..e001f4f10 100644 --- a/testsuite/modules.00-init/010-environ.exp +++ b/testsuite/modules.00-init/010-environ.exp @@ -95,6 +95,9 @@ setenv_var MODULES_PAGINATE 1 unsetenv_var MODULES_LOGGED_EVENTS unsetenv_var MODULES_LOGGER +# clean any domainname configuration +unsetenv_var MODULES_DOMAINNAME + # clean any environment variable-specific configuration setenv_var MODULES_INIT_ENVVARS {} unsetenv_var MODULES_PROTECTED_ENVVARS diff --git a/testsuite/modules.70-maint/220-config.exp b/testsuite/modules.70-maint/220-config.exp index f855fa811..13fc48a3e 100644 --- a/testsuite/modules.70-maint/220-config.exp +++ b/testsuite/modules.70-maint/220-config.exp @@ -74,6 +74,7 @@ array set configdfl [list\ colors [expr {$install_termbg eq {dark} ? $valid_darkbgcolors : $valid_lightbgcolors}]\ conflict_unload [expr {$install_conflictunload eq {y}}]\ contact root@localhost\ + domainname "$install_domainnamecmd"\ editor "$install_editor"\ extended_default [expr {$install_extendeddefault eq {y}}]\ extra_siteconfig \ @@ -147,6 +148,7 @@ array set configvar [list\ colors MODULES_COLORS\ conflict_unload MODULES_CONFLICT_UNLOAD\ contact MODULECONTACT\ + domainname MODULES_DOMAINNAME\ editor MODULES_EDITOR\ extended_default MODULES_EXTENDED_DEFAULT\ extra_siteconfig MODULES_SITECONFIG\ @@ -426,6 +428,8 @@ foreach param [array names configvar] { set val foo=% } elseif {$param eq {pager}} { set val $configdfl(pager) + } elseif {$param eq {domainname}} { + set val $configdfl(domainname) } elseif {$param eq {init_envvars}} { set val FOO=val } elseif {$param eq {linked_envvars}} { From 5db6651cb7b59727a26bdfb3e5e0eddeea261240 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Mon, 20 Jul 2026 09:49:17 +0200 Subject: [PATCH 05/11] doc: desc --with-domainname{,-opts} in INSTALL Signed-off-by: Xavier Delaruelle --- INSTALL.rst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/INSTALL.rst b/INSTALL.rst index 4c3250071..22a8f3acd 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -1125,6 +1125,32 @@ instance :instopt:`--without-modulepath<--with-modulepath>`): .. versionchanged:: 5.6 Default ``nearly-forbidden`` tag color changed +.. instopt:: --with-domainname=BIN + + Name or full path of default domainname program to use to fetch domain name + (can be superseded at run-time by environment variable) + (default=\ ``domainname``) + + This installation option and :instopt:`--with-domainname-opts` define the + default value of the :mconfig:`domainname` configuration option which could + be changed after installation with the :subcmd:`config` sub-command. + + .. only:: html or latex + + .. versionadded:: 5.7 + +.. instopt:: --with-domainname-opts=OPTLIST + + Settings to apply to default domainname program (default=) + + This installation option and :instopt:`--with-domainname` define the default + value of the :mconfig:`domainname` configuration option which could be + changed after installation with the :subcmd:`config` sub-command. + + .. only:: html or latex + + .. versionadded:: 5.7 + .. instopt:: --with-editor=BIN Name or full path of default editor program to use to open modulefile through @@ -1725,6 +1751,10 @@ installation. | :mconfig:`extended_default` | ``1`` | :instopt:`--enable-extended-default`, | | | | | | :envvar:`MODULES_EXTENDED_DEFAULT` | | | +-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+ +| :mconfig:`domainname` | ``domainname`` | :instopt:`--with-domainname`, | | | +| | | :instopt:`--with-domainname-opts`, | | | +| | | :envvar:`MODULES_DOMAINNAME` | | | ++-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+ | :mconfig:`editor` | ``vi`` | :instopt:`--with-editor`, | | | | | | :envvar:`MODULES_EDITOR` | | | +-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+ From c33bda2e4d82652d1274e97f38c7f507d1ab16c1 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Mon, 20 Jul 2026 09:57:28 +0200 Subject: [PATCH 06/11] doc: desc. MODULES_DOMAINNAME in man/changes Signed-off-by: Xavier Delaruelle --- doc/source/changes.rst | 3 ++- doc/source/module.rst | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index 1965ad1c6..d937a9e7e 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -1085,7 +1085,8 @@ The following environment variables appeared on Modules 5. | | :envvar:`MODULES_NON_EXPORTABLE_TAGS`, | | | :envvar:`MODULES_INFO_EXTENSION`, | | | :envvar:`MODULES_LINKED_ENVVARS`, | -| | :envvar:`MODULES_INIT_ENVVARS` | +| | :envvar:`MODULES_INIT_ENVVARS`, | +| | :envvar:`MODULES_DOMAINNAME` | +------------+-----------------------------------------------------------------+ Modules Specific Tcl Commands diff --git a/doc/source/module.rst b/doc/source/module.rst index 9a7d12753..939a77147 100644 --- a/doc/source/module.rst +++ b/doc/source/module.rst @@ -5009,6 +5009,19 @@ ENVIRONMENT .. versionadded:: 5.5 +.. envvar:: MODULES_DOMAINNAME + + Command to fetch domain name. The value of this variable is composed of a + domainname command name or path eventually followed by command-line options. + + This environment variable value supersedes the default value set in the + :mconfig:`domainname` configuration option. It can be defined with the + :subcmd:`config` sub-command. + + .. only:: html or latex + + .. versionadded:: 5.7 + .. envvar:: MODULES_EDITOR Text editor command name or path for use to open modulefile through the From 7dccac0a59d9645da21e07b8528fcfa914e962b8 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Mon, 20 Jul 2026 09:58:17 +0200 Subject: [PATCH 07/11] doc: desc. domainname config in man/changes Signed-off-by: Xavier Delaruelle --- doc/source/changes.rst | 3 ++- doc/source/module.rst | 30 ++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/doc/source/changes.rst b/doc/source/changes.rst index d937a9e7e..1df47afb5 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -1301,7 +1301,8 @@ The following Modules configuration option has been introduced on Modules 5. +------------+-----------------------------------------------------------------+ | 5.7 | :mconfig:`path_entry_reorder`, :mconfig:`paginate`, | | | :mconfig:`non_exportable_tags`, :mconfig:`info_extension`, | -| | :mconfig:`linked_envvars`, :mconfig:`init_envvars` | +| | :mconfig:`linked_envvars`, :mconfig:`init_envvars`, | +| | :mconfig:`domainname` | +------------+-----------------------------------------------------------------+ :mconfig:`auto_handling` diff --git a/doc/source/module.rst b/doc/source/module.rst index 939a77147..15bdbab71 100644 --- a/doc/source/module.rst +++ b/doc/source/module.rst @@ -1108,20 +1108,19 @@ Module Sub-Commands configuration option from its default value. See :envvar:`MODULECONTACT` description for details. - .. mconfig:: extended_default + .. mconfig:: domainname - Allow partial module version specification. + Command to fetch domain name. - Default value is ``1``. It can be changed at installation time with - :instopt:`--disable-extended-default<--enable-extended-default>` option. The - :envvar:`MODULES_EXTENDED_DEFAULT` environment variable is defined by + Default value is ``domainname``. It can be changed at installation time with + :instopt:`--with-domainname` and :instopt:`--with-domainname-opts` options. + The :envvar:`MODULES_DOMAINNAME` environment variable is defined by :subcmd:`config` sub-command when changing this configuration option from - its default value. See :envvar:`MODULES_EXTENDED_DEFAULT` description for - details. + its default value. See :envvar:`MODULES_DOMAINNAME` description for details. .. only:: html or latex - .. versionadded:: 4.4 + .. versionadded:: 5.7 .. mconfig:: editor @@ -1138,6 +1137,21 @@ Module Sub-Commands .. versionadded:: 4.8 + .. mconfig:: extended_default + + Allow partial module version specification. + + Default value is ``1``. It can be changed at installation time with + :instopt:`--disable-extended-default<--enable-extended-default>` option. The + :envvar:`MODULES_EXTENDED_DEFAULT` environment variable is defined by + :subcmd:`config` sub-command when changing this configuration option from + its default value. See :envvar:`MODULES_EXTENDED_DEFAULT` description for + details. + + .. only:: html or latex + + .. versionadded:: 4.4 + .. mconfig:: extra_siteconfig Additional site-specific configuration script location. See From 3dd73063e8f8a2b5d6484a45ddd9a408429cf3b7 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Mon, 20 Jul 2026 20:13:59 +0200 Subject: [PATCH 08/11] ts: adapt "uname domain" tests Signed-off-by: Xavier Delaruelle --- testsuite/modules.00-init/005-init_ts.exp | 8 ++++++-- testsuite/modules.50-cmds/090-uname-proc.exp | 6 +++--- testsuite/modules.50-cmds/095-uname.exp | 11 ++++++++++- testsuite/modules.50-cmds/350-allin.exp | 2 +- testsuite/modules.70-maint/220-config.exp | 4 ++-- testsuite/modules.70-maint/390-state.exp | 2 +- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/testsuite/modules.00-init/005-init_ts.exp b/testsuite/modules.00-init/005-init_ts.exp index 7ac00fb45..43b17d716 100644 --- a/testsuite/modules.00-init/005-init_ts.exp +++ b/testsuite/modules.00-init/005-init_ts.exp @@ -248,7 +248,7 @@ if {![string length $xrdb]} { send_user "\tX11 setup is [expr {$is_xrdb_avail ? {KO} : {OK}}]\n" # check if domainname binary is available on this system -set domainname [auto_execok domainname] +set domainname [auto_execok $install_domainname] # ensure id command is run with POSIX locale to correctly parse it if {[info exists ::env(LANG)]} { @@ -466,7 +466,7 @@ set xrdb_warn "$x11_warn_prefix\n$error_msgs: $xrdb_notfound_msg" if {!$is_xrdb_avail} { set x11_warn "$x11_warn_prefix\n$error_msgs: $xrdb_issue_msg" } -set domainname_warn "$error_msgs: Command 'domainname' cannot be found" +set domainname_warn "$error_msgs: Command '$install_domainname' cannot be found" set lsb_cmd_err "$error_msgs: Command 'lsb_release' cannot be found" @@ -949,6 +949,10 @@ proc is_real_shell {shell} { return [expr {[lsearch -exact $::real_shells $shell] != -1}] } +proc is_full_path {file_path} { + return [regexp {^(|\.|\.\.)/} $file_path] +} + # helper procedures to format block message output proc msg_block_content {args} { set msg {} diff --git a/testsuite/modules.50-cmds/090-uname-proc.exp b/testsuite/modules.50-cmds/090-uname-proc.exp index 70d0ef1ca..6f5bb26c4 100644 --- a/testsuite/modules.50-cmds/090-uname-proc.exp +++ b/testsuite/modules.50-cmds/090-uname-proc.exp @@ -61,14 +61,14 @@ if {$uname eq ""} { if {$domainname eq ""} { if {$verbose} { - send_user "\tNo executable 'domainname' found ...\n" + send_user "\tNo executable '$install_domainname' found ...\n" } set u_domain "unknown" } else { if {$verbose} { - send_user "\tUsing '$domainname' for domainname checking ...\n" + send_user "\tUsing '$install_domainnamecmd' for domainname checking ...\n" } - set u_domain [exec $domainname] + set u_domain [exec {*}$install_domainnamecmd] } # diff --git a/testsuite/modules.50-cmds/095-uname.exp b/testsuite/modules.50-cmds/095-uname.exp index ec467434f..23f9f69f7 100644 --- a/testsuite/modules.50-cmds/095-uname.exp +++ b/testsuite/modules.50-cmds/095-uname.exp @@ -121,7 +121,16 @@ foreach field [list sysname release machine] { foreach field [list nodename version] { testouterr_cmd "csh" "load $module/$field" "ERR" [msg_load $module/$field $uname_warn] } -testouterr_cmd "csh" "load $module/domain" "ERR" [msg_load $module/domain $domainname_warn] + +if {$domainname ne {} && [is_full_path $install_domainname]} { + set ans [list] + lappend ans [list set _LMFILES_ "$modulefile/domain"] + lappend ans [list set LOADEDMODULES "$module/domain"] + lappend ans [list set testsuite $u_domain noescval] + testouterr_cmd_re "csh" "load $module/domain" $ans {} +} else { + testouterr_cmd "csh" "load $module/domain" "ERR" [msg_load $module/domain $domainname_warn] +} # diff --git a/testsuite/modules.50-cmds/350-allin.exp b/testsuite/modules.50-cmds/350-allin.exp index 1ca61856c..dae1d6706 100644 --- a/testsuite/modules.50-cmds/350-allin.exp +++ b/testsuite/modules.50-cmds/350-allin.exp @@ -50,7 +50,7 @@ set u_release $tcl_platform(osVersion) set u_machine $tcl_platform(machine) set u_nodename [exec uname -n] set u_version [exec uname -v] -set u_domain [exec domainname] +set u_domain [exec {*}$install_domainnamecmd] regsub -all {([.+?()])} $u_sysname {\\\1} u_sysnamere regsub -all {([.+?()])} $u_release {\\\1} u_releasere regsub -all {([.+?()])} $u_machine {\\\1} u_machinere diff --git a/testsuite/modules.70-maint/220-config.exp b/testsuite/modules.70-maint/220-config.exp index 13fc48a3e..c5753ccb0 100644 --- a/testsuite/modules.70-maint/220-config.exp +++ b/testsuite/modules.70-maint/220-config.exp @@ -500,7 +500,7 @@ foreach param [lsort [array names configset]] { } append tserr "\n\n$state_header" -if {[auto_execok uname] eq {} || [auto_execok domainname] eq {}} { +if {[auto_execok uname] eq {} || $domainname eq {}} { append tserr "(\nWARNING: Command '\\S+' cannot be found)+" } if {$lsb_cmd eq {}} { @@ -564,7 +564,7 @@ foreach param [lsort [array names configset]] { } } append tserr "\n\n$state_header" -if {[auto_execok uname] eq {} || [auto_execok domainname] eq {}} { +if {[auto_execok uname] eq {} || $domainname eq {}} { append tserr "(\nWARNING: Command '\\S+' cannot be found)+" } if {$lsb_cmd eq {}} { diff --git a/testsuite/modules.70-maint/390-state.exp b/testsuite/modules.70-maint/390-state.exp index 01402277e..8bfb85512 100644 --- a/testsuite/modules.70-maint/390-state.exp +++ b/testsuite/modules.70-maint/390-state.exp @@ -30,7 +30,7 @@ set statelist [list always_read_full_file autoinit clock_seconds cmdline command # set tserr "$vers_reportre\n\n$state_header" -if {[auto_execok uname] eq {} || [auto_execok domainname] eq {}} { +if {[auto_execok uname] eq {} || $domainname eq {}} { append tserr "(\nWARNING: Command '\\S+' cannot be found)+" } if {$lsb_cmd eq {}} { From 6f6f15244d6d224ffb1542c85df1d358304d1c6d Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Mon, 20 Jul 2026 20:30:24 +0200 Subject: [PATCH 09/11] doc: desc. domainname config option in NEWS Signed-off-by: Xavier Delaruelle --- NEWS.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 06ab3049d..7f9cbed8c 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -132,6 +132,11 @@ Modules 5.7.0 (not yet released) defined in profile files. (fix issue #646) * Report a global known error when Modules Tcl extension library cannot be loaded. (fix issue #644) +* Add :mconfig:`domainname` configuration option to define the command to run + to fetch domain name. It can be changed at installation time with + :instopt:`--with-domainname` and :instopt:`--with-domainname-opts` options. + When :mconfig:`domainname` is changed with :subcmd:`config` sub-command, it + sets the :envvar:`MODULES_DOMAINNAME` environment variable. (fix issue #645) .. _5.6 release notes: From 100aab500bb8df57bfe0170ab80dd53f3f52d019 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Mon, 20 Jul 2026 21:22:32 +0200 Subject: [PATCH 10/11] gh: test domainname install options Signed-off-by: Xavier Delaruelle --- .github/workflows/linux_tests.yaml | 4 ++++ .github/workflows/macos_tests.yaml | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux_tests.yaml b/.github/workflows/linux_tests.yaml index 43211eadc..bc26960f6 100644 --- a/.github/workflows/linux_tests.yaml +++ b/.github/workflows/linux_tests.yaml @@ -100,6 +100,8 @@ jobs: --disable-color --with-icase=never --with-tcl-linter=nagelfar135/nagelfar.tcl + --with-domainname=hostname + --with-domainname-opts=-d COVERAGE: y EXTRA_SCRIPT_PRETEST: make install-testinitrc install-testsiteconfig EXTRA_SCRIPT_POSTTEST: make uninstall-testconfig @@ -181,6 +183,8 @@ jobs: --enable-set-shell-startup --enable-path-entry-reorder --disable-compressed-changelog + --with-domainname=hostname + --with-domainname-opts=-d COVERAGE: y EXTRA_SCRIPT_PRETEST: make install-testinitrc-1 install-testetcrc install-testmodspath EXTRA_SCRIPT_POSTTEST: make uninstall-testconfig diff --git a/.github/workflows/macos_tests.yaml b/.github/workflows/macos_tests.yaml index 4dde326aa..d369d03c5 100644 --- a/.github/workflows/macos_tests.yaml +++ b/.github/workflows/macos_tests.yaml @@ -11,7 +11,11 @@ jobs: macos: runs-on: macos-15 env: - CONFIGURE_OPTS: --prefix=/tmp/modules --with-loadedmodules=null:dot --with-tcl=/opt/homebrew/lib --with-tclsh=/opt/homebrew/bin/tclsh + CONFIGURE_OPTS: | + --prefix=/tmp/modules + --with-loadedmodules=null:dot + --with-tcl=/opt/homebrew/lib + --with-tclsh=/opt/homebrew/bin/tclsh COVERAGE: y EXTRA_SCRIPT_PRETEST: make install-testsiteconfig-1 && export TESTSUITE_ENABLE_SITECONFIG=1 EXTRA_SCRIPT_POSTTEST: unset TESTSUITE_ENABLE_SITECONFIG From 26a990bd802163ae901d108fbc301de624b16df8 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Tue, 21 Jul 2026 08:21:58 +0200 Subject: [PATCH 11/11] install: no domainname cmd check if option not set Do not check for the domainname command in configure script if --with-domainname option is not set. It preserves this way the behavior of previous Modules versions. Signed-off-by: Xavier Delaruelle --- configure | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 56d593519..321a76b40 100755 --- a/configure +++ b/configure @@ -48,6 +48,7 @@ libarglist=() # flags to know if argument has been specified on command-line defpageropts=1 defloggeropts=1 +defdomainname=1 defdomainnameopts=1 # set argument default values @@ -861,7 +862,8 @@ for arg in "$@"; do --with-tclsh=*|--without-tclsh) tclshbin=$(get_package_value "$arg") ;; --with-domainname=*|--without-domainname) - domainname=$(get_package_value "$arg" "") ;; + domainname=$(get_package_value "$arg" "") + defdomainname=0 ;; --with-domainname-opts=*|--without-domainname-opts) domainnameopts=$(get_package_value "$arg" "") defdomainnameopts=0 ;; @@ -1146,9 +1148,9 @@ check_requirement 'basename' '' "PATH=$binsearchpath" # shellcheck disable=SC2034 BASENAME=$reqpath -# get domainname program location from standard PATHs or /usr/local/bin +# if option defined, get domainname program location from standard PATHs or /usr/local/bin # or validate location passed as argument -if [ -n "$domainname" ]; then +if [ $defdomainname -eq 0 ] && [ -n "$domainname" ]; then check_requirement "$domainname" '' "PATH=$binsearchpath" domainname=$reqpath fi