Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command



On Tue, Jul 11, 2023 at 10:12 AM Mirko Matošin
<mirko.matosin@xxxxxxxxxxxxxxxx> wrote:
>
> As soon as i hit tab after autoremove it wants to install sqlite
>
> mirko@fedora ~$ sudo dnf autoremove zsh: sqlite3: Befehl nicht gefunden...
> Soll das Paket »sqlite« installiert werden, welches den Befehl »sqlite3« bereitstellt? [N/y]
> ```

It works fine for me in docker:

    % docker run -e LC_ALL=C.UTF-8 -e TERM -it --rm fedora bash -uexc '
        yum update -y
        yum install -y zsh
        exec zsh'

    [root@8846ed956e61]~# autoload -Uz compinit
    [root@8846ed956e61]~# compinit
    [root@8846ed956e61]~# dnf autoremove [TAB]
    zsh: do you wish to see all 149 possibilities (149 lines)?

I see that Completion/Redhat/Command/_dnf invokes sqlite3
conditionally if /var/cache/dnf/packages.db exists. On my system
neither this file nor sqlite3 exist but on yours the file must exist
but not sqlite3, hence the error. Perhaps _dnf should have another
condition in there?

Roman.
diff --git a/Completion/Redhat/Command/_dnf b/Completion/Redhat/Command/_dnf
index ce111f38f..0f2e42a81 100644
--- a/Completion/Redhat/Command/_dnf
+++ b/Completion/Redhat/Command/_dnf
@@ -40,7 +40,7 @@ _dnf_packages() {
   selected=$selected[2]
   if [[ $selected = upgradable ]]; then
     pkgs=( $(_dnf_helper upgrade) )
-  elif [[ -r $cache_file ]]; then
+  elif [[ -v commands[sqlite3] && -r $cache_file ]]; then
     local table=$selected
     # 'available' table contains both 'available' and 'installed' packages
     [[ $selected = all ]] && table=available


Messages sorted by: Reverse Date, Date, Thread, Author