-
Notifications
You must be signed in to change notification settings - Fork 92
Use safe expansion for SSH_CONNECTION and SHLVL variable #1723
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
Conversation
WalkthroughThis PR fixes an issue where unset environment variables ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ac037fb to
db1eeef
Compare
|
I lightly tested this by running this to get the final string: fn main() {
const PROFILE_NIX_FILE_SHELL: &str =
"/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh";
let st = format!(
r#"
# Set up Nix only on SSH connections
# See: https://github.com/DeterminateSystems/nix-installer/pull/714
if [ -e '{PROFILE_NIX_FILE_SHELL}' ] && [ -n "${{SSH_CONNECTION}}" ] && [ "${{SHLVL}}" -eq 1 ]; then
if [ -e '{PROFILE_NIX_FILE_SHELL}' ] && [ -n "${{SSH_CONNECTION:-}}" ] && [ "${{SHLVL:-0}}" -eq 1 ]; then
. '{PROFILE_NIX_FILE_SHELL}'
fi
# End Nix
"#
);
println!("{}", st);
}and edited my /etc/zshenv: and everything seems fine from here. I think this is good, but I haven't actually tested the Reading the patch, it looks correct on the face of it, and |
Description
Resolves #1722
Replaced direct variable expansion with ${VAR:-} to avoid “parameter not set” errors when running the Mac App Store command-line interface.
Checklist
cargo fmtnix buildnix flake checkSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.