summaryrefslogtreecommitdiff
path: root/repo/go/tests-unshare-enosys.patch
blob: addb696e6c72b6b4407471d14e73ff8a8b213d89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
 		}
 	}