summaryrefslogtreecommitdiffstats
path: root/debian/patches/0006-skip-userns-test-in-schroot-as-well.patch
blob: 2d874c8bf7ddfb39ea21a0ca9cabc01d844648e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Shengjing Zhu <zhsj@debian.org>
Date: Fri, 5 Feb 2021 21:21:45 +0800
Subject: skip userns test in schroot as well

When schroot is using overlayfs, it fails to detect it as chroot.

---
 src/syscall/exec_linux_test.go | 7 +++++++
 1 file changed, 7 insertions(+)

--- a/src/syscall/exec_linux_test.go
+++ b/src/syscall/exec_linux_test.go
@@ -33,6 +33,10 @@
 	return os.Getenv("container") == "lxc"
 }
 
+func isSchroot() bool {
+	return os.Getenv("SCHROOT_SESSION_ID") != ""
+}
+
 func skipInContainer(t *testing.T) {
 	// TODO: the callers of this func are using this func to skip
 	// tests when running as some sort of "fake root" that's uid 0
@@ -48,6 +52,9 @@
 	if isLXC() {
 		t.Skip("skip this test in LXC container")
 	}
+	if isSchroot() {
+		t.Skip("skip this test in Schroot container")
+	}
 }
 
 func skipNoUserNamespaces(t *testing.T) {