Skip to content

[5.9] Cherry-pick substitution drive fixes for Windows #7513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

bnbarham
Copy link

No description provided.

compnerd and others added 3 commits September 22, 2023 14:38
Running lit tests on Windows can fail because its use of
`os.path.realpath` expands substitute drives, which are used to keep
paths short and avoid hitting MAX_PATH limitations.

Changes lit logic to:

Use `os.path.abspath` on Windows, where `MAX_PATH` is a concern that we
can work around using substitute drives, which `os.path.realpath` would
resolve.

Use `os.path.realpath` on Unix, where the current directory always has
symlinks resolved, so it is impossible to preserve symlinks in the
presence of relative paths, and so we must make sure that all code paths
use real paths.

Also updates clang's `FileManager::getCanonicalName` and `ExtractAPI`
code to avoid resolving substitute drives (i.e. resolving to a path
under a different root).

How tested: built with `-DLLVM_ENABLE_PROJECTS=clang` and built `check-all` on both Windows

Differential Revision: https://reviews.llvm.org/D154130
Reviewed By: @benlangmuir

Patch by Tristan Labelle <[email protected]>!
5ccfa15 removed normalization from abs_path_preserve_drive but I missed adding this case back to the caller
…he caller

As noted on D154130, this was preventing path matching between normalized/unnormalized paths on some windows builds.
@bnbarham
Copy link
Author

@shahmishal shahmishal merged commit 52fae62 into swiftlang:swift/release/5.9 Sep 28, 2023
@bnbarham bnbarham deleted the cherry-subtitution-drive-fixes branch September 28, 2023 16:53
bnbarham pushed a commit to bnbarham/llvm-project that referenced this pull request Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants