-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
File operations are not in case sensitive on cross-platform (i.e. Linux) #91250
Comments
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsDescriptionFile operations on Linux are currently case-sensitive, contrary to the expected cross-platform behavior. While Windows OS maintains case sensitivity, the Linux file operations exhibit case-insensitive behavior for consistent user experience across platforms. Presently, methods like Configuration
Other Information
This issue substantially impacts cross-platform development, leading to unexpected behavior for users working with files. Ensuring that file operations are consistently case-insensitive on Linux will significantly improve usability and maintain a seamless experience across different operating systems.
|
It's not possible to make a case-sensitive system appear as case-sensitive. File entries can exists that differ only by case, and that makes it impossible to pick the 'right' one. In addition, a case-sensitive system doesn't have an efficient way to do a case-insensitive lookup, so there would be a significant performance cost to do this in user-space. |
As @tmds wrote, this is by design. |
Linux doesn't care case sensitivity but File.Exist does which is not right for the cross-platforms, and there is no any choice to handling by framework at the moment. this is not right. |
Why? The majority of platforms are case-sensitive, which means that it's Windows that's "off" here (note that, among other things, Windows is gradually adopting ICU for cultural data, instead of their own sources). |
I think File.Exists() should be in case sensitive on Linux, and case sensitive on Windows OS, It should be dependent on the OS. For example, Path.Combine() can behave differently depending on the operating system, so why not File.Exists() as well? that's my point, no one opposes Path.Combine why different than Windows OS, because that is correct behavior for the Linux OS |
For file operations, everything that .NET does is calling the right OS API (sys-call) with a file path or a file descriptior of an opened file. The sys-call internally calls the file system-specific code, which decides whether it's case sensitive or not. .NET has no control over how this is handled. There is also no alternative.
|
Description
File operations on Linux are currently case-sensitive, contrary to the expected cross-platform behavior. While Windows OS maintains case sensitivity, the Linux file operations exhibit case-insensitive behavior for consistent user experience across platforms. Presently, methods like
File.Exists()
lack case sensitivity on Linux, which diverges from the anticipated behavior.Configuration
Other Information
Behavior Example:
File.Exists()
.File.Exists("myfile.txt")
should returntrue
ifMyFile.txt
exists.File.Exists("myfile.txt")
returnsfalse
, indicating a mismatch in case sensitivity.PhyscalFileProvider.cs:
PhyscalFileProvider.cs
class within the 'Microsoft.Extensions.FileProviders' namespace also exhibits case-sensitive behavior on Linux. This inconsistency affects the behavior of theStaticFiles
functionality on website projects.Reproduction Steps:
MyFile.txt
on Linux.File.Exists("myfile.txt")
method to check for its existence.false
.Error Message:
Workaround:
This issue substantially impacts cross-platform development, leading to unexpected behavior for users working with files. Ensuring that file operations are consistently case-insensitive on Linux will significantly improve usability and maintain a seamless experience across different operating systems.
The text was updated successfully, but these errors were encountered: