Skip to content
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

Merged
merged 1 commit into from Sep 27, 2018

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Sep 27, 2018

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

@grahamc
Copy link
Member Author

grahamc commented Sep 27, 2018

cc @scoates who found the issue

@grahamc
Copy link
Member Author

grahamc commented Sep 27, 2018

Closes #2034 and #644

@@ -417,16 +417,19 @@ void mainWrapped(int argc, char * * argv)
"dontAddDisableDepTrack=1; "
"[ -e $stdenv/setup ] && source $stdenv/setup; "
"%3%"
"PATH=\"$(dirname %4%):$PATH\"; "
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice! Fixed!

@edolstra
Copy link
Member

Arguably this reduces nix-shell purity, since you don't get the shell specified by the build environment. Probably not a big deal...

@grahamc
Copy link
Member Author

grahamc commented Sep 27, 2018

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.

@@ -417,16 +417,19 @@ void mainWrapped(int argc, char * * argv)
"dontAddDisableDepTrack=1; "
"[ -e $stdenv/setup ] && source $stdenv/setup; "
"%3%"
"PATH=\"%4%:$PATH\"; "
"SHELL=%4%; "
Copy link
Member

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%?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️

Copy link
Member Author

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
@edolstra edolstra merged commit f74e0b4 into NixOS:master Sep 27, 2018
@grahamc grahamc deleted the add-interactive-path branch September 27, 2018 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants