Skip to content
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

Path canonicalization enhancements #12924

Open
Colengms opened this issue Nov 5, 2024 · 0 comments
Open

Path canonicalization enhancements #12924

Colengms opened this issue Nov 5, 2024 · 0 comments
Assignees
Labels
internal Used to opt-out an issue from having GitHub actions applied to it Language Service
Milestone

Comments

@Colengms
Copy link
Collaborator

Colengms commented Nov 5, 2024

The C/C++ extension 'canonicalizes' paths, in order to compare them for equality, use them in maps, hashes, etc..

Currently: On Windows, canonicalization avoids disk access, and (therefore) does not resolve symbolic links (which are uncommon on Windows) and does not require that the target currently exists on disk. On Linux and Mac, canonicalization leverages realpath, which hits to disk, resolves symbolic links and requires that the target exists.

The differences in behaviors of the same canonicalization API on different platforms is problematic. This issue tracks making this behavior consistent across platforms and more robust.

Proposed/example API:

  • canonicalize_full_path - does not hit to disk, resolve symbolic links, or require that the file exists. (Leaving the Windows behavior unchanged, there is one exception: If the path is relative, it's considered to be in the current working directory. This use should be avoided, as relying on the current working directory is discouraged for multiple reasons).
  • canonicalize_relative_path - applies canonicalization to a relative path.
  • canonicalize_path_leaf - applies canonicalization to a single leaf (file or directory. No "." or ".." expected, just upper-casing on Windows).
  • get_resolved_full_path - Resolves symbolic links (if any), returning a canonicalized path.

This will require being more explicit about where symbolic links should be resolved, which should help us address open issues related to symbolic links.

@Colengms Colengms added internal Used to opt-out an issue from having GitHub actions applied to it Language Service labels Nov 5, 2024
@Colengms Colengms added this to the 1.23 milestone Nov 5, 2024
@Colengms Colengms self-assigned this Nov 5, 2024
@Colengms Colengms added this to cpptools Nov 5, 2024
@Colengms Colengms moved this to In progress in cpptools Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Used to opt-out an issue from having GitHub actions applied to it Language Service
Projects
Status: In progress
Development

No branches or pull requests

1 participant