mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
fix: don’t expand aliases in develop stdenv setup
This fixes https://github.com/NixOS/nixpkgs/pull/290775 by not expanding aliases
when sourcing the stdenv setup script. The way bash handles aliases is to expand
them when a function is defined, not when it is used. I.e.:
$ alias echo="echo bar "
$ echo foo
bar foo
$ xyzzy() { echo foo; }
$ shopt -u expand_aliases
$ xyzzy
bar foo
$ xyzzy2() { echo foo; }
$ xyzzy2
foo
The problem is that ~/.bashrc is sourced before the stdenv setup, and bashrc
commonly sets aliases for ‘cp’, ‘mv’ and ‘rm’ which you don’t want to take
effect in the stdenv derivation builders. The original commit introducing this
feature (5fd8cf7667
) even mentioned this very
alias.
The only way to avoid this is to disable aliases entirely while sourcing the
stdenv setup, and reenable them afterwards.
This commit is contained in:
parent
c940d11fb0
commit
6bf7edb18b
1 changed files with 1 additions and 1 deletions
|
@ -610,7 +610,7 @@ struct CmdDevelop : Common, MixEnvironment
|
|||
}
|
||||
|
||||
else {
|
||||
script = "[ -n \"$PS1\" ] && [ -e ~/.bashrc ] && source ~/.bashrc;\n" + script;
|
||||
script = "[ -n \"$PS1\" ] && [ -e ~/.bashrc ] && source ~/.bashrc;\nshopt -u expand_aliases\n" + script + "\nshopt -s expand_aliases\n";
|
||||
if (developSettings.bashPrompt != "")
|
||||
script += fmt("[ -n \"$PS1\" ] && PS1=%s;\n",
|
||||
shellEscape(developSettings.bashPrompt.get()));
|
||||
|
|
Loading…
Reference in a new issue