Commit 9851dde0 authored by Sören Tempel's avatar Sören Tempel Committed by Sören Tempel
Browse files

community/go: fix chown test failure in abuild rootbld

parent 15f53309
......@@ -18,6 +18,7 @@ source="https://go.dev/dl/go$pkgver.src.tar.gz
0001-runtime-cgo-add-fno-stack-protector-to-CFLAGS.patch
allow-unshare-to-return-enosys.patch
fix-testsigfwd-on-x86.patch
tests-filter-overflow-gid.patch
"
case "$CARCH" in
arm*|aarch64) depends="binutils-gold";;
......@@ -227,4 +228,5 @@ sha512sums="
62a3251127f46c4ded80e95183251a18b94ec0e975d255c87c5c275c9144466d4c53281f88df00640ac6751354c047f30d89e632aedb7de0661f61bdfc0a6a38 0001-runtime-cgo-add-fno-stack-protector-to-CFLAGS.patch
6017caacf77c2911e9e882878fdaa2ed066b76b7e97b2ad776bc33d96b21cabc802966473946642c86a8f985c69adcc5e7ea61684f6d0dbacd468a6aad687229 allow-unshare-to-return-enosys.patch
e67b1803e5b0de2a686215b0c37026fda3084058fbc15ef72e4ab6d1f61d90052c99283cbf757a4a7adcf982467361dce9423ad456b9e060f471f86075202601 fix-testsigfwd-on-x86.patch
9f656adb00d174aeae3fc09eeeba1931a290e8cf9e1d3f5e0f232dcf121d45dba04210f88afbb3915b0d7e21dad5c165de9307f4b53e33ba718d312153391571 tests-filter-overflow-gid.patch
"
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)
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment