New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/test-driver: Specify /bin/sh shell when running a bourne shell script as the user #87414
nixos/test-driver: Specify /bin/sh shell when running a bourne shell script as the user #87414
Conversation
…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
Defining the shell makes a lot of sense, but i would prefer explicitly pointing to a specific shell instead of assuming |
We can assume |
Is this expected to be runnable interactively? If yes, #1424 might probably apply if the terminal emulator is used inside a graphical session with OpenGL. |
@7c6f434c this |
@7c6f434c this `/bin/sh` is only used as a shell for su, to then execute `systemctl --user` in a non-interactive fashion.
No, the question is not whether this uses interactivity, the question is whether this can happen while the user tries to use something like interactive REPL for debugging tests.
|
I'm still not sure if I understand the question correctly, sorry. So far, the |
So far, the `Machine.execute` method (which is used under the hood) isn't able to be used interactively, also when using the interactive ptpython REPL.
Oh, my fault, `/bin/sh` is inside the VM, not outside. Right, then `/bin/sh` and the `Machine.execute` environment have to be in sync inside VM, even if a switch is being tested.
|
@7c6f434c so you now agree with the changes proposed here? |
Yes, I now fail to invent a problematic scenario, and I agree that in a non-Nix-expanded Python file using the store path to shell is nice but not free.
|
Thanks! |
Motivation for this change
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:
results in
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)@tfc