Skip to content

Commit

Permalink
xattr: add the XattrNoSecurity flag to enable mac os Finder to set ex…
Browse files Browse the repository at this point in the history
…tended attributes (#5197)
  • Loading branch information
zhijian-pro authored Sep 29, 2024
1 parent 8824126 commit 4f75f01
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
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

0 comments on commit 4f75f01

Please sign in to comment.