Thanks for suggesting running the shell and the command it is to invoke; that revealed the issue.
Our newer installation runs
$ bash --version
GNU bash, version 5.1.8(1)-release (x86_64-redhat-linux-gnu)
as distributed with Red Hat 9 (and equivalents). The version of bash on the older installation is
$ bash --version
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
as distributed with Red Hat 7 (and equivalents). The combination of -ec
flags does not seem to work with bash version 5, as it comes with Red Hat 9.
Using your suggestion, on the older installation we get
$ bash --login -ec 'sinfo --version'
slurm 23.02.7
$ echo $?
0
Whereas on the newer installation, we get
$ bash --login -ec 'sinfo --version'
$ echo $?
1
This can be worked around on our end by setting the BASH_COMPAT
variable to 4.2 on the command line, as in
$ BASH_COMPAT=4.2 bash --login -c 'sinfo --version'
slurm 24.05.4
Alternately, one can drop the -e
option from the bash
command,
$ bash --login -c 'sinfo --version'
slurm 24.05.4
and that also works on the newer installation.
Unfortunately, this seems only to work from the interactive prompt, as neiter adding the command
export BASH_COMPAT=4.2
nor adding
shopt -s compat42
to either the user’s .bashrc
file or to the .bash_profile
seem to make the command without the explicit variable declaration on the bash
command line work.
I haven’t been able to find a way to get a compatibility mode set up that will enable bash 5.1 to Just Work with the bash --login -ec 'sinfo --version'
command. That -e
flag seems to be the problem.
We have a pretty generic RH9 installation, so I don’t think we’ve done anything to make this behavior occur.