-
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
System.IO.FileSystem.AccessControl can't set ACLs on files with long paths #91980
Comments
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsDescriptionWhen attempting to set ACLs on a file with a long path on Windows,
Reproduction Stepsvar dacl = file.GetAccessControl(AccessControlSections.Access);
dacl.AddAccessRule(new FileSystemAccessRule(_everyoneWindows.Value, FileSystemRights.FullControl, AccessControlType.Allow));
file.SetAccessControl(dacl); where Expected behavior
Actual behavior
Regression?No response Known WorkaroundsI tried to workaround this with this code: var dacl = new FileSecurity(@"\\?\" + file.FullName, AccessControlSections.Access);
dacl.AddAccessRule(new FileSystemAccessRule(_everyoneWindows.Value, FileSystemRights.FullControl, AccessControlType.Allow));
dacl.Persist(@"\\?\" + file.FullName); however, Configuration.NET 7 Other informationNo response
|
Triage: I've marked this issue as
I suspect it's the one that takes the |
the call hierarchy is:
It seems the file handle is never created, if the security object is constructed via name (file location). I think we may add Another workaround would be I also noticed that the Security tab is missing for long-named files in explorer... 🤔 |
Description
When attempting to set ACLs on a file with a long path on Windows,
SetAccessControl
throwsArgumentException: Invalid name
:Reproduction Steps
where
file
is aFileInfo
pointing to a file with a long path.Expected behavior
SetAccessControl
should work with long paths on Windows.Actual behavior
SetAccessControl
throwsArgumentException: Invalid name
.Regression?
No response
Known Workarounds
I tried to workaround this with this code:
however,
Persist
is internal/protected and not available to user code. You also can't inherit fromFileSystemSecurity
to access the protected method, as all constructors on that class are internal.Configuration
.NET 7
Other information
No response
The text was updated successfully, but these errors were encountered: