Bug #1044
GMXRC alters the contents of the shell's special parameters
Description
When I source GMXRC from e.g. a bash script the shell's special parameter $@ gets altered. I think that the contents of such variables should be preserved.
Related issues
Associated revisions
History
#1 Updated by Roland Schulz about 8 years ago
It does get preserved for me inside a small test script. Can you provide a step by step how to reproduce this problem?
#2 Updated by Erik Marklund about 8 years ago
Certainly! I'll try it out for master and release-4-6 too. What's seen below comes from release-4-5-patches
Here's the script
#!/bin/bash
echo '$* before GMXRC:' $*
source ~/bin/gmx/release-4-5-patches_theta/bin/GMXRC
echo '$* after GMXRC:' $*
And here's the output
erikm@telperion:~$ ./tst.sh a few arguments
$* before GMXRC: a few arguments
$* after GMXRC: is_csh = 123
Here I used $* but the same thing happens with $@.
#3 Updated by Erik Marklund about 8 years ago
I get the same error with the latest release-4-6.
#4 Updated by Erik Marklund about 8 years ago
... and I can't build master.
#5 Updated by Roland Schulz about 8 years ago
As a workaround you can source GMXRC.bash instead of GMXRC. Not sure how to fix it for GMXRC.
#6 Updated by Erik Marklund about 8 years ago
Thanks. It's not a big deal, and if one is aware of it then it's rarely an issue I suppose.
#7 Updated by Erik Lindahl about 8 years ago
- Status changed from New to In Progress
Fixed by https://gerrit.gromacs.org/1973 . Erik, if you have a chance, please try this on a bunch of different systems to make sure our multi-shell detection still works.
#8 Updated by Teemu Murtola about 8 years ago
- Target version set to 4.6
#9 Updated by Erik Marklund about 8 years ago
Will do. But it may take a few days until I get the chance. My computer died during the holidays, but as soon as I have my hands on a working system I will try it out.
#10 Updated by Erik Lindahl about 8 years ago
- Status changed from In Progress to Closed
Fixed GMXRC so we are not polluting standard shell variables
csh/tcsh is now detected by looking for the lower-case $shell
variable, which seems to work on all recent platforms, instead
of using the 'set' command (which affected $* and $@ in bash).
Fixes #1044.
Change-Id: I852d075c80e2bf8f81a02932432dd31b3bab7f09