From b5523dbd64eb0fe80e2c21995cac91e76d74c827 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Tue, 5 Jan 2021 17:26:48 -0600 Subject: [PATCH] Restrict `pkg` completions to BSD 0507b04 loosened the FreeBSD-only restriction on `pkg` completions to !SunOS in order to support DragonFlyBSD. This is overly broad and can still cause the script to be loaded on systems that we can't realistically expect to have `pkg` be the FreeBSD pkgng package manager (especially since `pkg` is a much more generic term when compared to the likes of `dnf`, `yum`, `deb`, and `apt`). This patch changes `pkg` + BSD to be the minimum requirements for considering a system to be using pkgng. --- share/completions/pkg.fish | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/share/completions/pkg.fish b/share/completions/pkg.fish index db7576904..7bdca87f6 100644 --- a/share/completions/pkg.fish +++ b/share/completions/pkg.fish @@ -1,8 +1,14 @@ # Completions for pkgng package manager -# Solaris has a thing called "pkg", it works quite differently, -# and spews errors when called like this. -if uname | string match -q SunOS +# Solaris has a thing called "pkg"; it works quite differently and spews errors when called here. +# There are multiple SunOS-derived distributions and not all of them have `SunOS` in their name (and +# some of them also use pkgsrc and have a `pkg`). +# +# Additionally, this particular script is intended to complete the pkgng "Next Generation" package +# manager initially developed for FreeBSD though now available on a few other BSDs. From here on +# out, maintainers can assume we are specifically talking about the (Free)BSD `pkg` command being +# executed on a BSD system, rather than just work with "not SunOS". +if ! uname | string match -irq bsd exit end