diff --git a/bin/sbang b/bin/sbang index 806bc3a4af8..ab833fe97a8 100755 --- a/bin/sbang +++ b/bin/sbang @@ -1,4 +1,4 @@ -#!/bin/sh +#!/scratch/psakiev/spack/share/spack/qa/bashcov # # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # sbang project developers. See the top-level COPYRIGHT file for details. @@ -15,7 +15,7 @@ # To use, put the long shebang on the second line of your script, and # make sbang the interpreter, like this: # -# #!/bin/sh /path/to/sbang +# #!/scratch/psakiev/spack/share/spack/qa/bashcov /path/to/sbang # #!/long/path/to/real/interpreter with arguments # # `sbang` will run the real interpreter with the script as its argument. diff --git a/lib/spack/spack/environment/environment.py b/lib/spack/spack/environment/environment.py index 7f66447a07f..cc0b3cddf13 100644 --- a/lib/spack/spack/environment/environment.py +++ b/lib/spack/spack/environment/environment.py @@ -65,11 +65,6 @@ #: default path where environments are stored in the spack tree default_env_path = os.path.join(spack.paths.var_path, "environments") -# ensure that this base directory exists since we require the root directory to be created -# in our checks -if not os.path.isdir(default_env_path): - os.mkdir(default_env_path) - #: Name of the input yaml file for an environment manifest_name = "spack.yaml" @@ -85,9 +80,15 @@ def env_root_path(): """Override default root path if the user specified it""" - return spack.util.path.canonicalize_path( - spack.config.get("config:environments_root", default=default_env_path), allow_env=False - ) + env_path = spack.config.get("config:environments_root", default=default_env_path) + canonical_path = spack.util.path.canonicalize_path(env_path, allow_env=False) + if env_path == default_env_path: + # create the default path if it is missing, if user paths are missing we errors + # and force them to create it themselves to keep spack from adding arbitrary directories + # and to help debug typos + if not os.path.isdir(canonical_path): + os.mkdir(canonical_path) + return canonical_path def check_disallowed_env_config_mods(scopes):