Bug 1815895 - dnf autocomplete too slow
Summary: dnf autocomplete too slow
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 35
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: amatej
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2128210
TreeView+ depends on / blocked
 
Reported: 2020-03-22 14:25 UTC by Blau Araujo
Modified: 2023-08-29 20:58 UTC (History)
22 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2128210 (view as bug list)
Environment:
Last Closed: 2022-09-27 06:14:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
autocompleting (622.54 KB, video/webm)
2021-05-12 02:01 UTC, christianbueno
no flags Details
listing podman package (225.71 KB, video/webm)
2021-05-12 02:12 UTC, christianbueno
no flags Details
fix dnf localinstall autocomplete (1.11 KB, patch)
2022-03-03 13:35 UTC, Kwan Lowe
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Github rpm-software-management dnf pull 1817 0 None Merged bash-completion: use sqlite cache when available (BZ: 1815895) 2022-09-20 08:36:37 UTC

Description Blau Araujo 2020-03-22 14:25:58 UTC
Description of problem:

dnf is taking too much time (many seconds) to autocomplete packages names with <tab>.


Version: 4.2.19


Steps to Reproduce:

Type: sudo dnf install <any letter> them <tab> or <tab><tab>

Actual results:

Taking many seconds to show completion options.

Expected results:

Display options almost instantly.

Additional info:

none

Comment 1 Ben Cotton 2020-11-03 17:08:55 UTC
This message is a reminder that Fedora 31 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-24.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '31'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 31 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 2 Kwan Lowe 2021-01-20 04:08:12 UTC
Just wanted to add that this still exists in Fedora 33. The autocomplete from the command line still takes a long time (10s or more) if any package lists are required (install, localinstall, remove, grouplist, etc.).   Even localinstall which should just check the local path seems to try to parse the 80K packages available in my default set of repos.

Currently I'm just moving/deleting /usr/share/bash-completions/completions/dnf to disable the autocomplete entirely, but would be a useful feature if it weren't for the annoying pause. This disablement lasts until the next time dnf is updated.

From what I can see, the _dnf_show_packages func is called for install, localinstall, remove, reinstall, etc.. At the least, the localinstall should just check the current directory or whatever path is already prepended. I.e., separate the localinstall completion to use something like:
  complete -f -o plusdirs -X '!*.@(rpm)' dnf

Comment 3 Ben Cotton 2021-02-09 16:15:54 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 4 christianbueno 2021-05-12 02:01:21 UTC
Created attachment 1782207 [details]
autocompleting

Here an example trying to install pipewire.
DNF take long time to autocomplete, as a user of fedora it is not a new thing about DNF.
I like DNF and how the information is structured and the order as is presented the result.

Comment 5 christianbueno 2021-05-12 02:12:04 UTC
Created attachment 1782211 [details]
listing podman package

Comment 6 Jiří Vyskočil 2021-07-23 10:47:53 UTC
Autocompletion for dnf is still slow in bash, as mentioned in the previous (now automatically closed) bug 1227979. It's a bash-specific problem, i.e. in zsh, tab completion for dnf is almost instant.

Comment 7 nicholas 2021-12-23 10:14:15 UTC
Just adding that I noticed this this on Fedora 35.

Comment 8 Kwan Lowe 2022-03-03 13:35:02 UTC
Created attachment 1863994 [details]
fix dnf localinstall autocomplete

Comment 9 Kwan Lowe 2022-03-03 13:39:12 UTC
I put in a hack to skip the full package list check when doing "localinstall" which is where most of the frustration lies for me. I don't know if much can be done about packages that need to pull form external repos. This was mainly tested on RHEL8 but seems to work on Fedora.

Comment 10 Robin Jarry 2022-03-08 21:08:32 UTC
I have submitted a fix https://github.com/rpm-software-management/dnf/pull/1817 which is waiting for review.

Comment 11 Robin Jarry 2022-04-27 14:04:48 UTC
The fix was applied upstream. It should be available in the next release of dnf.

Comment 12 Jiří Vyskočil 2022-04-28 05:58:13 UTC
Thank you, Robin! This has been bugging me for such a long time (it's been there for years - mentioned in various other bug reports). It's absolutely awesome to hear that it's been finally fixed. Can't wait until the next dnf release gets on my machine :-)

Comment 13 amatej 2022-09-27 06:14:18 UTC
Oh, we must have missed this bz during releasing but it is already in both fedoras 35 and 36.

Comment 14 Leandro Ramos 2023-08-29 20:58:50 UTC
Just adding that I noticed this this on Fedora 38.


Note You need to log in before you can comment on or make changes to this bug.