zsh-workers
 help / color / mirror / code / Atom feed
* Unexpected installation of SQLite during "sudo dnf autoremove" command
       [not found] ` <66435637-82c1-464e-85fb-bd3cd485052e.95e17f34-409d-4b8c-b99b-e6635451f7ff.245922ee-0718-4a4c-94a2-58ad892ba0fd@emailsignatures365.codetwo.com>
@ 2023-07-11  8:02   ` Mirko Matošin
  2023-07-11  8:08     ` Roman Perepelitsa
  0 siblings, 1 reply; 9+ messages in thread
From: Mirko Matošin @ 2023-07-11  8:02 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/html, Size: 3861 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Unexpected installation of SQLite during "sudo dnf autoremove" command
  2023-07-11  8:02   ` Unexpected installation of SQLite during "sudo dnf autoremove" command Mirko Matošin
@ 2023-07-11  8:08     ` Roman Perepelitsa
  2023-07-11  8:09       ` AW: [EXTERNAL] " Mirko Matošin
  2023-07-11  8:12       ` Mirko Matošin
  0 siblings, 2 replies; 9+ messages in thread
From: Roman Perepelitsa @ 2023-07-11  8:08 UTC (permalink / raw)
  To: Mirko Matošin; +Cc: zsh-workers

On Tue, Jul 11, 2023 at 10:03 AM Mirko Matošin
<mirko.matosin@zimmer-group.com> wrote:
>
> -     The unexpected installation of SQLite during "sudo dnf autoremove" does not occur without the zsh-autocomplete plugin installed.

FIle an issue against
https://github.com/marlonrichert/zsh-autocomplete. If Marlon
identifies a bug in zsh as the culprit, he'll report it here.

Roman.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* AW: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command
  2023-07-11  8:08     ` Roman Perepelitsa
@ 2023-07-11  8:09       ` Mirko Matošin
  2023-07-11  8:12       ` Mirko Matošin
  1 sibling, 0 replies; 9+ messages in thread
From: Mirko Matošin @ 2023-07-11  8:09 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1226 bytes --]

Hello Roman,

sorry, i tested it without zsh-autocomplete and the error persists.

Mit freundlichen Grüßen | Kind regards

Mirko Matošin

Praktikant | Trainee

T: +49 7844 9138-5878
F: +49 7844 9139-1199

Zimmer GmbH
Im Salmenkopf 5
D-77866 Rheinau

mirko.matosin@zimmer-group.com
<http://www.zimmer-group.de>www.zimmer-group.com<https://www.zimmer-group.com>

Member of Zimmer Group
Die gesetzlichen Pflichtangaben finden Sie unter: www.zimmer-group.com/de/bottommenu/impressum

________________________________
Von: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Gesendet: Dienstag, 11. Juli 2023 10:08
An: Mirko Matošin <mirko.matosin@zimmer-group.com>
Cc: zsh-workers@zsh.org <zsh-workers@zsh.org>
Betreff: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command

On Tue, Jul 11, 2023 at 10:03 AM Mirko Matošin
<mirko.matosin@zimmer-group.com> wrote:
>
> -     The unexpected installation of SQLite during "sudo dnf autoremove" does not occur without the zsh-autocomplete plugin installed.

FIle an issue against
https://github.com/marlonrichert/zsh-autocomplete. If Marlon
identifies a bug in zsh as the culprit, he'll report it here.

Roman.

[-- Attachment #2: Type: text/html, Size: 3629 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* AW: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command
  2023-07-11  8:08     ` Roman Perepelitsa
  2023-07-11  8:09       ` AW: [EXTERNAL] " Mirko Matošin
@ 2023-07-11  8:12       ` Mirko Matošin
  2023-07-11  8:46         ` Roman Perepelitsa
                           ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Mirko Matošin @ 2023-07-11  8:12 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]

As soon as i hit tab after autoremove it wants to install sqlite


Tested with vscode 1.7.9 bash and zsh terminal and mobaxterm ssh terminal

```
mirko@fedora ~$ sudo dnf autoremove zsh: sqlite3: Befehl nicht gefunden...
Soll das Paket »sqlite« installiert werden, welches den Befehl »sqlite3« bereitstellt? [N/y]
```


Mit freundlichen Grüßen | Kind regards

Mirko Matošin

Praktikant | Trainee

T: +49 7844 9138-5878
F: +49 7844 9139-1199

Zimmer GmbH
Im Salmenkopf 5
D-77866 Rheinau

mirko.matosin@zimmer-group.com
<http://www.zimmer-group.de>www.zimmer-group.com<https://www.zimmer-group.com>

Member of Zimmer Group
Die gesetzlichen Pflichtangaben finden Sie unter: www.zimmer-group.com/de/bottommenu/impressum

________________________________
Von: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Gesendet: Dienstag, 11. Juli 2023 10:08
An: Mirko Matošin <mirko.matosin@zimmer-group.com>
Cc: zsh-workers@zsh.org <zsh-workers@zsh.org>
Betreff: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command

On Tue, Jul 11, 2023 at 10:03 AM Mirko Matošin
<mirko.matosin@zimmer-group.com> wrote:
>
> -     The unexpected installation of SQLite during "sudo dnf autoremove" does not occur without the zsh-autocomplete plugin installed.

FIle an issue against
https://github.com/marlonrichert/zsh-autocomplete. If Marlon
identifies a bug in zsh as the culprit, he'll report it here.

Roman.

[-- Attachment #2: Type: text/html, Size: 4261 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command
  2023-07-11  8:12       ` Mirko Matošin
@ 2023-07-11  8:46         ` Roman Perepelitsa
  2023-07-11 10:17         ` Jun T
  2023-07-11 16:25         ` Bart Schaefer
  2 siblings, 0 replies; 9+ messages in thread
From: Roman Perepelitsa @ 2023-07-11  8:46 UTC (permalink / raw)
  To: Mirko Matošin; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1026 bytes --]

On Tue, Jul 11, 2023 at 10:12 AM Mirko Matošin
<mirko.matosin@zimmer-group.com> 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.

[-- Attachment #2: dnf-sqlite3.patch.txt --]
[-- Type: text/plain, Size: 567 bytes --]

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command
  2023-07-11  8:12       ` Mirko Matošin
  2023-07-11  8:46         ` Roman Perepelitsa
@ 2023-07-11 10:17         ` Jun T
  2023-07-11 10:23           ` Jun T
  2023-07-11 16:25         ` Bart Schaefer
  2 siblings, 1 reply; 9+ messages in thread
From: Jun T @ 2023-07-11 10:17 UTC (permalink / raw)
  To: zsh-workers


> 2023/07/11 17:12、Mirko Matošin <mirko.matosin@zimmer-group.com>のメール:
> 
> 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@gmail.com>のメール:
> 
> 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



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command
  2023-07-11 10:17         ` Jun T
@ 2023-07-11 10:23           ` Jun T
  0 siblings, 0 replies; 9+ messages in thread
From: Jun T @ 2023-07-11 10:23 UTC (permalink / raw)
  To: zsh-workers


> 2023/07/11 19:17、Jun T <takimoto-j@kba.biglobe.ne.jp>のメール:
> 
> So we can avoid calling sqlite3 if the command is not available,
> as in the patch below.

Sorry, I didn't noticed the attachment file in Roman's post.
The patch is the same as his attachment.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command
  2023-07-11  8:12       ` Mirko Matošin
  2023-07-11  8:46         ` Roman Perepelitsa
  2023-07-11 10:17         ` Jun T
@ 2023-07-11 16:25         ` Bart Schaefer
  2023-07-11 20:53           ` Roman Perepelitsa
  2 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2023-07-11 16:25 UTC (permalink / raw)
  To: Mirko Matošin; +Cc: zsh-workers

On Tue, Jul 11, 2023 at 1:12 AM Mirko Matošin
<mirko.matosin@zimmer-group.com> wrote:
>
> As soon as i hit tab after autoremove it wants to install sqlite

I'm reasonably sure this is not a problem with zsh or completion per
se, but rather that the packaged OS vendor installation includes a
command-not-found handler that invokes the package manager.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [EXTERNAL] Re: Unexpected installation of SQLite during "sudo dnf autoremove" command
  2023-07-11 16:25         ` Bart Schaefer
@ 2023-07-11 20:53           ` Roman Perepelitsa
  0 siblings, 0 replies; 9+ messages in thread
From: Roman Perepelitsa @ 2023-07-11 20:53 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Mirko Matošin, zsh-workers

On Tue, Jul 11, 2023 at 6:26 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Tue, Jul 11, 2023 at 1:12 AM Mirko Matošin
> <mirko.matosin@zimmer-group.com> wrote:
> >
> > As soon as i hit tab after autoremove it wants to install sqlite
>
> I'm reasonably sure this is not a problem with zsh or completion per
> se, but rather that the packaged OS vendor installation includes a
> command-not-found handler that invokes the package manager.

_dnf invokes sqlite3 as an optimization. There is a fallback branch
that does not require this command. However, the optimization branch
may be taken even when sqlite3 is missing. This is a bug in _dnf.
Either of the two patches posted here will fix it.

Roman.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-11 20:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <66435637-82c1-464e-85fb-bd3cd485052e.f0af137d-67f0-47ab-b7f8-5e0e70df6b34.3dfd4d24-34e4-4553-a1f5-ce63b21694b3@emailsignatures365.codetwo.com>
     [not found] ` <66435637-82c1-464e-85fb-bd3cd485052e.95e17f34-409d-4b8c-b99b-e6635451f7ff.245922ee-0718-4a4c-94a2-58ad892ba0fd@emailsignatures365.codetwo.com>
2023-07-11  8:02   ` Unexpected installation of SQLite during "sudo dnf autoremove" command Mirko Matošin
2023-07-11  8:08     ` Roman Perepelitsa
2023-07-11  8:09       ` AW: [EXTERNAL] " Mirko Matošin
2023-07-11  8:12       ` Mirko Matošin
2023-07-11  8:46         ` Roman Perepelitsa
2023-07-11 10:17         ` Jun T
2023-07-11 10:23           ` Jun T
2023-07-11 16:25         ` Bart Schaefer
2023-07-11 20:53           ` Roman Perepelitsa

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).