Skip to content

Explicitly unset ERR_EXIT shell option #3073

Description

@mrclary

Affiliation
What University / Laboratory / Company are you from, if any?

TAE Technologies

Description
A description of the feature or enhancement you would like to see.

Add set +e at the beginning of setup.sh, i.e.
https://github.com/MDSplus/mdsplus/blob/alpha/setup.sh#L63-L69

#
set +e

if [ -z "$EXPORTCMD" ]
then
  awkexportcmd="export \" \$1 \" ;\""
else
  awkexportcmd="export \" \$1 \" ; $EXPORTCMD \" \$1 \" \$\" \$1 \" ;\""
fi

Example
An example of the feature you would like, using pseudocode if helpful.

Additional context
Add any other context or screenshots about the feature request here.

It is useful to initialize MDSplus inside an Lmod module , e.g.

source_sh("/bin/bash", "/usr/local/mdsplus/setup.sh")

However, source_sh explicitly runs with set -e and subprocesses in MDSplus's setup.sh can return non-zero exit status (e.g. line 198 pyver="$(python -V 2>&1)"), resulting in errors similar to:

Lmod has detected the following error:  Error found in sourcing script "/usr/local/mdsplus/setup.sh":

If this is a bash script please try:
  $ set -exv; . /usr/local/mdsplus/setup.sh
See https://lmod.readthedocs.io/en/latest/260_sh_to_modulefile.html for details.

While processing the following module(s):
    Module fullname  Module Filename
    ---------------  ---------------
    mds              /Users/rclary/Documents/Repos/TAE/tae-dev/mds.lua

Since setup.sh uses $? for flow control but does not require exiting on error, adding set +e at the beginning of setup.sh allows Lmod to handle the script without issue and should not alter the behavior in other contexts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn unexpected problem or unintended behaviorcoreRelates to the core libraries and scripts

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions