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
patchShebangs: performance/readability optimization #94642
Conversation
The following built for me:
|
This looks fine to me. Perhaps we should reorganize the commits once more but otherwise this looks like it deserves a shot in the staging branch. |
I can confirm that it builds on other Linux distributions. |
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.
Please squash the commits.
builtins for small input sizes should be faster due to less forking.
according to shellcheck [[ foo == "bla" ]] && [[ ... ]] has better posix semantics over [ foo = "bla" -a ... ]. It is also easier to read.
less commands -> faster
done. |
/marvin opt-in |
Hi! I'm an experimental bot. My goal is to guide this PR through its stages, hopefully ending with a merge. You can read up on the usage here. |
I have reverted this patch in staging-next as it apparently caused the |
This caused shebangs that were already store paths to be rewritten. Introduced by ab4c359 in NixOS#94642 Example difference: $ echo "hello world" | tail -c+3 llo world $ str="hello world"; echo ${str:3} lo world
This caused shebangs that were already store paths to be rewritten. Introduced by ab4c359 in NixOS#94642 Example difference: $ echo "hello world" | tail -c+3 llo world $ str="hello world"; echo ${str:3} lo world
@@ -105,12 +105,12 @@ patchShebangs() { | |||
} | |||
|
|||
patchShebangsAuto () { | |||
if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then | |||
if [[ -z "${dontPatchShebangs-}" && -e "$prefix" ]]; 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.
I've noticed dontPatchShebangs
not being respected for the androidStudioPackages.{canary,dev}
a bit ago, could this have anything to do with this change?
I'm not too familair with the stdenv or bash scripting, so please disregard this comment if it does not make any sense.
if [[ -z "${dontPatchShebangs-}" && -e "$prefix" ]]; then | |
if [[ -z "${dontPatchShebangs-}" || -e "$prefix" ]]; 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.
The -a
stands for &&
, so the code is correct. Is dontPatchShebangs
unset by anything in the package you mention?
Motivation for this change
need for speed
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)