Skip to content

Conversation

@karakasa
Copy link
Contributor

@karakasa karakasa commented Sep 22, 2023

fix #91980

by guarding FileSystemSecurity.Persist(string) with PathInternal.EnsureExtendedPrefixIfNeeded, as the ctor does.

@ghost ghost added area-System.IO community-contribution Indicates that the PR has been added by a community member labels Sep 22, 2023
@ghost
Copy link

ghost commented Sep 22, 2023

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

fix #91980

Author: karakasa
Assignees: -
Labels:

area-System.IO

Milestone: -

@karakasa karakasa changed the title Support setting ACLs with file paths longer than MAX_PATH Support setting ACLs on file paths longer than MAX_PATH Sep 22, 2023
Copy link
Member

@adamsitnik adamsitnik left a 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.

Copy link
Member

@adamsitnik adamsitnik left a 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 !

Co-authored-by: Adam Sitnik <[email protected]>
@adamsitnik adamsitnik merged commit 2f7276e into dotnet:main Sep 22, 2023
@adamsitnik adamsitnik added this to the 9.0.0 milestone Sep 22, 2023
@karakasa karakasa deleted the issue-91980 branch September 22, 2023 23:25
@ViktorHofer
Copy link
Member

Should this be backported into .NET 8?

@ghost ghost locked as resolved and limited conversation to collaborators Oct 25, 2023
@jeffhandley
Copy link
Member

/backport to release/8.0-staging

@github-actions github-actions bot unlocked this conversation Nov 9, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2024

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/11759736213

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2024
const int MaxShortPath = 260;
int fileNameLength = Math.Max(MaxShortPath - directory.Path.Length, 1);

string path = Path.Combine(directory.Path, new string('1', fileNameLength) + ".txt");
Copy link
Member

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?

Copy link
Member

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.

@jeffhandley
Copy link
Member

/backport to release/8.0-staging

@github-actions
Copy link
Contributor

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/14013486425

@github-actions github-actions bot unlocked this conversation Mar 22, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2025
@jeffhandley
Copy link
Member

/backport to release/8.0-staging

Needed to delete the existing backport branch.

@github-actions github-actions bot unlocked this conversation Mar 22, 2025
@github-actions
Copy link
Contributor

Started backporting to release/8.0-staging: https://github.com/dotnet/runtime/actions/runs/14013503842

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.IO community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.IO.FileSystem.AccessControl can't set ACLs on files with long paths

7 participants