Project

General

Profile

Bug #1044

GMXRC alters the contents of the shell's special parameters

Added by Erik Marklund over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
build system
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

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

Related to GROMACS - Bug #1213: GMXRC make dubious assumptionsClosed04/02/2013

Associated revisions

Revision a0dca221 (diff)
Added by Erik Lindahl over 6 years ago

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

History

#1 Updated by Roland Schulz over 6 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 over 6 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 over 6 years ago

I get the same error with the latest release-4-6.

#4 Updated by Erik Marklund over 6 years ago

... and I can't build master.

#5 Updated by Roland Schulz over 6 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 over 6 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 over 6 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 over 6 years ago

  • Target version set to 4.6

#9 Updated by Erik Marklund over 6 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 over 6 years ago

  • Status changed from In Progress to Closed

Also available in: Atom PDF