bedrocklinux / bedrocklinux-userland

This tracks development for the things such as scripts and (defaults for) config files for Bedrock Linux
https://bedrocklinux.org
GNU General Public License v2.0
603 stars 64 forks source link

Package manager auto complete shows results from another package manager #180

Open Titaniumtown opened 4 years ago

Titaniumtown commented 4 years ago

I'm using arch linux as my main statum, and fish shell. When I tab-complete for pacman, I get packages that aren't available for pacman, but for apt.

Help!

paradigm commented 4 years ago

This appears to be because fish tab completion logic uses the same __fish_print_packages function for multiple (possibly all fish supported) package managers package lists, losing internal differentiating between them.

At first blush, this appears to be a design fault with fish's completion. While the situation is much less common, this design choice likely bites people on traditional distros, too. For example, on a (non-Bedrock) Arch install, I expect one can pacman -S rpm then rpm -q <tab> and see pacman packages. At the time of writing, Arch's copy of the fish snap completion code includes comments indicating they're planning on using __fish_print_packages for that a well; my guess is, that will bite more than just Bedrock users, and the issue will be brought to their attention then if no earlier.

I don't see any way to solve this from Bedrock's end. We can either let fish see cross-stratum commands to run and use for completion, or we restrict fish and hide cross-stratum commands from completion and execution. There's no obvious way to split those.

The only solution I see is a refactor of fish's completion code to manage the available package list per package manager. This is a low priority issue and likely an expensive one for me to pursue given my very limited fish background; I don't expect to get to it myself for quite a long time. If you know fish well enough you could try to upstream such a change.

Titaniumtown commented 4 years ago

So in the mean time, when I want to install a package, should I just use bash, or do strat -r ${Insert Stratum name here} fish?

paradigm commented 4 years ago

If not having packages from other strata show up in your tab completion is integral to your package installation workflow, that's one way to go about it. Were I in your shoes, though, I'd likely just ignore package names that aren't what I'm trying to tab complete anyways.