Subject: bug#79280: closed (Re: bug#79280: package installation leaks tar-mode data buffers)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 22 Aug 2025 15:30:02 +0000

Your bug report

#79280: package installation leaks tar-mode data buffers

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
79280: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79280
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#79280: package installation leaks tar-mode data buffers
From: Mattias Engdegård <[email-masked]>
To: Stefan Monnier <[email-masked]>
Cc: Eli Zaretskii <[email-masked]>, [email-masked]
Date: Fri, 22 Aug 2025 17:29:47 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

21 aug. 2025 kl. 21.15 skrev Stefan Monnier <[email-masked]>:

> It's been suggested/mentioned several times in the past, but it's not
> clear how that would work.  Maybe we could allow `buffer-name` to be `t`
> for buffers which have no name yet are still live, and then collect (and
> find solutions for) all the problems this introduces.

Right. The idea would be to have unlisted buffers, which may or may not have a name but wouldn't be in Vbuffer_alist. We may need to impose other restrictions such as not being used in a window, to reduce the number of things that can go wrong. But the GC proving an absence of references to a buffer is a pretty solid ground for removal.

This should be completely feasible but is not very high up on my list of things to do. Meanwhile, hacks like the one made for package.el will have to do.

Anyway, no reason for this bug to dwell any longer at the platform. Closing!

Subject: package installation leaks tar-mode data buffers
From: Mattias Engdegård <[email-masked]>
To: Emacs Bug Report <[email-masked]>
Cc: Stefan Monnier <[email-masked]>
Date: Wed, 20 Aug 2025 19:50:14 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Apparently, package.el generates at least one leaked buffer for each package installed. From what I can tell, it's the use of tar-mode in temporary buffers, as in

  (with-temp-buffer
    (tar-mode)
    ...)

that is the problem: tar-mode will generate a helper buffer which is normally removed when the tar-mode buffer is killed, but temporary buffers inhibit the kill-buffer-hook so that never happens.

Here is a straightforward patch: explicitly return to fundamental-mode before the temporary buffer is destroyed.

An alternative would be to change tar-mode so that it doesn't rely on kill-buffer-hook to release its helper buffer. A finaliser would do, but those see so little use that it makes me a bit uneasy.

Are there other modes that may have similar problems?