Don't expand ndots if prefixed with ./#14755
Merged
ysthakur merged 2 commits intonushell:mainfrom Jan 5, 2025
Merged
Conversation
ysthakur
reviewed
Jan 5, 2025
|
|
||
| /// Expand tilde ("~") into a home directory if it is the first path component | ||
| pub fn expand_tilde(path: impl AsRef<Path>) -> PathBuf { | ||
| // TODO: Extend this to work with "~user" style of home paths |
Member
There was a problem hiding this comment.
Is this working now? (I have no idea what ~user style is)
Contributor
There was a problem hiding this comment.
Not sure. Strangely enough, ls ~ and ls ~fdncred return the same thing on my mac.
Member
Author
There was a problem hiding this comment.
oh my bad, I meant to comment on this in the PR description. yes, this is an old comment. this was implemented in #5251
Contributor
There was a problem hiding this comment.
I have no idea what
~userstyle is
~user is expanded to the home directory of user.
Strangely enough,
ls ~andls ~fdncredreturn the same thing on my mac.
That's how it works. Effectively, ~ is a shortcut to ~($env.USER) where $env.USER is the current user.
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.
Description
Prevents ndots from being expanded if they are prefixed with
./, as the agreed resolution to #13303. Only applies to externals, mirroring the fix from #13218.I did attempt to apply the fix for internal commands as well, but it seems like the path is expanded too aggressively and I haven't investigated it further yet.
./...gets normalized into<pwd>/./..., which gets normalized into<pwd>/...before being handed toexpand_ndots, and at that point it just looks like a normal n-dots so we can't tell we shouldn't expand.(Fixes #13303)
User-Facing Changes
./.Tests + Formatting
Added tests to prevent regression.
toolkit fmttoolkit clippytoolkit testtoolkit test stdlibAfter Submitting
N/A