From 75247e14612d2e71311aeeb7060ea704c96c3154 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 22 Nov 2025 21:44:51 +0100 Subject: reverse: fix TestXattrList failure On my Fedora I used to get this failure: --- FAIL: TestXattrList (0.00s) xattr_test.go:52: wrong number of names, want=20 have=21 xattr_test.go:58: mismatch on attr "security.selinux": valA = "", valC = "xxxxxxxxyyyyyyyyyyyyyyyzzzzzzzzzzzzz" First step is to print the actual value using xattr.LGet. This improves the error message to this: --- FAIL: TestXattrList (0.00s) xattr_test.go:53: wrong number of names, want=20 have=21 xattr_test.go:59: mismatch on attr "security.selinux": valA = "", valC = "system_u:object_r:fusefs_t:s0\x00" 2nd step is to ignore "security." attribs as we have no control over them. --- tests/reverse/xattr_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/reverse/xattr_test.go b/tests/reverse/xattr_test.go index df7724f..406d055 100644 --- a/tests/reverse/xattr_test.go +++ b/tests/reverse/xattr_test.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path/filepath" + "strings" "syscall" "testing" @@ -46,7 +47,12 @@ func TestXattrList(t *testing.T) { } namesC := map[string]string{} for _, n := range tmp { - namesC[n] = string(val) + if strings.HasPrefix(n, "security.") { + t.Logf("Ignoring xattr %q", n) + continue + } + v, _ := xattr.LGet(fnC, n) + namesC[n] = string(v) } if len(namesA) != len(namesC) { t.Errorf("wrong number of names, want=%d have=%d", len(namesA), len(namesC)) -- cgit v1.2.3