-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Reduce aggressive correcting casing of file system paths #14469
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
Conversation
|
I'm wondering if this would also help to fix #13432. |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
| if (Platform.IsLinux) | ||
| { | ||
| return path; | ||
| } |
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.
Aren't MacOS paths also case sensitive? Is there another reason we'd have this behaviour for Linux but not MacOS?
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.
By default MacOS uses a case-insensitive file system.
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.
The primary scenario where we hit a problem is with git where the remote repo is on Linux and case-sensitive and someone adds a file with a directory that they manually typed and then you have two directories in git that only differ by case. I think that affects Windows and macOS clients even if their local filesystems are case insensitive.
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.
If git is case-sensetive locally on all platforms then users should follow the application design why should PowerShell do expensive work for all paths and for other scenarios?
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.
they manually typed
the remote repo is on Linux and case-sensitive
Wow! If repo/application is case-sensitive and user obviously know this shouldn't the user take care of compliance himself?
If different platforms have different behavior, this is a fundamental and unsolvable problem. We constantly get requests about slashes because they are different in local (Windows) and remote session (Linux). I haven't seen as many requests about case, but the root of the problem is the same.
It should be clearly written in the documentation that this is the user's concern: if a scenario is - scripts works on Windows client and remote sessions are on Linux-s (and vise-versa) a recommendation for users should be to prefer forward slashes (backslashs) and be careful about cases.
| private FileSystemInfo GetFileSystemItem(string path, ref bool isContainer, bool showHidden) | ||
| { | ||
| path = NormalizePath(path); | ||
| path = GetCorrectCasedPath(path); |
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.
I see we've swapped a bunch of calls to use GetCorrectCasedPath -- are there cases where NormalizePath is still called on its own? Or is it only used in the GetCorrectCasedPath method now?
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.
After the PR:
- GetCorrectCasedPath - 16 uses.
- NormalizePath - 8 uses.
The PR does mostly obvious changes. Later we could remove more GetCorrectCasedPath uses.
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
While the WG agrees that something might be done, we have an overriding concern for compatibility and being comprehensive in the light that some unix file systems may be case insensitive. We have decided to reject this PR for the following reasons:
|
Interesting! :-) Could please the WG point me RFC, public discussion and important business scenarios for adding the feature? Did the WG explicitly measure and approve 5x, 10x and more extra P/Invokes for every path in processing? Is the opinion of the WG unapologetically strict that the main thing is that I should see in the console once a day "Abc" instead of "abc", although I do not care about it and I need my scripts run every minute to work as fast as possible? |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
Given that the engine WG has rejected this PR, I will close it for housekeeping purpose. |
|
I can't agree with that. It makes absolutely no sense to do this in scripts. For cosmetic effect we make file operations slow. PowerShell is already bad with files and this makes it unusable at all. Of course this is not a problem if you just type |
|
@SteveL-MSFT As a consequence of this WG decision the slogan "PowerShell for every system!" should be removed from github´s About page! |
PR Summary
Fix #12795
While modern (SSD) disks are fast, this does not mean that disk operations have become so insignificant that they can be neglected. For case correction we use additional disk operations (enumerations).
It is very weird that we do case corrections for file paths which are excluded in the PR:
PR Context
#9250 Return correct casing of filesystem path during normalization
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.