Skip to content
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

xattr: add the XattrNoSecurity flag to enable mac os Finder to set extended attributes #5197

Merged
merged 5 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/meta/utils_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ const (
XattrCreateOrReplace = 0
XattrCreate = sys.XATTR_CREATE
XattrReplace = sys.XATTR_REPLACE
XattrNoSecurity = sys.XATTR_NOSECURITY
)
1 change: 1 addition & 0 deletions pkg/meta/utils_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ const (
XattrCreateOrReplace = 0
XattrCreate = sys.XATTR_CREATE
XattrReplace = sys.XATTR_REPLACE
XattrNoSecurity = 8
)
1 change: 1 addition & 0 deletions pkg/meta/utils_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ const (
XattrCreateOrReplace = 0
XattrCreate = 1
XattrReplace = 2
XattrNoSecurity = 8
)
4 changes: 4 additions & 0 deletions pkg/vfs/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,10 @@ func (v *VFS) SetXattr(ctx Context, ino Ino, name string, value []byte, flags ui
err = v.Meta.SetFacl(ctx, ino, aclType, rule)
v.invalidateAttr(ino)
} else {
// ignore NoSecurity flag
if runtime.GOOS == "darwin" && (flags&meta.XattrNoSecurity) != 0 {
flags &= ^uint32(meta.XattrNoSecurity)
}
err = v.Meta.SetXattr(ctx, ino, name, value, flags)
}
return
Expand Down
Loading