You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File mode in Linux should reflect Linux modes #1817
This is currently a limitation of .NET Core (or really, a design decision due to .NET being originally created for Windows).
> [IO.FileInfo]::new("README.md").Attributes
Normal
PowerShell file objects are based on the C# classes, and the C# FileInfo class uses their FileAttributes enum, which in PowerShell corresponds to the mode property.
So, while on Linux, we'd expect a "read-only" file to display -r--r--r--, in C#, we get:
Whether or not PowerShell should ignore the C# object and instead "do its own thing" to get Linux-like file modes is a reasonable question, but would require a design change.
Activity
fabiendibot commentedon Aug 15, 2016
+1 and same goes for Get-Item(property)
andyleejordan commentedon Aug 17, 2016
This is currently a limitation of .NET Core (or really, a design decision due to .NET being originally created for Windows).
PowerShell file objects are based on the C# classes, and the C# FileInfo class uses their FileAttributes enum, which in PowerShell corresponds to the mode property.
So, while on Linux, we'd expect a "read-only" file to display
-r--r--r--, in C#, we get:And in PowerShell parlance:
Whether or not PowerShell should ignore the C# object and instead "do its own thing" to get Linux-like file modes is a reasonable question, but would require a design change.
purplexa commentedon Aug 18, 2016
Is there a reasonable way to have an additional
PosixModeattribute or something for file objects on POSIX file systems?SteveL-MSFT commentedon Sep 29, 2016
We should try to have a consistent experience for Linux Bash users. See if we can add custom formatting for Linux to enable this.
DHowett-MSFT commentedon Mar 16, 2018
Relies on/discussed further in dotnet/corefx#312
iSazonov commentedon Nov 26, 2019
Fixed in #11042