summaryrefslogtreecommitdiffstats
path: root/nixos/tests
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-09-05 14:35:40 +0200
committerCole Helbling <cole.e.helbling@outlook.com>2021-11-08 14:05:24 -0800
commitd14ae62671fd4eaec57427da1e50f91d6a5f9605 (patch)
treeb95f5d53687195cfda8c382d426b46bae48b70ee /nixos/tests
parent0f410940884437e4337e8f5d2ec3f7b702a7a836 (diff)
nixos/terminfo: inherit TERMINFO* env vars also for doas
This should mirror the behavior we implement for sudo: The TERMINFO and TERMINFO_DIRS variables are inherited from the normal user's environment, so terminfo files installed in the user's profile can be found by ncurses applications running as root.
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/doas.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/nixos/tests/doas.nix b/nixos/tests/doas.nix
index 5e9ce4b2c799..7f038b2bee29 100644
--- a/nixos/tests/doas.nix
+++ b/nixos/tests/doas.nix
@@ -85,6 +85,14 @@ import ./make-test-python.nix (
# ../../pkgs/tools/security/doas/0001-add-NixOS-specific-dirs-to-safe-PATH.patch
with subtest("recursive calls to doas from subprocesses should succeed"):
machine.succeed('doas -u test0 sh -c "doas -u test0 true"')
+
+ with subtest("test0 should inherit TERMINFO_DIRS from the user environment"):
+ dirs = machine.succeed(
+ "su - test0 -c 'doas -u root $SHELL -c \"echo \$TERMINFO_DIRS\"'"
+ )
+
+ if not "test0" in dirs:
+ raise Exception(f"user profile TERMINFO_DIRS is not preserved: {dirs}")
'';
}
)