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
nix-shell: add bashInteractive to the start of the PATH, set SHELL #2455
Conversation
cc @scoates who found the issue |
src/nix-build/nix-build.cc
Outdated
@@ -417,16 +417,19 @@ void mainWrapped(int argc, char * * argv) | |||
"dontAddDisableDepTrack=1; " | |||
"[ -e $stdenv/setup ] && source $stdenv/setup; " | |||
"%3%" | |||
"PATH=\"$(dirname %4%):$PATH\"; " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be PATH=%N%
where N = dirOf(shell)
. I.e. compute the directory in C++, saving an external call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, nice! Fixed!
Arguably this reduces |
fd9ebe9
to
57e1c4e
Compare
It does, and it is a bit annoying that it makes it harder to override the shell. I'm not aware of a nice alternative which also keeps things consistently working. |
src/nix-build/nix-build.cc
Outdated
@@ -417,16 +417,19 @@ void mainWrapped(int argc, char * * argv) | |||
"dontAddDisableDepTrack=1; " | |||
"[ -e $stdenv/setup ] && source $stdenv/setup; " | |||
"%3%" | |||
"PATH=\"%4%:$PATH\"; " | |||
"SHELL=%4%; " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably PATH and SHELL shouldn't both refer to %4%
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SHELL=/nix/store/pd3xx55jjik53gvbyrs4h0him03l3wah-bash-interactive-4.4-p23/bin/bash
PATH=/nix/store/pd3xx55jjik53gvbyrs4h0him03l3wah-bash-interactive-4.4-p23/bin:...
Tools which re-exec `$SHELL` or `$0` or `basename $SHELL` or even just `bash` will otherwise get the non-interactive bash, providing a broken shell for the same reasons described in NixOS/nixpkgs#27493. Extends c94f3d5
57e1c4e
to
f11acba
Compare
Tools which re-exec
$SHELL
or$0
orbasename $SHELL
or even justbash
will otherwise get the non-interactive bash, providing abroken shell for the same reasons described in
NixOS/nixpkgs#27493.
Extends c94f3d5