Skip to content

Commit ac037fb

Browse files
author
Lars Gerber
committed
fix(1722): use safe expansion for SSH_CONNECTION and SHLVL variable
1 parent 973787d commit ac037fb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/action/macos/configure_remote_building.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl ConfigureRemoteBuilding {
2323
r#"
2424
# Set up Nix only on SSH connections
2525
# See: https://github.com/DeterminateSystems/nix-installer/pull/714
26-
if [ -e '{PROFILE_NIX_FILE_SHELL}' ] && [ -n "${{SSH_CONNECTION}}" ] && [ "${{SHLVL}}" -eq 1 ]; then
26+
if [ -e '{PROFILE_NIX_FILE_SHELL}' ] && [ -n "${{SSH_CONNECTION:-}}" ] && [ "${{SHLVL:-0}}" -eq 1 ]; then
2727
. '{PROFILE_NIX_FILE_SHELL}'
2828
fi
2929
# End Nix

tests/fixtures/macos/macos.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@
11881188
"user": null,
11891189
"group": null,
11901190
"mode": 420,
1191-
"buf": "\n# Set up Nix only on SSH connections\n# See: https://github.com/DeterminateSystems/nix-installer/pull/714\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ] && [ -n \"${SSH_CONNECTION}\" ] && [ \"${SHLVL}\" -eq 1 ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n",
1191+
"buf": "\n# Set up Nix only on SSH connections\n# See: https://github.com/DeterminateSystems/nix-installer/pull/714\nif [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ] && [ -n \"${SSH_CONNECTION:-}\" ] && [ \"${SHLVL:-0}\" -eq 1 ]; then\n . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'\nfi\n# End Nix\n",
11921192
"position": "Beginning"
11931193
},
11941194
"state": "Completed"

0 commit comments

Comments
 (0)