diff options
author | Aleksandr Pashkov <pashkov.alex+github@gmail.com> | 2018-06-05T20·13+0300 |
---|---|---|
committer | Aleksandr Pashkov <pashkov.alex+github@gmail.com> | 2018-06-05T21·41+0300 |
commit | 5ee4472b8bd5a3bda25599eb710f2c979e9c8876 (patch) | |
tree | 9497406e22f85e15835a7f4932cd584fe43709e2 /tests/common.sh.in | |
parent | 4ac4f675df3da01b6d814cd328dd3219dd472ac9 (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.in | 8 |
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 |