-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Implement UnixFileMode APIs #69980
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
Merged
Merged
Implement UnixFileMode APIs #69980
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
11c2422
Implement UnixFileMode APIs on Unix.
tmds b182b4d
Throw PNSE on Windows, add UnsupportedOSPlatform.
tmds f143499
Fix API compat issue.
tmds 5138601
Borrow a few things from SafeFileHandle API PR to this compiles.
tmds 4d6c524
Fix System.IO.FileSystem.AccessControl compilation.
tmds 813e24a
Add xml docs.
tmds 7bd2ae3
Replace Interop.Sys.Permissions to System.IO.UnixFileMode.
tmds d67d738
Throw PNSE immediately on Windows.
tmds 3841bfb
Add ODE to xml docs of methods that accept a handle.
tmds d1e7ea8
Don't throw (PNSE) from FileSystemInfo.UnixFileMode getter on Windows.
tmds f7db626
Minor style fix.
tmds 88828a4
Get rid of some casts.
tmds cd4104f
Add tests for creating a file/directory with UnixFileMode.
tmds c937c28
Some CI envs don't have a umask exe, try retrieving via a shell builtin.
tmds a12832c
Update expected test mode values.
tmds d294651
Fix OSX
tmds 3df946a
Fix Windows build.
tmds f3c55bf
Add ArgumentException tests.
tmds 91e0891
Fix Windows build.
tmds 6e74d98
Add get/set tests.
tmds 757c1e5
Update test for Windows.
tmds 53539ec
Make setters target link instead of link target.
tmds 873660e
Linux: fix SetUnixFileMode
tmds d9c7789
Fix OSX compilation.
tmds 3dba808
Try make all tests pass in CI.
tmds 33d3e6f
For link, operate on target permissions.
tmds 18e70c9
Skip tests on Browser.
tmds b2423c6
Add tests for 'Get' that doesn't use a 'Set' first.
tmds 777b77d
Don't perform exist check for handles.
tmds 4e93e11
Fix Get test for wasm.
tmds 60d24a7
Review xml comments.
tmds 8f8ff2d
Add comment to test.
tmds 97df035
GetUnixFileMode for handle won't throw UnauthorizedAccessException.
tmds 7bfa541
Apply suggestions from code review
tmds 01f6ff3
PR feedback.
tmds 6e91cf1
Update enum doc to say 'owner' instead of 'user'.
tmds 4cb6316
Use UnixFileMode in library.
tmds 7046ea9
Use UnixFileMode in library tests.
tmds e55011d
Fix Windows build.
tmds bc7383b
Fix missing FileAccess when changing to FileStreamOptions API.
tmds d1f043d
PR feedback.
tmds 168bdf5
Fix Argument_InvalidUnixCreateMode message.
tmds File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
33 changes: 0 additions & 33 deletions
33
src/libraries/Common/src/Interop/Unix/System.Native/Interop.Permissions.cs
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,7 +59,6 @@ | |
| <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.FChMod.cs" Link="Common\Interop\Unix\System.Native\Interop.FChMod.cs" /> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Link.cs" Link="Common\Interop\Unix\System.Native\Interop.Link.cs" /> | ||
| <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.MkFifo.cs" Link="Common\Interop\Unix\System.Native\Interop.MkFifo.cs" /> | ||
| <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Permissions.cs" Link="Common\Interop\Unix\Interop.Permissions.cs" /> | ||
tmds marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Stat.cs" Link="Common\Interop\Unix\Interop.Stat.cs" /> | ||
| <Compile Include="$(CommonPath)System\IO\Archiving.Utils.Unix.cs" Link="Common\System\IO\Archiving.Utils.Unix.cs" /> | ||
| </ItemGroup> | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,9 @@ static partial void ExtractExternalAttributes(FileStream fs, ZipArchiveEntry ent | |
| // include the permissions, or was made on Windows. | ||
| if (permissions != 0) | ||
| { | ||
| Interop.CheckIo(Interop.Sys.FChMod(fs.SafeFileHandle, permissions), fs.Name); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the Interop file be removed from this .csproj? |
||
| #pragma warning disable CA1416 // Validate platform compatibility | ||
| File.SetUnixFileMode(fs.SafeFileHandle, (UnixFileMode)permissions); | ||
| #pragma warning restore CA1416 | ||
| } | ||
| } | ||
| } | ||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.