fix: relative path handling in canonicalize_path_maybe_not_exists#20
Merged
Conversation
dsherret
reviewed
Oct 9, 2025
| path: &Path, | ||
| mut path: &Path, | ||
| ) -> std::io::Result<PathBuf> { | ||
| let path = normalize_path(Cow::Borrowed(path)); |
Contributor
There was a problem hiding this comment.
Is not normalizing the path anymore going to cause issues? Maybe it should still be normalized when not starting with a .?
Member
Author
There was a problem hiding this comment.
I think path normalization is done by fs_canonicalize anyway, so doing it would just be a duplicate work. Also as you can see we have tests confirming that paths not starting with . are handled expectedly.
I might be overlooking something though
Contributor
There was a problem hiding this comment.
Can you try running all the tests in the CLI repo with this change?
Contributor
There was a problem hiding this comment.
Actually, I'll do a CI run and test it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes an issue where
canonicalize_path_maybe_not_existswithRealSysfailed to handle relative paths when traversing ancestors.Fixes #19
Changes
.)normalize_pathpreprocessing stepTesting
test_canonicalize_path_maybe_not_exists_in_memorywith various relative path casestest_canonicalize_path_maybe_not_exists_realusing temporary directories and symlinks., liked,c/d/e, etc.