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
fish: fixup awk references #92229
fish: fixup awk references #92229
Conversation
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.
LGTM. Some day I'll come up with a way to make this unnecessary (i.e. an auto-generated patch using substituteAll
...), but that day is not today.
[4 built, 6 copied (24.7 MiB), 4.1 MiB DL]
https://github.com/NixOS/nixpkgs/pull/92229
1 package built:
fish
pkgs/shells/fish/default.nix
Outdated
@@ -165,6 +166,8 @@ let | |||
-i $out/share/fish/functions/{__fish_config_interactive.fish,fish_config.fish,fish_update_completions.fish} | |||
sed -i "s|/usr/local/sbin /sbin /usr/sbin||" \ | |||
$out/share/fish/completions/{sudo.fish,doas.fish} | |||
sed -e "s| awk | ${gawk}/bin/awk |" \ |
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.
Minor nit: I don't think -e
is necessary.
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.
Should not be necessary, I agree. I mostly went with the style of the other sed
commands, which explicitly add -e
as well (and only one of them actually uses several expressions).
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 included completions still use global awk:
$ grep -r " awk" results/fish/share/fish/completions/ | tail -n3
results/fish/share/fish/completions/heroku.fish: heroku domains | awk '{if (NR>1) print $1}'
results/fish/share/fish/completions/heroku.fish: heroku ps | awk -F':' '{if (NR>1) print $1}'
results/fish/share/fish/completions/heroku.fish: heroku releases | awk '{if (NR>1) print $1}'
More in general (doesn't have to be addressed in this PR), it seems like most of these |
good catch, thanks! |
Actually all of this patching feels a bit brittle. Maybe we could add a test of sorts, that runs all of the functions and completions through I had some success with this script:
It also produces some false positives, mostly due to cross references of the functions / completions. Still it looks like we are overlooking quite a few references: |
Ok, just notices that all of these references are from Edit: or put |
I'm against wrapping Even if we add The current situation of |
Well it could be done in such a way that any externally specified binaries are preferred (by postfixing). Also the current state is, that we patch in
They would use whatever their distro / setup gives them. I agree its not a perfect solution either.
As far as automating it goes, I am totally in favor of that = ) Still I think should go with |
I'm not worried about it being in the closure, but I am worried about it tainting I think the current approach (with |
@cole-h is this ready to merge? |
Yep. I just forgot to re-approve. Sorry! |
Cool, thanks! |
I gave the patching issue some more thought. I think a sane thing to do would be to wrap fish to put |
I also had the same idea once upon a time (modulo the configurable list) but after a conversation with adisbladis and emily on IRC, came to the conclusion that that would be undesirable. Logs start here: https://logs.nix.samueldr.com/nixos/2020-04-29#3388524. |
Motivation for this change
The fish shell currently has an implicit runtime dependency on
awk
. Make this explicit by replacing the references.We already do this for lots of other tools
fish
uses, butawk
was overlooked, due to it being installed on every system (its one of therequiredPackages
currently which always wind up insystemPackages
). This might (hopefully) change in the future, and anyway its probably a good idea to make the dependency more explicit.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)