Skip to content

std: implement Windows set_permissions_nofollow via reparse open#564

Open
SebTardif wants to merge 1 commit into
mainfrom
fix-windows-set-permissions-nofollow
Open

std: implement Windows set_permissions_nofollow via reparse open#564
SebTardif wants to merge 1 commit into
mainfrom
fix-windows-set-permissions-nofollow

Conversation

@SebTardif

Copy link
Copy Markdown
Owner

Summary

  • Implement fs::set_permissions_nofollow on Windows by opening with FILE_WRITE_ATTRIBUTES | FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT and calling File::set_permissions (handle-based attributes).
  • Change path set_perm to the same handle path without OPEN_REPARSE_POINT so normal set_permissions follows links consistently with File::set_permissions, instead of ambiguous SetFileAttributesW on the path.

Closes #557

Origin

Pattern mirrors existing set_times / set_times_nofollow in library/std/src/sys/fs/windows.rs.

Test plan

  • Structural match with set_times_nofollow
  • Windows smoke: symlink + set_permissions_nofollow (manual / CI Windows)

Route path set_perm through handle-based SetFileInformationByHandle
(follow reparse points with BACKUP_SEMANTICS), matching File::set_permissions.

Add set_perm_nofollow with FILE_FLAG_OPEN_REPARSE_POINT so unstable
fs::set_permissions_nofollow works on Windows for symlinks/junctions
(WSL/interop), not only Unix.

Closes #557

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows fs::set_permissions path uses SetFileAttributesW (follows/ambiguous on reparse points); set_permissions_nofollow unimplemented

1 participant