1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
Without this patch these tests fail in `abuild rootbld` with:
--- FAIL: TestChown (0.00s)
os_unix_test.go:58: gid: 1000
os_unix_test.go:70: groups: [65534 65534 65534 65534 65534 65534 65534 65534 1000]
os_unix_test.go:73: chown /tmp/_Go_TestChown1112875884 -1 65534: chown /tmp/_Go_TestChown1112875884: invalid argument
--- FAIL: TestFileChown (0.00s)
os_unix_test.go:101: gid: 1000
os_unix_test.go:113: groups: [65534 65534 65534 65534 65534 65534 65534 65534 1000]
os_unix_test.go:116: fchown /tmp/_Go_TestFileChown4034794686 -1 65534: chown /tmp/_Go_TestFileChown4034794686: invalid argument
--- FAIL: TestLchown (0.00s)
os_unix_test.go:153: gid: 1000
os_unix_test.go:168: groups: [65534 65534 65534 65534 65534 65534 65534 65534 1000]
os_unix_test.go:171: lchown /tmp/_Go_TestLchown3859759402 -1 65534: lchown /tmp/_Go_TestLchown3859759402: invalid argument
The problem is: The test cases try to chown the test file to every GID
the current user belongs too. With bubblewrap (which is used by rootbld)
only the primary GID is available. All other GIDs are mapped to the
overflow GID (usually 65534). However, chowning to the overflow GID
causes an invalid argument error. To workaround this issue, filter out
the overflow GID in the test cases.
Alternative: Skip this tests entirely when they are invoked from within
bubblewrap. This could for instance be detected by the presence of the
FAKEROOTDONTTRYCHOWN environment variable.
See also: https://github.com/containers/bubblewrap/issues/521#issuecomment-1192974798
diff -upr go.orig/src/os/os_unix_test.go go/src/os/os_unix_test.go
--- go.orig/src/os/os_unix_test.go 2022-09-23 12:36:28.276985650 +0200
+++ go/src/os/os_unix_test.go 2022-09-23 12:39:18.854010670 +0200
@@ -69,6 +69,10 @@ func TestChown(t *testing.T) {
}
t.Log("groups: ", groups)
for _, g := range groups {
+ if (g == 65534) {
+ continue
+ }
+
if err = Chown(f.Name(), -1, g); err != nil {
t.Fatalf("chown %s -1 %d: %s", f.Name(), g, err)
}
@@ -112,6 +116,10 @@ func TestFileChown(t *testing.T) {
}
t.Log("groups: ", groups)
for _, g := range groups {
+ if (g == 65534) {
+ continue
+ }
+
if err = f.Chown(-1, g); err != nil {
t.Fatalf("fchown %s -1 %d: %s", f.Name(), g, err)
}
@@ -167,6 +175,10 @@ func TestLchown(t *testing.T) {
}
t.Log("groups: ", groups)
for _, g := range groups {
+ if (g == 65534) {
+ continue
+ }
+
if err = Lchown(linkname, -1, g); err != nil {
t.Fatalf("lchown %s -1 %d: %s", linkname, g, err)
}
|