Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apt-get not completing package names on Ubuntu 22.04 #807

Open
2 tasks
leoarnold opened this issue Sep 9, 2022 · 1 comment
Open
2 tasks

apt-get not completing package names on Ubuntu 22.04 #807

leoarnold opened this issue Sep 9, 2022 · 1 comment

Comments

@leoarnold
Copy link

Hi there,

just installed Kubuntu 22.04.1 Desktop and noticed that

$ sudo apt-get insta<TAB>

would autocomplete, but

$ sudo apt-get install thunderb<TAB>

would not.

Reporting it here as a reference. May already be fixed in current development state.

Describe the feature/solution

I looked into the code of the version packaged with Ubuntu 18.04 and found the line

COMPREPLY=( $( apt-cache --no-generate pkgnames "$cur" \

So I ran

$ apt-cache --no-generate pkgnames thunderb
E: The package cache file is corrupted, it has the wrong hash

which was weird because sudo apt-get update passed without error.

The solution was to purge the cache and refresh:

$ sudo rm -rf /var/lib/apt/lists/*
$ sudo apt-get update

and tab completion worked again.

Would be nice if that error message was not silently swallowed by the completion though.

Maintenance (please complete the following information)

  • This is a request for new completion
  • Link to upstream project query about shipping the completion:
@scop
Copy link
Owner

scop commented Sep 10, 2022

Suppressing error output from underlying invoked commands is a "cheap" general practice we tend to follow, because letting it through may cause an interleaved error/completion mess, the errors may make no sense to users, and/or presence of various commands or support for args we invoke them with might not be essential for the completion to work (graceful degradation).

I'm not against improving on this practice, but we should establish a way to do it so it's clear what and where is suppressed intentionally, and what's just an oversight. Maybe this means just some documentation and comments on the matter. Maybe it would be useful to make suppression optional, e.g. skip it in a "debug mode". Anyway it will require careful examination of each case separately.

For example, related to this particular case: for better or for worse, we still support the version of apt-cache that is present on Ubuntu 14.04. It doesn't understand the --no-generate option, so if we just let the error output through, it'll be mostly just an annoyance to users. Such a version of apt-cache isn't probably that relevant these days as far as new releases of bash-completion go, and our support for it is mostly a side effect of us running tests on Ubuntu 14.04 to cover oldish bash versions, but to illustrate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants