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

fix: FileSystem.normalize #6983

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

neunenak
Copy link

@neunenak neunenak commented Feb 7, 2025

This PR implements the TODO comment here, to handle multiple path separators and the . special character when normalizing file paths.

@neunenak neunenak changed the title Fix FileSystem.normalize fix: FileSystem.normalize Feb 7, 2025
Implement the TODO to handle multiple path separators and the . special
character in paths
@neunenak neunenak force-pushed the fix-filepath-normalize-todo branch from 4c13822 to 7356177 Compare February 7, 2025 03:53
@neunenak neunenak marked this pull request as ready for review February 7, 2025 04:00
@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 Feb 7, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Feb 7, 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 c92425f98de92a3afc4dfc7b4c0ad754fb19e6f4 --onto b01ca8ee237a1b3c299384e73ad79d424e216a84. (2025-02-07 04:20:32)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase c92425f98de92a3afc4dfc7b4c0ad754fb19e6f4 --onto 88664e4a995883877a5d85211a5cfab0a672b5ed. (2025-02-18 09:52:53)

@Kha
Copy link
Member

Kha commented Feb 12, 2025

Thanks for the PR, was this implementation taken from some other stdlib? This definitely isn't something we should just reinvent.

@neunenak
Copy link
Author

Thanks for the PR, was this implementation taken from some other stdlib? This definitely isn't something we should just reinvent.

Nope, this is just some functionality that I personally needed (and that I saw the TODO comment for), I wrote it by hand based on what seemed reasonable.

@Kha
Copy link
Member

Kha commented Feb 14, 2025

Ok, then I don't think we can upstream it as is

@neunenak
Copy link
Author

Ok, then I don't think we can upstream it as is

What would be necessary in order to upstream it?

@hargoniX
Copy link
Contributor

The implementation should be based on one from another reputable stdlib such that we do not repeat mistakes that other people have made and already have support for weird edge cases early on. Additionally we should probably have tests to demonstrate that we do indeed manage to handle such edge cases.

@neunenak
Copy link
Author

I think the Rust stdlib PathBuf normalization mostly happens in this method: https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.components which might be a good guide for this lean implementation

@Kha Kha marked this pull request as draft February 18, 2025 12:58
@Kha
Copy link
Member

Kha commented Feb 18, 2025

I've converted this to a draft until that point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants