mirror of
https://github.com/restic/restic.git
synced 2024-09-10 13:20:53 +02:00
On FreeBSD, limited users may not be able to even list xattrs for the parent directories above the snapshot source paths. As this can cause the backup to fail, just ignore those errors.
29 lines
762 B
Go
29 lines
762 B
Go
//go:build darwin || freebsd || linux || solaris
|
|
// +build darwin freebsd linux solaris
|
|
|
|
package restic
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/pkg/xattr"
|
|
rtest "github.com/restic/restic/internal/test"
|
|
)
|
|
|
|
func TestIsListxattrPermissionError(t *testing.T) {
|
|
xerr := &xattr.Error{
|
|
Op: "xattr.list",
|
|
Name: "test",
|
|
Err: os.ErrPermission,
|
|
}
|
|
err := handleXattrErr(xerr)
|
|
rtest.Assert(t, err != nil, "missing error")
|
|
rtest.Assert(t, IsListxattrPermissionError(err), "expected IsListxattrPermissionError to return true for %v", err)
|
|
|
|
xerr.Err = os.ErrNotExist
|
|
err = handleXattrErr(xerr)
|
|
rtest.Assert(t, err != nil, "missing error")
|
|
rtest.Assert(t, !IsListxattrPermissionError(err), "expected IsListxattrPermissionError to return false for %v", err)
|
|
}
|