[Pkg-golang-commits] [golang] 07/27: - d/patches/skip-userns-tests-when-chrooted.patch (see Debian bug #807303)
Michael Hudson-Doyle
mwhudson-guest at moszumanska.debian.org
Tue Mar 1 02:57:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
mwhudson-guest pushed a commit to branch gbp
in repository golang.
commit 2e2d6b49920999782792f0e49e76e9ab9f4cac0e
Author: Michael Hudson-Doyle <michael.hudson at canonical.com>
Date: Fri Feb 12 10:16:26 2016 +1300
- d/patches/skip-userns-tests-when-chrooted.patch (see Debian bug #807303)
---
debian/patches/series | 1 +
.../patches/skip-userns-tests-when-chrooted.patch | 37 ++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/debian/patches/series b/debian/patches/series
index 129ca03..7205756 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
armhf-elf-header.patch
+skip-userns-tests-when-chrooted.patch
diff --git a/debian/patches/skip-userns-tests-when-chrooted.patch b/debian/patches/skip-userns-tests-when-chrooted.patch
new file mode 100644
index 0000000..15bd724
--- /dev/null
+++ b/debian/patches/skip-userns-tests-when-chrooted.patch
@@ -0,0 +1,37 @@
+Description: skip tests that create a user namespace when chrooted
+Origin: https://go.googlesource.com/go/+/21efa7b2bc872958bcb252f5ab4dc52b2b0abeae
+Applied-Upstream: commit:21efa7b2bc872958bcb252f5ab4dc52b2b0abeae
+
+--- a/src/syscall/exec_linux_test.go
++++ b/src/syscall/exec_linux_test.go
+@@ -17,6 +17,17 @@
+ "testing"
+ )
+
++// Check if we are in a chroot by checking if the inode of / is
++// different from 2 (there is no better test available to non-root on
++// linux).
++func isChrooted(t *testing.T) bool {
++ root, err := os.Stat("/")
++ if err != nil {
++ t.Fatalf("cannot stat /: %v", err)
++ }
++ return root.Sys().(*syscall.Stat_t).Ino != 2
++}
++
+ func whoamiCmd(t *testing.T, uid, gid int, setgroups bool) *exec.Cmd {
+ if _, err := os.Stat("/proc/self/ns/user"); err != nil {
+ if os.IsNotExist(err) {
+@@ -24,6 +35,12 @@
+ }
+ t.Fatalf("Failed to stat /proc/self/ns/user: %v", err)
+ }
++ if isChrooted(t) {
++ // create_user_ns in the kernel (see
++ // https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/kernel/user_namespace.c)
++ // forbids the creation of user namespaces when chrooted.
++ t.Skip("cannot create user namespaces when chrooted")
++ }
+ cmd := exec.Command("whoami")
+ cmd.SysProcAttr = &syscall.SysProcAttr{
+ Cloneflags: syscall.CLONE_NEWUSER,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-golang/golang.git
More information about the pkg-golang-commits
mailing list