Prefer llnl.util.symlink.readlink to os.readlink (#44126)

Symlinks on Windows can use longpath prefixes (\\?\); these are fine
in the context of win32 API interactions but break numerous facets of
Spack behavior that rely on string parsing/matching (archiving,
binary distributions, tarball extraction, view regen, etc).

Spack's internal readlink method (llnl.util.symlink.readlink)
gracefully handles this by removing the prefix and otherwise behaving
exactly as os.readlink does, so we should prefer that in all cases.
This commit is contained in:
John W. Parent
2024-05-16 13:56:04 -04:00
committed by GitHub
parent 722d401394
commit 1ce09847d9
16 changed files with 42 additions and 28 deletions

View File

@@ -843,7 +843,7 @@ def copy_tree(
if islink(s):
link_target = resolve_link_target_relative_to_the_link(s)
if symlinks:
target = os.readlink(s)
target = readlink(s)
if os.path.isabs(target):
def escaped_path(path):