about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorChuck <chuck@intelligence.org>2020-05-09 10:32:42 -0700
committerChuck <chuck@intelligence.org>2020-05-09 11:01:17 -0700
commit751a27020e733f064339eab208327b85c23e3c42 (patch)
treef7ba991d9680a8882ab151592f97a23c07b34402 /nixos/lib
parentd0c3e7bedb390d79291f23685355bcaf1fcd152f (diff)
downloadnixlib-751a27020e733f064339eab208327b85c23e3c42.tar
nixlib-751a27020e733f064339eab208327b85c23e3c42.tar.gz
nixlib-751a27020e733f064339eab208327b85c23e3c42.tar.bz2
nixlib-751a27020e733f064339eab208327b85c23e3c42.tar.lz
nixlib-751a27020e733f064339eab208327b85c23e3c42.tar.xz
nixlib-751a27020e733f064339eab208327b85c23e3c42.tar.zst
nixlib-751a27020e733f064339eab208327b85c23e3c42.zip
nixos/test-driver: Specify /bin/sh shell when running a bourne shell script as the user
The test harness provides the commands it wishes to run in Bourne
syntax.  This fails if the user uses a different shell.  For example,
with fish:

  machine.wait_for_unit("graphical-session.target", "alice")

machine # fish: Unsupported use of '='. To run '-u`' with a modified environment, please use 'env XDG_RUNTIME_DIR=/run/user/`id -u`…'
machine # XDG_RUNTIME_DIR=/run/user/`id -u` systemctl --user --no-pager show "graphical-session.target"
machine # ^
machine # [   16.329957] su[1077]: pam_unix(su:session): session closed for user alice
error: retrieving systemctl info for unit "graphical-session.target" under user "alice" failed with exit code 127
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/test-driver/test-driver.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py
index 84661a4a758c..bf46d0df97f9 100644
--- a/nixos/lib/test-driver/test-driver.py
+++ b/nixos/lib/test-driver/test-driver.py
@@ -369,7 +369,7 @@ class Machine:
             q = q.replace("'", "\\'")
             return self.execute(
                 (
-                    "su -l {} -c "
+                    "su -l {} --shell /bin/sh -c "
                     "$'XDG_RUNTIME_DIR=/run/user/`id -u` "
                     "systemctl --user {}'"
                 ).format(user, q)