From 727a49da7245807135a128ffee1483038c5a4738 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 17 Jul 2025 13:36:48 +0200 Subject: [PATCH] build-system: get hostname via hostname(1) not $HOSTNAME With Slurm (and may be other batch-systems) the environment variable HOSTNAME might inherited from the node the job has been submitted. In this case the value is wrong on the compute nodes. --- Pmodules/modbuild.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index 96b32a5..a6ca44a 100644 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -162,6 +162,9 @@ declare -- module_name='' declare -- module_type='module' declare -- echo=':' +HostName=$(hostname -f) +declare -r HostName + parse_args() { # # The first argument ($1) is the build-script, if called in the @@ -1223,7 +1226,7 @@ build_modules_yaml_v1(){ local -- system for system in "${systems[@]}"; do [[ "${opt_system}" =~ ${system} ]] && return 0 - [[ "${HOSTNAME}" =~ ${system} ]] && return 0 + [[ "${HostName}" =~ ${system} ]] && return 0 done std::info "%s " "Skipping variant '${version}'" \ "for the system(s): ${systems[@]}"