Summary:
Currently `find_cmake.sh` script contains `set -o errexit` setting which causes exit of the whole script if any issue occur during its execution. This script is intended to be used in sourcing mode (e.g. . ./find_cmake.sh) and because of that, this setting is not a good choice for this script for to reasons:
- In this mode if any issue occurs this setting exits not only the script, but the shell that was executing this script
- Even if execution was successful this setting is propagated to the shell that was executing this script and stays enabled there even after script execution which causes exit from this shell on the next issue (any unsuccessful shell command).
Reproducer:
To reproduce this issue and feel all the importance of fixing it you can do the following things:
- Connect using SSH to any remote system
- Download or clone WT repo
- Call `. <path_to_wt>/test/evergreen/find_cmake.sh`
- Try to do any of the following:
- `ls /nonexisting/path/that/would/never/exist/if/you/create/it/manually`
- Run `ls /` and then press Tab a couple ot times to show all the possible options
After doing these steps propagated `set -e errexit` will cause exit from your shell which will cause dropping of your SSH session so you need to SSH again.
Importance:
I am afraid it also can affect our CI infrastracture one day since even minor non-fatal issue always causes exit() call after sourcing find_cmake.sh
Definition of done: find_cmake.sh doesn't affect the calling shell settings in case of success or failure.