cea-hpc / modules

Environment Modules: provides dynamic modification of a user's environment
http://modules.sourceforge.net/
GNU General Public License v2.0
668 stars 102 forks source link

BUG: EscapePerlString too eager #514

Closed schumar closed 9 months ago

schumar commented 9 months ago

EscapePerlString in utility.c, introduced in 14c9aaf and expanded in 5a6e32a, escapes

If a module-files has

setenv foo bar\\zak\;gar

it will correctly set the env-var foo to bar\zak;gar in e.g. bash, but will result in bar\\zak\;gar in Perl:

$ modulecmd perl load $module
[...] $ENV{'foo'} = 'bar\\zak\;gar';

(The current branch (since 8e050c412) only escapes single-quotes:

$ modulecmd perl load $module
[...]
$ENV{'foo'} = 'bar\zak;gar';

i.e. does not have this bug.)

xdelaruelle commented 9 months ago

Thanks for the contribution. Despite the message on this github issue, I have accepted this code proposal. I just changed it a bit to adapt the non-regression test suite.

For the record: issue is marked "closed" rather "merged" as I messed up with the remote branch. But everything is correctly merged.