about summary refs log tree commit diff
path: root/tests/common.sh.in
diff options
context:
space:
mode:
authorAleksandr Pashkov <pashkov.alex+github@gmail.com>2018-06-05T20·13+0300
committerAleksandr Pashkov <pashkov.alex+github@gmail.com>2018-06-05T21·41+0300
commit5ee4472b8bd5a3bda25599eb710f2c979e9c8876 (patch)
tree9497406e22f85e15835a7f4932cd584fe43709e2 /tests/common.sh.in
parent4ac4f675df3da01b6d814cd328dd3219dd472ac9 (diff)
tests: more robust check for user namespaces availability (canUseSandbox)
Issue https://github.com/NixOS/nix/issues/2165
Diffstat (limited to 'tests/common.sh.in')
-rw-r--r--tests/common.sh.in8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/common.sh.in b/tests/common.sh.in
index 195205988afb..fddd25b366bf 100644
--- a/tests/common.sh.in
+++ b/tests/common.sh.in
@@ -94,11 +94,9 @@ canUseSandbox() {
         return 1
     fi
 
-    if [ -e /proc/sys/kernel/unprivileged_userns_clone ]; then
-        if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" != 1 ]; then
-            echo "Unprivileged user namespaces disabled by sysctl, skipping this test..."
-            return 1
-        fi
+    if ! unshare --user true ; then
+        echo "Unprivileged user namespaces disabled by sysctl, skipping this test..."
+        return 1
     fi
 
     return 0