Files
modules/init/perl.pm.in
Xavier Delaruelle 5aaedd85ca init: enclose installation path references
Update initialization, profile and completion scripts to enclose all
references to the installation paths.

Enclosing modulecmd.tcl installation path this way is not effective with
the quarantine mechanism that implies a double shell code evaluation. So
it is advised not to install Modules in a path containing a whitespace
character if the quarantine mechanism is needed.
2022-06-16 18:57:30 +02:00

29 lines
876 B
Perl

# define modules runtime quarantine configuration
@setquarvars@$ENV{'MODULES_RUN_QUARANTINE'} = '@RUN_QUARANTINE@';
@setquarvars@@$ENV{'RUNENV_VAR'} = 'RUNENV_VAL';@
@notsetquarvars@#$ENV{'MODULES_RUN_QUARANTINE'} = 'ENVVARNAME';
@notsetquarvars@
# setup quarantine if defined
my $_mlre = '';
if (defined $ENV{'MODULES_RUN_QUARANTINE'}) {
foreach my $_mlv (split(' ', $ENV{'MODULES_RUN_QUARANTINE'})) {
if ($_mlv =~ /^[A-Za-z_][A-Za-z0-9_]*$/) {
if (defined $ENV{$_mlv}) {
$_mlre .= "__MODULES_QUAR_${_mlv}='$ENV{$_mlv}' ";
}
my $_mlrv = "MODULES_RUNENV_$_mlv";
$_mlre .= "$_mlv='$ENV{$_mlrv}' ";
}
}
if ($_mlre ne "") {
$_mlre = "env ${_mlre}__MODULES_QUARANTINE_SET=1 ";
}
}
eval `${_mlre}@TCLSH@ '@libexecdir@/modulecmd.tcl' perl autoinit`;
# clean temp variable used to setup quarantine
undef $_mlre;
1;