From 2b6f896ca744081a38579573a52824bf334fb54b Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Wed, 10 Feb 2021 13:39:11 -0800 Subject: Bugfix: environments/views on separate mounts (#20720) Environment views fail when the tmpdir used for view generation is on a separate mount from the install_tree because the files cannot by symlinked between the two. The fix is to use an alternative tmpdir located alongside the view. --- lib/spack/spack/environment.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py index 3b26cd7050..4518cb25a9 100644 --- a/lib/spack/spack/environment.py +++ b/lib/spack/spack/environment.py @@ -556,11 +556,20 @@ class ViewDescriptor(object): # that cannot be resolved or have repos that have been removed # we always regenerate the view from scratch. We must first make # sure the root directory exists for the very first time though. - root = self.root - if not os.path.isabs(root): - root = os.path.normpath(os.path.join(self.base, self.root)) + root = os.path.normpath( + self.root if os.path.isabs(self.root) else os.path.join( + self.base, self.root) + ) fs.mkdirp(root) - with fs.replace_directory_transaction(root): + + # The tempdir for the directory transaction must be in the same + # filesystem mount as the view for symlinks to work. Provide + # dirname(root) as the tempdir for the + # replace_directory_transaction because it must be on the same + # filesystem mount as the view itself. Otherwise it may be + # impossible to construct the view in the tempdir even when it can + # be constructed in-place. + with fs.replace_directory_transaction(root, os.path.dirname(root)): view = self.view() view.clean() -- cgit v1.2.3-70-g09d2