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 | |
parent | 4ac4f675df3da01b6d814cd328dd3219dd472ac9 (diff) |
tests: more robust check for user namespaces availability (canUseSandbox)
Issue https://github.com/NixOS/nix/issues/2165
-rw-r--r-- | release-common.nix | 2 | ||||
-rw-r--r-- | tests/common.sh.in | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/release-common.nix b/release-common.nix index d7fb8125f25e..fbdb8aca1fd1 100644 --- a/release-common.nix +++ b/release-common.nix @@ -57,7 +57,7 @@ rec { git mercurial ] - ++ lib.optional stdenv.isLinux libseccomp + ++ lib.optional stdenv.isLinux [libseccomp pkgs.utillinux] ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) (aws-sdk-cpp.override { 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 |