Skip to content

Conversation

@sunfishcode
Copy link
Member

On Windows, files on network shares have a canonical path which starts
with the UNC "\?" prefix. With these prefixes, the OS no longer
handles "." paths and trailing slashes, so handle them manually.

Fixes #2650.

@sunfishcode sunfishcode requested a review from pchickey February 16, 2021 21:16
On Windows, files on network shares have a canonical path which starts
with the UNC "\\?\" prefix. With these prefixes, the OS no longer
handles "." paths and trailing slashes, so handle them manually.

Fixes #2650.
@sunfishcode sunfishcode force-pushed the sunfishcode/unc-path branch 5 times, most recently from 54edf80 to 91d3d4b Compare February 17, 2021 01:30
@sunfishcode
Copy link
Member Author

Looking at the test failures, this needs some more work before it's ready.

@sunfishcode
Copy link
Member Author

Windows has some functions which perform canonicalization. I've now submitted retep998/winapi-rs#992 to add bindings to these in winapi, so we can experiment with using those instead of trying to do the canonicalization manually.

@sunfishcode
Copy link
Member Author

Another option is to use windows-rs. That seems like the next thing to try here.

@sunfishcode sunfishcode force-pushed the main branch 3 times, most recently from fc0ebc2 to dd73714 Compare June 24, 2021 06:19
@sunfishcode sunfishcode force-pushed the main branch 4 times, most recently from 4a03710 to 6e53944 Compare August 20, 2021 23:46
sunfishcode added a commit that referenced this pull request Jun 17, 2022
windows-sys has bindings for `PathCchCanonicalizeEx`, `PathCchCombineEx`,
and `PathCchAppendEx`, which we may be able to use in #156.
sunfishcode added a commit that referenced this pull request Jun 21, 2022
windows-sys has bindings for `PathCchCanonicalizeEx`, `PathCchCombineEx`,
and `PathCchAppendEx`, which we may be able to use in #156.
@sunfishcode
Copy link
Member Author

A better path forward for this issue is to change cap-std to use NtCreateFile, which is available as a windows-sys API, so it's stable to use. That way we won't have to do path concatenation and deal with all of these subtle canonicalization and UNC details.

@sunfishcode sunfishcode closed this Dec 7, 2022
@sunfishcode sunfishcode deleted the sunfishcode/unc-path branch December 7, 2022 19:52
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.

2 participants