-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Remove PathSearchTrimEnd #18166
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
Remove PathSearchTrimEnd #18166
Conversation
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
| /// The command name to search for. | ||
| /// </summary> | ||
| private string _commandName; | ||
| private readonly string _commandName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reviewers: this fixes a violation IDE0044: Add readonly modifier, enabled in #13880.
|
|
||
| if (!string.IsNullOrEmpty(fileName)) | ||
| { | ||
| fileName = fileName.TrimEnd(Utils.Separators.PathSearchTrimEnd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we should have a test for this? With this we should now be able to call executables that have trailing whitespace? (although seems like a bad practice)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test what? In common, it is impossible to know what is OS and file system limitations. As .Net team concluded, the best thing we can do is to defer checks to OS and file system.
With this we should now be able to call executables that have trailing whitespace? (although seems like a bad practice)
I don't see any changes in behavior on Windows in my manual tests.
I'd expect that now we can run a file with trailing spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change: today, I can run & 'pwsh ' (trailing space in the command name). With this change, it won't work anymore.
I don't think we should change anything in the command searching code. If our FileSystemProvider cannot find a file with trailing spaces in its name as it should, then make the changes there, but not the command discovery code.
This is as strange as if we cut the end This rather indicates that there is a bug in the way we run applications and not in the search or FileSystemProvider. |
PR Summary
This is moved from #18154.
PathSearchTrimEnd is removed based on dotnet/runtime#76122 (comment)
For ex., now we don't remove trail spaces that are valid in file names on Windows.
On Linux it was even more incorrect.
PR Context
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).