From d81eab65f3b07c265f56626a2d8d5e5a3628bcd9 Mon Sep 17 00:00:00 2001 From: "John K. Luebs" Date: Wed, 4 Oct 2023 22:06:00 -0500 Subject: [PATCH] Sigh, namespacing of xattr works differently on *BSD. Tested on FreeBSD. --- src/duplicacy_entry_test.go | 6 ++++-- ...cacy_utils_posix.go => duplicacy_utils_linux.go} | 5 ----- src/duplicacy_utils_xbsd.go | 13 +++++++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) rename src/{duplicacy_utils_posix.go => duplicacy_utils_linux.go} (86%) create mode 100644 src/duplicacy_utils_xbsd.go diff --git a/src/duplicacy_entry_test.go b/src/duplicacy_entry_test.go index 03267340..8c2420b5 100644 --- a/src/duplicacy_entry_test.go +++ b/src/duplicacy_entry_test.go @@ -240,10 +240,12 @@ func TestEntryExcludeByAttribute(t *testing.T) { if runtime.GOOS == "darwin" { excludeAttrName = "com.apple.metadata:com_apple_backup_excludeItem" excludeAttrValue = []byte("com.apple.backupd") - } else if runtime.GOOS == "linux" || runtime.GOOS == "freebsd" || runtime.GOOS == "netbsd" || runtime.GOOS == "solaris" { + } else if runtime.GOOS == "linux" { excludeAttrName = "user.duplicacy_exclude" + } else if runtime.GOOS == "freebsd" || runtime.GOOS == "netbsd" { + excludeAttrName = "duplicacy_exclude" } else { - t.Skip("skipping test, not darwin, linux, freebsd, netbsd, or solaris") + t.Skip("skipping test, not darwin, linux, freebsd, or netbsd") } testDir := filepath.Join(os.TempDir(), "duplicacy_test") diff --git a/src/duplicacy_utils_posix.go b/src/duplicacy_utils_linux.go similarity index 86% rename from src/duplicacy_utils_posix.go rename to src/duplicacy_utils_linux.go index 20bf9fe8..ce842fd6 100644 --- a/src/duplicacy_utils_posix.go +++ b/src/duplicacy_utils_linux.go @@ -2,13 +2,8 @@ // Free for personal use and commercial trial // Commercial use requires per-user licenses available from https://duplicacy.com -// +build freebsd netbsd linux solaris - package duplicacy -import ( -) - func excludedByAttribute(attributes map[string][]byte) bool { _, ok := attributes["user.duplicacy_exclude"] return ok diff --git a/src/duplicacy_utils_xbsd.go b/src/duplicacy_utils_xbsd.go new file mode 100644 index 00000000..9b85899b --- /dev/null +++ b/src/duplicacy_utils_xbsd.go @@ -0,0 +1,13 @@ +// Copyright (c) Acrosync LLC. All rights reserved. +// Free for personal use and commercial trial +// Commercial use requires per-user licenses available from https://duplicacy.com + +//go:build freebsd netbsd +// +build freebsd netbsd + +package duplicacy + +func excludedByAttribute(attributes map[string][]byte) bool { + _, ok := attributes["duplicacy_exclude"] + return ok +}