From 0cab42d9fe74feb89425b289b7552ce58e544d47 Mon Sep 17 00:00:00 2001 From: Dave Cottlehuber Date: Fri, 9 Jan 2026 17:03:01 +0000 Subject: [PATCH] xattr: use different namespace prefixes for FreeBSD vs other platforms Go's stdlib seems to handle the FreeBSD user. namespace directly, or FreeBSD itself doesn't require it. Make this a platform-specific feature. Fixes: #1745 --- backend/meta/xattr.go | 4 ---- backend/meta/xattr_freebsd.go | 19 +++++++++++++++++++ backend/meta/xattr_other.go | 19 +++++++++++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 backend/meta/xattr_freebsd.go create mode 100644 backend/meta/xattr_other.go diff --git a/backend/meta/xattr.go b/backend/meta/xattr.go index 692b3c19..b09fa363 100644 --- a/backend/meta/xattr.go +++ b/backend/meta/xattr.go @@ -26,10 +26,6 @@ import ( "github.com/versity/versitygw/s3err" ) -const ( - xattrPrefix = "user." -) - var ( // ErrNoSuchKey is returned when the key does not exist. ErrNoSuchKey = errors.New("no such key") diff --git a/backend/meta/xattr_freebsd.go b/backend/meta/xattr_freebsd.go new file mode 100644 index 00000000..bbca083b --- /dev/null +++ b/backend/meta/xattr_freebsd.go @@ -0,0 +1,19 @@ +// Copyright 2026 Versity Software +// This file is licensed under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//go:build freebsd + +package meta + +const xattrPrefix = "" diff --git a/backend/meta/xattr_other.go b/backend/meta/xattr_other.go new file mode 100644 index 00000000..6cfeea26 --- /dev/null +++ b/backend/meta/xattr_other.go @@ -0,0 +1,19 @@ +// Copyright 2026 Versity Software +// This file is licensed under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//go:build !freebsd + +package meta + +const xattrPrefix = "user."