From 0d37a1ef234c38b27faba43bc3a22f985d311deb Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 17 May 2023 17:01:27 +0100 Subject: Remove all firmware --- repo/go/go.xibuild | 17 ++++----- repo/go/tests-filter-overflow-gid.patch | 65 +++++++++++++++++++++++++++++++++ repo/go/tests-unset-GCCGO.patch | 16 ++++++++ repo/go/tests-unshare-enosys.patch | 19 ++++++++++ repo/go/tests-x86-testsigfwd.patch | 14 +++++++ 5 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 repo/go/tests-filter-overflow-gid.patch create mode 100644 repo/go/tests-unset-GCCGO.patch create mode 100644 repo/go/tests-unshare-enosys.patch create mode 100644 repo/go/tests-x86-testsigfwd.patch (limited to 'repo/go') diff --git a/repo/go/go.xibuild b/repo/go/go.xibuild index 1db6040..585a2d0 100644 --- a/repo/go/go.xibuild +++ b/repo/go/go.xibuild @@ -4,20 +4,20 @@ MAKEDEPS="make gcc" DEPS="" -PKG_VER=1.17.13 +PKG_VER=1.20.3 SOURCE=https://go.dev/dl/go$PKG_VER.src.tar.gz -BOOTSTRAP="go1.4-bootstrap-20171003" +BOOTSTRAP="go-linux-amd64-bootstrap-1.19.1" ADDITIONAL=" - https://dl.google.com/go/$BOOTSTRAP.tar.gz + https://dev.gentoo.org/~williamh/dist/$BOOTSTRAP.tbz " DESC="Core compiler tools for the Go programming language" prepare () { export TMPDIR=/tmp - tar -xvf $BOOTSTRAP.tar.gz - mv go $BOOTSTRAP + tar -xvf $BOOTSTRAP.tbz + mv go-linux-amd64-bootstrap $BOOTSTRAP } build () { @@ -29,18 +29,17 @@ build () { cd $BOOTSTRAP cd src echo "~~~~BUILDING BOOTSTRAP" - CGO_ENABLED=0 ./make.bash -v + CGO_ENABLED=0 ./make.bash -v || return 1 cd $sourceroot - export GOROOT_FINAL=/usr/lib/go export GOROOT_BOOTSTRAP="$(pwd)/$BOOTSTRAP" echo "~~~~BUILDING GOLANG" cd src if [ ! -z "${GOROOT_BOOTSTRAP}" ]; then - ./bootstrap.bash -v + ./bootstrap.bash -v || return 1 fi - ./make.bash -v + ./make.bash -v || reutrn 1 cd .. } diff --git a/repo/go/tests-filter-overflow-gid.patch b/repo/go/tests-filter-overflow-gid.patch new file mode 100644 index 0000000..f06ead7 --- /dev/null +++ b/repo/go/tests-filter-overflow-gid.patch @@ -0,0 +1,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) + } diff --git a/repo/go/tests-unset-GCCGO.patch b/repo/go/tests-unset-GCCGO.patch new file mode 100644 index 0000000..b69450b --- /dev/null +++ b/repo/go/tests-unset-GCCGO.patch @@ -0,0 +1,16 @@ +We skip many gccgo tests by setting GCCGO to a bogus value. However, +this particular test doesn't properly handle a non-existing $GCCGO +hence we unset the environment variable here. + +diff -upr go.orig/src/cmd/go/testdata/script/gccgo_link_c.txt go/src/cmd/go/testdata/script/gccgo_link_c.txt +--- go.orig/src/cmd/go/testdata/script/gccgo_link_c.txt 2022-09-30 10:58:07.524516646 +0200 ++++ go/src/cmd/go/testdata/script/gccgo_link_c.txt 2022-09-30 10:58:29.441202925 +0200 +@@ -4,6 +4,8 @@ + [!cgo] skip + [!exec:gccgo] skip + ++env GCCGO= ++ + go build -n -compiler gccgo + stderr 'gccgo.*\-L [^ ]*alibpath \-lalib' # make sure that Go-inline "#cgo LDFLAGS:" ("-L alibpath -lalib") passed to gccgo linking stage + diff --git a/repo/go/tests-unshare-enosys.patch b/repo/go/tests-unshare-enosys.patch new file mode 100644 index 0000000..addb696 --- /dev/null +++ b/repo/go/tests-unshare-enosys.patch @@ -0,0 +1,19 @@ +On the Alpine CI our moby configuration returns ENOSYS instead of EPERM +when attempting to use the unshare(2) system call from a container. The +Go test suite expects unshare(2) to return EPERM in this scenario and +skips tests using it when it does. By treating the ENOSYS errno in the +same way as the EPERM errno we can ensure that the Go test suite +continues to work on the Alpine CI. + +diff -upr go.orig/src/runtime/testdata/testprog/syscalls_linux.go go/src/runtime/testdata/testprog/syscalls_linux.go +--- go.orig/src/runtime/testdata/testprog/syscalls_linux.go 2021-03-11 18:14:31.000000000 +0100 ++++ go/src/runtime/testdata/testprog/syscalls_linux.go 2021-03-12 17:26:10.927644763 +0100 +@@ -46,7 +46,7 @@ func unshareFs() error { + err := syscall.Unshare(syscall.CLONE_FS) + if err != nil { + errno, ok := err.(syscall.Errno) +- if ok && errno == syscall.EPERM { ++ if ok && (errno == syscall.EPERM || errno == syscall.ENOSYS) { + return errNotPermitted + } + } diff --git a/repo/go/tests-x86-testsigfwd.patch b/repo/go/tests-x86-testsigfwd.patch new file mode 100644 index 0000000..a681ec4 --- /dev/null +++ b/repo/go/tests-x86-testsigfwd.patch @@ -0,0 +1,14 @@ +See https://github.com/golang/go/issues/54422 + +diff -upr go.orig/misc/cgo/testsigfwd/main.go go/misc/cgo/testsigfwd/main.go +--- go.orig/misc/cgo/testsigfwd/main.go 2022-08-12 20:28:17.222319036 +0200 ++++ go/misc/cgo/testsigfwd/main.go 2022-08-12 20:28:45.752384953 +0200 +@@ -7,7 +7,7 @@ package main + import "fmt" + + /* +-#cgo CFLAGS: -pthread ++#cgo CFLAGS: -pthread -fno-stack-protector + #cgo LDFLAGS: -pthread + + #include -- cgit v1.2.1