-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
command-not-found: make script portable #3914
Conversation
Without `/usr/bin/env -S`, this breaks with bash on Darwin
I guess that explains #3858. This should probably be fixed in the spirit of NixOS/nixpkgs#124556 by using |
Replacing |
#!/usr/bin/env -S @perl@/bin/perl -w | ||
|
||
use strict; |
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.
Another alternative, that I think may be better:
#!/usr/bin/env -S @perl@/bin/perl -w | |
use strict; | |
#!@perl@/bin/perl | |
use strict; | |
use warnings; |
Unfortunately, I think Some time ago I worked on an alternative wrapper tool that attempts to be something of an intermediate between the standard Bash wrapper and the binary wrapper. That style of wrapper would be more suitable for our purposes, I think. That said. I think in this case the best solution would be use remove the |
What's wrong with that? Compiling the wrapper is very fast.
I don't see how this fixes the issue at hand, which is that Darwin doesn't support recursive shebangs, and Svep is a neat idea though, short of proper declarative wrappers... |
@ncfavier I see. Hopefully that can be addressed at upstream but I don't think I'm stepping into it today though. Also I just learned that even if this shebang thing is fixed, the experience with However, I also learned that using So I'm closing this PR for now. Thanks for both @ncfavier and @rycee, I learned more about the subject thanks to your comments :) |
Without
/usr/bin/env -S
, this breaks with bash on DarwinDescription
I discovered that shebang being a pure script (not binary) seems to be problematic with
bashInteractive package on Darwin (I imagine the same for
bash)
But works with zsh
So I found and tested the solution that works for both bash and zsh on Darwin as well as NixOS.
Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Added myself as module maintainer. See example.
Added myself and the module files to
.github/CODEOWNERS
.