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

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



> 2023/07/11 17:12、Mirko Matošin <mirko.matosin@xxxxxxxxxxxxxxxx>のメール:
> 
> As soon as i hit tab after autoremove it wants to install sqlite

In my case I get:

Install package 'sqlite' to provide command 'sqlite3'? [N/y]

and just hitting RETURN does not install sqlite
(although the screen is rather cluttered).

> 2023/07/11 17:46、Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>のメール:
> 
> I see that Completion/Redhat/Command/_dnf invokes sqlite3
> conditionally if /var/cache/dnf/packages.db exists.

So we can avoid calling sqlite3 if the command is not available,
as in the patch below.

But the completion is somewhat faster if you have sqlite3 command
(one or two seconds vs. almost instant?).

What is the best way to inform users that installing sqlite package
will make the completion (somewhat) faster?

Or is the completion reasonably fast even without sqlite3?

# If I remember correctly, a few or several years ago, completing
# package names without sqlite3 was much slower (this may be just my
# wrong memory). But anyway it is still slower 


diff --git a/Completion/Redhat/Command/_dnf b/Completion/Redhat/Command/_dnf
index ce111f38f..3fbd73352 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 [[ -r $cache_file && -n $commands[sqlite3] ]]; then
     local table=$selected
     # 'available' table contains both 'available' and 'installed' packages
     [[ $selected = all ]] && table=available





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