Skip to content

FDS 6.11.1_SMV-6.11.2: FDS6VARS.sh on macOS #16418

Description

@gjaeger

FDS6VARS.sh (part of the macOS release bundle under /Applications/FDS/FDS6/bin/) uses the == comparison operator inside single square brackets ([ "$PATH" == "" ]) in its if conditions. This is not POSIX-compliant syntax for the test command (only a single = is valid there). While bash silently accepts this as an extension, sourcing the script under zsh fails, because zsh tries to resolve the second = via its EQUALS expansion and cannot find a matching command.

Steps to reproduce the behavior:

  1. Install FDS6 on macOS (installation path: /Applications/FDS/FDS6/)
  2. Use zsh as the default shell
  3. Add/execute the following line in .zprofile: source /Applications/FDS/FDS6/bin/FDS6VARS.sh
  4. Restart the terminal or run source .zprofile
  5. The following error appears: /Applications/FDS/FDS6/bin/FDS6VARS.sh:3: = not found

Expected behavior
The script should run without errors and correctly set the environment variables (PATH, DYLD_LIBRARY_PATH, OPAL_PREFIX, TMPDIR, OMP_NUM_THREADS), regardless of whether it is sourced with bash or zsh.

Desktop

Suggested fix for FDS6VARS.sh:

#!/bin/bash
FDSBINDIR=/Applications/FDS/FDS6/bin
if [ "$PATH" = "" ]; then
  export PATH=$FDSBINDIR
else
  export PATH=$FDSBINDIR:$PATH
fi
export PATH=$FDSBINDIR/openmpi/bin:$PATH
export OPAL_PREFIX=$FDSBINDIR/openmpi  # used when running the bundled fds
if [ "$DYLD_LIBRARY_PATH" = "" ]; then
  export DYLD_LIBRARY_PATH=$FDSBINDIR/openmpi/lib
else
  export DYLD_LIBRARY_PATH=$FDSBINDIR/openmpi/lib:$DYLD_LIBRARY_PATH
fi
export TMPDIR=/tmp
export OMP_NUM_THREADS=4

Additionally, line 1 is missing the exclamation mark in the shebang (#/bin/bash instead of #!/bin/bash).

It should also be checked whether SMV6VARS.sh contains the same issue (== instead of =)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions