diff --git a/cmd/restic/cmd_mount.go b/cmd/restic/cmd_mount.go index 8e21ce203..3e6382192 100644 --- a/cmd/restic/cmd_mount.go +++ b/cmd/restic/cmd_mount.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/cmd/restic/integration_fuse_test.go b/cmd/restic/integration_fuse_test.go index 45a9d4eb0..57a57ae97 100644 --- a/cmd/restic/integration_fuse_test.go +++ b/cmd/restic/integration_fuse_test.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/cmd/restic/integration_helpers_test.go b/cmd/restic/integration_helpers_test.go index d0450817d..d277184f2 100644 --- a/cmd/restic/integration_helpers_test.go +++ b/cmd/restic/integration_helpers_test.go @@ -66,7 +66,7 @@ func isSymlink(fi os.FileInfo) bool { func sameModTime(fi1, fi2 os.FileInfo) bool { switch runtime.GOOS { - case "darwin", "freebsd", "openbsd": + case "darwin", "freebsd", "openbsd", "netbsd": if isSymlink(fi1) && isSymlink(fi2) { return true } diff --git a/internal/fs/stat_bsd.go b/internal/fs/stat_bsd.go index 97c03bedc..62a258e64 100644 --- a/internal/fs/stat_bsd.go +++ b/internal/fs/stat_bsd.go @@ -1,4 +1,4 @@ -// +build freebsd darwin +// +build freebsd darwin netbsd package fs diff --git a/internal/fs/stat_unix.go b/internal/fs/stat_unix.go index 612898566..56c22f8bc 100644 --- a/internal/fs/stat_unix.go +++ b/internal/fs/stat_unix.go @@ -1,4 +1,4 @@ -// +build !windows,!darwin,!freebsd +// +build !windows,!darwin,!freebsd,!netbsd package fs diff --git a/internal/fuse/blob_size_cache.go b/internal/fuse/blob_size_cache.go index 87b2016a1..47599a820 100644 --- a/internal/fuse/blob_size_cache.go +++ b/internal/fuse/blob_size_cache.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/internal/fuse/dir.go b/internal/fuse/dir.go index 654af21cf..f899a4313 100644 --- a/internal/fuse/dir.go +++ b/internal/fuse/dir.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/internal/fuse/file.go b/internal/fuse/file.go index ff74ec73c..5fefd5e3e 100644 --- a/internal/fuse/file.go +++ b/internal/fuse/file.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/internal/fuse/file_test.go b/internal/fuse/file_test.go index 7a1802f39..2909d6636 100644 --- a/internal/fuse/file_test.go +++ b/internal/fuse/file_test.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/internal/fuse/link.go b/internal/fuse/link.go index 334568904..6772ac5f0 100644 --- a/internal/fuse/link.go +++ b/internal/fuse/link.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/internal/fuse/meta_dir.go b/internal/fuse/meta_dir.go index e34aa77af..3271b3c29 100644 --- a/internal/fuse/meta_dir.go +++ b/internal/fuse/meta_dir.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/internal/fuse/other.go b/internal/fuse/other.go index b0e368d87..b497087e6 100644 --- a/internal/fuse/other.go +++ b/internal/fuse/other.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/internal/fuse/root.go b/internal/fuse/root.go index 27779a241..3ffa8a7ac 100644 --- a/internal/fuse/root.go +++ b/internal/fuse/root.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/internal/fuse/snapshots_dir.go b/internal/fuse/snapshots_dir.go index f6fc42cad..3b7d428ae 100644 --- a/internal/fuse/snapshots_dir.go +++ b/internal/fuse/snapshots_dir.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows diff --git a/internal/restic/node_netbsd.go b/internal/restic/node_netbsd.go new file mode 100644 index 000000000..b588a2b68 --- /dev/null +++ b/internal/restic/node_netbsd.go @@ -0,0 +1,27 @@ +package restic + +import "syscall" + +func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error { + return nil +} + +func (s statUnix) atim() syscall.Timespec { return s.Atimespec } +func (s statUnix) mtim() syscall.Timespec { return s.Mtimespec } +func (s statUnix) ctim() syscall.Timespec { return s.Ctimespec } + +// Getxattr retrieves extended attribute data associated with path. +func Getxattr(path, name string) ([]byte, error) { + return nil, nil +} + +// Listxattr retrieves a list of names of extended attributes associated with the +// given path in the file system. +func Listxattr(path string) ([]string, error) { + return nil, nil +} + +// Setxattr associates name and data together as an attribute of path. +func Setxattr(path, name string, data []byte) error { + return nil +} diff --git a/internal/restic/node_test.go b/internal/restic/node_test.go index 0b548323d..0e99b344e 100644 --- a/internal/restic/node_test.go +++ b/internal/restic/node_test.go @@ -210,7 +210,7 @@ func TestNodeRestoreAt(t *testing.T) { "%v: GID doesn't match (%v != %v)", test.Type, test.GID, n2.GID) if test.Type != "symlink" { // On OpenBSD only root can set sticky bit (see sticky(8)). - if runtime.GOOS != "openbsd" && test.Name == "testSticky" { + if runtime.GOOS != "openbsd" && runtime.GOOS != "netbsd" && test.Name == "testSticky" { rtest.Assert(t, test.Mode == n2.Mode, "%v: mode doesn't match (0%o != 0%o)", test.Type, test.Mode, n2.Mode) } @@ -228,7 +228,7 @@ func AssertFsTimeEqual(t *testing.T, label string, nodeType string, t1 time.Time // Go currently doesn't support setting timestamps of symbolic links on darwin and bsd if nodeType == "symlink" { switch runtime.GOOS { - case "darwin", "freebsd", "openbsd": + case "darwin", "freebsd", "openbsd", "netbsd": return } } diff --git a/internal/restic/node_xattr.go b/internal/restic/node_xattr.go index f6c95ac89..ea5ed8d3a 100644 --- a/internal/restic/node_xattr.go +++ b/internal/restic/node_xattr.go @@ -1,3 +1,4 @@ +// +build !netbsd // +build !openbsd // +build !solaris // +build !windows