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.
This commit is contained in:
Harmen Stoppels 2022-03-17 15:18:28 +01:00 committed by GitHub
parent 3544b0274f
commit 55544950e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -449,7 +449,7 @@ def view_file_conflicts(self, view, merge_map):
Alternative implementations may allow some of the files to exist in Alternative implementations may allow some of the files to exist in
the view (in this case they would be omitted from the results). 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): def add_files_to_view(self, view, merge_map):
"""Given a map of package files to destination paths in the view, add """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. linked into the view already include the file.
""" """
for src, dst in merge_map.items(): 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) view.link(src, dst, spec=self.spec)
def remove_files_from_view(self, view, merge_map): def remove_files_from_view(self, view, merge_map):