Skip to content

Conversation

@Rob23oba
Copy link
Contributor

@Rob23oba Rob23oba commented May 29, 2025

This PR fixes IO.FS.realPath on windows to take symbolic links into account.

Closes #810

@github-actions github-actions bot added the changelog-library Library label May 29, 2025
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label May 29, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented May 29, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 3b72c7d1930197c07f35ea770ea13ff2ae4ddceb --onto 921ce7682e46544b536b3ab2901233b06c8165cf. You can force Mathlib CI using the force-mathlib-ci label. (2025-05-29 20:53:28)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 3b72c7d1930197c07f35ea770ea13ff2ae4ddceb --onto 72141b05fd9a3328c1e5d99211dc4da4495cbd42. You can force Mathlib CI using the force-mathlib-ci label. (2025-05-30 09:45:58)
  • ❗ Mathlib CI can not be attempted yet, as the nightly-testing-2025-06-01 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-mathlib, Mathlib CI should run now. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-01 11:41:28)

@github-actions github-actions bot added the release-ci Enable all CI checks for a PR, like is done for releases label May 29, 2025
Comment on lines +974 to +983
if (memcmp(res, "\\\\?\\", 4) == 0) {
if (memcmp(res + 4, "UNC\\", 4) == 0) {
// network path: convert "\\\\?\\UNC\\..." to "\\\\..."
res[6] = '\\';
res += 6;
} else {
// simple path: convert "\\\\?\\C:\\.." to "C:\\..."
res += 4;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this adopted from anywhere else, any other reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally Cameron told me about this stackoverflow post. It also seems like some implementations have something similar, e.g. java's file code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, from the documentation here: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry

The "\\?\" prefix can also be used with paths constructed according to the universal naming convention (UNC). To specify such a path using UNC, use the "\\?\UNC\" prefix.

@Kha Kha added this pull request to the merge queue Jun 13, 2025
Merged via the queue into leanprover:master with commit e713232 Jun 13, 2025
18 checks passed
algebraic-dev pushed a commit to algebraic-dev/lean4 that referenced this pull request Jun 18, 2025
…prover#8534)

This PR fixes `IO.FS.realPath` on windows to take symbolic links into
account.

Closes leanprover#810
wkrozowski pushed a commit to wkrozowski/lean4 that referenced this pull request Jun 24, 2025
…prover#8534)

This PR fixes `IO.FS.realPath` on windows to take symbolic links into
account.

Closes leanprover#810
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-library Library release-ci Enable all CI checks for a PR, like is done for releases toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IO.FS.realPath does not resolve symlinks on Windows

3 participants