summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/environment.py2
-rw-r--r--lib/spack/spack/test/cmd/env.py19
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py
index 7a9a4735fc..330d90915e 100644
--- a/lib/spack/spack/environment.py
+++ b/lib/spack/spack/environment.py
@@ -1944,7 +1944,7 @@ class Environment(object):
written = os.path.exists(self.manifest_path)
if changed or not written:
self.raw_yaml = copy.deepcopy(self.yaml)
- with fs.write_tmp_and_move(self.manifest_path) as f:
+ with fs.write_tmp_and_move(os.path.realpath(self.manifest_path)) as f:
_write_yaml(self.yaml, f)
def __enter__(self):
diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py
index d9d6f5483c..10b9dee981 100644
--- a/lib/spack/spack/test/cmd/env.py
+++ b/lib/spack/spack/test/cmd/env.py
@@ -248,6 +248,25 @@ def test_env_install_same_spec_twice(install_mockery, mock_fetch):
assert 'already installed' in out
+def test_env_definition_symlink(install_mockery, mock_fetch, tmpdir):
+ filepath = str(tmpdir.join('spack.yaml'))
+ filepath_mid = str(tmpdir.join('spack_mid.yaml'))
+
+ env('create', 'test')
+ e = ev.read('test')
+ e.add('mpileaks')
+
+ os.rename(e.manifest_path, filepath)
+ os.symlink(filepath, filepath_mid)
+ os.symlink(filepath_mid, e.manifest_path)
+
+ e.concretize()
+ e.write()
+
+ assert os.path.islink(e.manifest_path)
+ assert os.path.islink(filepath_mid)
+
+
def test_env_install_two_specs_same_dep(
install_mockery, mock_fetch, tmpdir, capsys):
"""Test installation of two packages that share a dependency with no