-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Support setting ACLs on file paths longer than MAX_PATH
#92460
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
|
Tagging subscribers to this area: @dotnet/area-system-io |
MAX_PATHMAX_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.
Thank you for a very elegant fix!
PTAL at my comment regarding the test.
src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs
Show resolved
Hide resolved
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.
LGTM, thank you for your contribution @karakasa !
src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs
Show resolved
Hide resolved
src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Adam Sitnik <[email protected]>
|
Should this be backported into .NET 8? |
|
/backport to release/8.0-staging |
|
Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/11759736213 |
| const int MaxShortPath = 260; | ||
| int fileNameLength = Math.Max(MaxShortPath - directory.Path.Length, 1); | ||
|
|
||
| string path = Path.Combine(directory.Path, new string('1', fileNameLength) + ".txt"); |
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 I read right this is intended to be just ".txt" longer than 260? why not just make it 500 or something huge?
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.
FWIW: The path reported in the issue is 261, that's probably why just above 260 was chosen.
C:\ProgramData\UET\SDKs\Android-android-33-33.0.1-3.10.2.4988404-25.1.8937393-jdk-11.0.19+7\Sdk\cmdline-tools\lib\external\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
It doesn't hurt to test both 500 and > 260.
|
/backport to release/8.0-staging |
|
Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/14013486425 |
|
/backport to release/8.0-staging Needed to delete the existing backport branch. |
|
Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/14013503842 |
fix #91980
by guarding
FileSystemSecurity.Persist(string)withPathInternal.EnsureExtendedPrefixIfNeeded, as the ctor does.