Skip to content

Fix early removal of nix-shell rc-file - #1034

Closed
hedning wants to merge 1 commit into
NixOS:masterfrom
hedning:nix-shell/remove-BASH_ENV
Closed

hedning wants to merge 1 commit into
NixOS:masterfrom
hedning:nix-shell/remove-BASH_ENV

Conversation

@hedning

@hedning hedning commented Aug 16, 2016 •

Copy link
Copy Markdown

BASH_ENV causes all non-interactive shells called via eg. /etc/bashrc to
remove the rc-file before the main shell gets to run it. Completion
scripts will often do this. Fixes #976.

Looking at the blame information it seems that there's no reason $ENV{BASH_ENV} = $rcfile would cause trouble if removed. It was introduced to support the --command flag, but a later commit makes non-interactive scripts run the rcfile directly, ie. bash $rcfile.

The same bug is present in the c++ rewrite I believe.

BASH_ENV causes all non-interactive shells called via eg. /etc/bashrc to
remove the rc-file before the main shell gets to run it. Completion
scripts will often do this. Fixes NixOS#976.
@hedning hedning mentioned this pull request Aug 16, 2016
@shlevy

shlevy commented Aug 16, 2016

Copy link
Copy Markdown
Member

Will incorporate this into the c++ rewrite if @edolstra likes the change.

@Ericson2314

Copy link
Copy Markdown
Member

BASH_ENV will still be unset in a pure shell, right?

@shlevy

shlevy commented Aug 16, 2016

Copy link
Copy Markdown
Member

Yes

@DamienCassou

Copy link
Copy Markdown

What is the correct way to try this patch under NixOS? I'm facing #1043 and would like to see if your patch solves my problem. Thanks.

@hedning

hedning commented Sep 8, 2016

Copy link
Copy Markdown
Author

Not completely sure how the correct way is, but a hacky way is to copy nix-build to $HOME/bin rename it to nix-shell and apply the patch (assuming $HOME/bin is at the start of $PATH).

@shlevy

shlevy commented Sep 8, 2016

Copy link
Copy Markdown
Member

@DamienCassou You should be able to use overrideDerivation to add a patches attribute to nix.

@shlevy

shlevy commented Sep 8, 2016

Copy link
Copy Markdown
Member

@edolstra I will incorporate this into nix-build-c++ (and backport to perl on 1.11-maintenance) in a few days barring objections

@edolstra

edolstra commented Sep 8, 2016

Copy link
Copy Markdown
Member

Sure, sounds good.

@shlevy shlevy closed this in a5f2750 Sep 8, 2016
shlevy added a commit that referenced this pull request Sep 8, 2016
BASH_ENV causes all non-interactive shells called via eg. /etc/bashrc to
remove the rc-file before the main shell gets to run it. Completion
scripts will often do this. Fixes #976.

Adapted from and fixes #1034.
Ma27 pushed a commit to Ma27/nix that referenced this pull request Mar 8, 2026
…cannot be setup

Fixes NixOS#1034

Change-Id: Ic65ef955c4eb44766926e9b3ef4dcb4b94820a16
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.

5 participants