Subject: bug#76950: tramp caches non-existing podman containers

From: Konstantin Kharlamov <[email-masked]>
Date: Wed, 12 Mar 2025 17:07:50 +0300

On Wed, 2025-03-12 at 13:42 +0100, Michael Albinus wrote:
> Konstantin Kharlamov <[email-masked]> writes:
> 
> Hi Konstantin,
> 
> > Figured, I'd clarify for people who don't work with
> > containerization:
> > the docker and podman completion is about auto-generated names like
> > vibrant_hopper, frosty_northcutt, etc. Caching them has no use
> > whatsoever, because:
> 
> That's not always the case. You can run a container with the
> '--name="NAME"' argument.
> 
> > 1. The command that receives possible completions always fetches
> > the
> > current list, so even if cached containers still exist, the cache
> > only
> > wastes space.
> 
> Right. It doesn't make sense to offer container names which do not
> run,
> but are cached.
> 
> > 2. When containers quit, the names become useless (the bug).
> 
> Not always (see above).
> 
> > So cache should not be working at all for both Podman and Docker.
> 
> Well, I've assembled a patch with disables completion of cached
> container
> names for the docker, dockercp, podman and podmancp methods. See
> appended. Could you, pls test?
> 
> It can be extended for other methods easily, which are offered by
> tramp-container.el.

Thank you! The patch seems to work, but it behaves a bit oddly. If I go
over steps-to-reproduce, I quit container, do C-x C-f and check
containers name not there anymore… I still see it cached! However, if I
do that again in a few seconds, the container disappears.

It's as if cache still there, but it gets removed after a delay.

Other than that, the patch is definitely an improvement, so if it's not
clear why this "cache removal with delay" happens, I think patch still
may be worth installing.