From 55544950e2578a7ca8e041f12b3ef9a06eed3064 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Thu, 17 Mar 2022 15:18:28 +0100 Subject: [PATCH] PackageViewMixin: fix symlinks conflict issue (#29515) `stat`'ing a file in the dst dir is the wrong thing to do, you should `lstat` to capture broken symlinks. --- lib/spack/spack/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index dc989679d8..addbdf4e84 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -449,7 +449,7 @@ def view_file_conflicts(self, view, merge_map): Alternative implementations may allow some of the files to exist in the view (in this case they would be omitted from the results). """ - return set(dst for dst in merge_map.values() if os.path.exists(dst)) + return set(dst for dst in merge_map.values() if os.path.lexists(dst)) def add_files_to_view(self, view, merge_map): """Given a map of package files to destination paths in the view, add @@ -458,7 +458,7 @@ def add_files_to_view(self, view, merge_map): linked into the view already include the file. """ for src, dst in merge_map.items(): - if not os.path.exists(dst): + if not os.path.lexists(dst): view.link(src, dst, spec=self.spec) def remove_files_from_view(self, view, merge_map):