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: don't check for "nix-shell" in shebang script name #3269

Merged
merged 1 commit into from Dec 14, 2019

Conversation

@xzfc
Copy link
Contributor

@xzfc xzfc commented Dec 14, 2019

Fix bug: if the path to the nix-shell shebang script contains "nix-shell", it won't run properly.

$ cat a-script-that-should-be-run-in-nix-shell.sh
#! /usr/bin/env nix-shell
#! nix-shell -p hello -i sh
hello

$ ./a-script-that-should-be-run-in-nix-shell.sh
error: undefined variable 'hello' at /tmp/a-script-that-should-be-run-in-nix-shell.sh:3:1

$ mv a-script-that-should-be-run-in-nix-shell.sh a-script.sh

$ ./a-script.sh
Hello, world!

Probably this check was relevant when nix-build was a perl script (as perl handles argv differently than C++).

@zimbatm
Copy link
Member

@zimbatm zimbatm commented Dec 14, 2019

this would fix #3153

@edolstra edolstra merged commit 8656a2d into NixOS:master Dec 14, 2019
@xzfc xzfc deleted the xzfc:nix-shell branch Dec 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.