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

Don't remove /var/cache/apt/*.bin in /etc/apt/apt.conf.d/docker-clean (this breaks bash-completion) #153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

safinaskar
Copy link

Now we don't remove /var/cache/apt/*.bin here, because this breaks bash-completion for apt (apt-get install ap<Tab>)

How to test this? Well, first spawn docker container without this patch applied (i. e. docker run -it --rm debian:sid). Install package bash-completion. You will see that bash-completion for apt (i. e. apt-get install ap<Tab>) doesn't work.

Now create docker container with this patch. Spawn the container, install bash-completion, then run login shell via bash -l (you need to do this because of orthogonal bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1034567 ). You will see that apt-get install a<Tab> now works.

Also, please, note that apt-get ins<Tab> and apt-get install a<Tab> are two different things. This patch solves second thing

… (this breaks bash-completion)

Now we don't remove `/var/cache/apt/*.bin` here, because this breaks bash-completion for apt (`apt-get install ap<Tab>`)

How to test this? Well, first spawn docker container without this patch applied (i. e. `docker run -it --rm debian:sid`). Install package `bash-completion`. You will see that bash-completion for apt (i. e. `apt-get install ap<Tab>`) doesn't work.

Now create docker container with this patch. Spawn the container, install `bash-completion`, then run login shell via `bash -l` (you need to do this because of orthogonal bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1034567 ). You will see that `apt-get install a<Tab>` now works.

Also, please, note that `apt-get ins<Tab>` and `apt-get install a<Tab>` are two different things. This patch solves second thing
@tianon
Copy link
Collaborator

tianon commented May 2, 2023

I definitely feel there's some synergy here with Cyril's thoughts in https://bugs.debian.org/1034650#10 -- these files are fairly large, and are not necessary for APT to function correctly (as noted by apt-get clean itself removing them), and in theory shouldn't be necessary for bash-completion to work properly (even if having them might result in a potentially dramatic speedup). 😅

The added detail here is that using Docker interactively with bash-completion installed is also an uncommon workflow (I'd rather not reduce how well the 99% case is optimized for the sake of the 1%), and the simplest workaround for users who need this is to remove (or do a minor targeted modification to) the docker-clean configuration file.

@safinaskar
Copy link
Author

The added detail here is that using Docker interactively with bash-completion installed is also an uncommon workflow

This is very common workflow for me and for my friend. When I need to quickly test something, I often run sudo docker run -it --rm -v /tmp:/tmp debian:sid, and then (in container) apt-get update && apt-get install apt-utils whiptail bash-completion mc nano less man-db. I don't like that I need additional step rm /etc/apt/apt.conf.d/docker-clean.

Said that, I noticed apt devs in https://bugs.debian.org/1034650

@julian-klode
Copy link

This should not be done. Removing the cache is the right thing, the lists are deleted anyway, so the cache is invalid either way and the completion is wrong/woefully incomplete. Doubling or so the image size for wrong bash completion makes no sense.

The cache will be repopulated by apt update. You can't have your cake and eat it too, run your apt update in one line and the install stuff in the next line if you want it to tab complete.

@julian-klode
Copy link

To be honest if the bash completion works at all with the leftover cache file after removing the lists files, that is a bug. Since we are not generating caches and the caches that we have is invalid because they contain additional sources, apt should be failing either way.

@safinaskar
Copy link
Author

the lists are deleted anyway

So what? We should be pragmatics. Lack of bash-completion is very annoying. If availability of *.bin files without lists makes bash-completion working, then let's keep *.bin files without lists, even if this is theoretically incorrect. I can tell you lots lots of theoretical bugs in UNIX in general.

Doubling or so the image size for wrong bash completion makes no sense

I'm talking about *.bin files only. Size of *.bin files is 3.3M in sid docker image (assuming I disabled their removing by deleting docker-clean). Size of /usr is 120M

The cache will be repopulated by apt update

I just checked. It is not repopulated in official Debian images for Docker. It seems docker-clean removes cache right after apt update

run your apt update in one line and the install stuff in the next line if you want it to tab complete

Again: this doesn't work

@safinaskar
Copy link
Author

But again: I don't say that this is necessary bug in docker images, it may be apt bug

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

Successfully merging this pull request may close these issues.

3 participants