summaryrefslogtreecommitdiff
path: root/repo/go/tests-unshare-enosys.patch
diff options
context:
space:
mode:
Diffstat (limited to 'repo/go/tests-unshare-enosys.patch')
-rw-r--r--repo/go/tests-unshare-enosys.patch19
1 files changed, 19 insertions, 0 deletions
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
+ }
+ }