-
Notifications
You must be signed in to change notification settings - Fork 131
Strip \\?\ prefix from path generated by resolveSymlink #485
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
Conversation
@swift-ci Please test |
Sources/TSCBasic/PathShims.swift
Outdated
throw FileSystemError(.unknownOSError, path) | ||
} | ||
let path = String(decodingCString: $0.baseAddress!, as: UTF16.self) | ||
// When using `VOLUME_NAME_DOS`, the returned path uses `\\?\`. | ||
let path = String(decodingCString: $0.baseAddress!.advanced(by: 4), as: UTF16.self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want an assertion that the prefix is present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following what you did in swiftlang/swift-foundation#639. I guess we should also add the check there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making the corresponding change to swift-foundation here: swiftlang/swift-foundation#974
This aligns the implementation of resolveSymlinks with that of Foundation.String._resolvingSymlinksInPath, which received this canonicalization fix in swiftlang/swift-foundation#639.
80f5030
to
51f21e2
Compare
@swift-ci Please test |
As far as I know `\\?\` is always returned by `GetFinalPathNameByHandleW` but it’s better to be safe and actually check instead of unconditionally trimming the first 4 characters from the returned path. See swiftlang/swift-tools-support-core#485 (comment)
@swift-ci Please test Windows |
As far as I know `\\?\` is always returned by `GetFinalPathNameByHandleW` but it’s better to be safe and actually check instead of unconditionally trimming the first 4 characters from the returned path. See swiftlang/swift-tools-support-core#485 (comment)
As far as I know `\\?\` is always returned by `GetFinalPathNameByHandleW` but it’s better to be safe and actually check instead of unconditionally trimming the first 4 characters from the returned path. See swiftlang/swift-tools-support-core#485 (comment)
@swift-ci Please test Windows |
As far as I know `\\?\` is always returned by `GetFinalPathNameByHandleW` but it’s better to be safe and actually check instead of unconditionally trimming the first 4 characters from the returned path. See swiftlang/swift-tools-support-core#485 (comment)
macOS CI failure is unrelated. This change only affects Windows. macOS CI is failing because this is the only repo that build SourceKit-LSP using a 5.9 host compiler, but SourceKit-LSP requires 5.10 to build successfully. We didn’t hit this before because this repo hasn’t seen any changes in the last 2 months, which is when SourceKit-LSP started requiring Swift 5.10. |
…tlang#974) As far as I know `\\?\` is always returned by `GetFinalPathNameByHandleW` but it’s better to be safe and actually check instead of unconditionally trimming the first 4 characters from the returned path. See swiftlang/swift-tools-support-core#485 (comment)
This aligns the implementation of resolveSymlinks with that of Foundation.String._resolvingSymlinksInPath, which received this canonicalization fix in swiftlang/swift-foundation#639.