FS#70103 - fish's default command-not-found handler is slow when pkgfile is not installed

Attached to Project: Community Packages
Opened by Johannes Altmanninger (krobelus) - Sunday, 21 March 2021, 08:56 GMT
Last edited by Andreas Radke (AndyRTR) - Thursday, 22 July 2021, 05:33 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Levente Polyak (anthraxx)
Filipe Laíns (FFY00)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

When a user tries to run a command, fish by default uses "pkgfile" to look for packages that provide the command.
However, if "pkgfile" is not installed, it falls back on "pacman -F", which is very slow, so it should be disabled by default.

Additional info:
* package version(s): fish 3.2.1
* link to upstream bug report: https://github.com/fish-shell/fish-shell/issues/7841

Steps to reproduce:
# pacman -Rsn pkgfile
$ fish
$ some-missing-command # this will take like one second

Possible resolution:

Until this is fixed upstream or in pacman, the fish package could patch `fish_command_not_found.fish` like so:

```diff
diff --git a/share/functions/fish_command_not_found.fish b/share/functions/fish_command_not_found.fish
index db568fd69..cd915e63f 100644
--- a/share/functions/fish_command_not_found.fish
+++ b/share/functions/fish_command_not_found.fish
@@ -66,7 +66,8 @@ else if type -q pacman
string match -q '/*' -- $argv[1]; or set paths $PATH/$argv[1]
# Pacman only prints the path, so we still need to print the error.
__fish_default_command_not_found_handler $argv[1]
- pacman -F $paths
+ # WORKAROUND Do not ask pacman because it is slow.
+ # pacman -F $paths
end
else
# Use standard fish command not found handler otherwise
```
This task depends upon

Closed by  Andreas Radke (AndyRTR)
Thursday, 22 July 2021, 05:33 GMT
Reason for closing:  Fixed
Comment by Johannes Altmanninger (krobelus) - Sunday, 21 March 2021, 10:58 GMT
Already fixed upstream, but it would still be nice to include the patch since the next release can take some time.

Loading...