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
patch-shebangs: use isScript to safely check for shebang start #47446
patch-shebangs: use isScript to safely check for shebang start #47446
Conversation
if [ "$(head -1 "$f" | head -c+2)" != '#!' ]; then | ||
# missing shebang => not a script | ||
continue | ||
if ! isScript "$f"; then |
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.
Also seems faster the the original due less forking.
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.
@aszlig any further remarks?
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.
No forking at all actually.
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.
Although I personally find isScript "$f" || continue
more readable.
@@ -19,9 +19,8 @@ patchShebangs() { | |||
local newInterpreterLine | |||
|
|||
find "$dir" -type f -perm -0100 | while read f; do |
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.
This surprisingly worked well for us. However I wonder if this should be also just use https://stackoverflow.com/a/1120952
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.
This can also go in different pull request also I thought it might be easy enough to change here as well.
I'm surprised it hasn't been more problematic as well, and I think we do that correctly elsewhere although don't remember where offhand. Makes sense to change that as well so only rebuild all the things once but might end up tackling separately as it's less "obviously correct" ;). |
Fixes commonly encountered errors about broken pipes or null-bytes in command-substitution.
The latter is to avoid warnings printed by find if it doesn't exist.
4aa090c
to
f7db287
Compare
Nevermind, added all the mentioned fixups :). |
Fixes commonly encountered errors about broken pipes or null-bytes in
command-substitution.
Fixing another source of errors in logs produced by our setup-hooks.
Have yet to push through full rebuild but using the modified setuphook
selectively in cases of my own showed the errors no longer occurring
and shebangs were fixed where found.
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)