GNU bug report logs - #76568
'package-install' should not install duplicate packages

Previous Next

Package: emacs;

Reported by: Ship Mints <shipmints <at> gmail.com>

Date: Tue, 25 Feb 2025 20:53:01 UTC

Severity: normal

Tags: patch

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 'package-install' should not install duplicate packages
Date: Tue, 25 Feb 2025 15:52:02 -0500
[Message part 1 (text/plain, inline)]
As part of my production upgrade to 30.1, and before I wrote a program to
install my local ELPA tree from scratch, I tried to first curate my
packages and change from MELPA to generally equivalent GNU ELPA or non-GNU
ELPA archives.  The result was that I had two of each package installed.

I think there's a bug in 'package-install' which, when invoked from
'package-install-button-action', processes the new package spec, and
incorrectly checks to see if the package is already installed.  Interactive
invocation of 'package-install' yields the package name from the prompt,
not its archive description.

If the below is correct, I can submit a patch to make 'package-install'
behave like 'package-reinstall' for the non-interactive case.

(defun package-install (pkg &optional dont-select)
...
    (if-let* ((transaction
               (if (package-desc-p pkg)
;; Problem seems to be here.  If the new pkg desc is for a
;; different archive directory name style, package-installed-p
;; fails as it checks to see if the new directory exists (which
;; does not), ignoring the old archive directory.
                   (unless (package-installed-p pkg)
                     (package-compute-transaction (list pkg)
                                                  (package-desc-reqs pkg)))

In contrast, 'package-reinstall' does the right thing by first deleting the
existing package before installing the new one.

(defun package-reinstall (pkg)
...
  (package-delete
   (if (package-desc-p pkg) pkg (cadr (assq pkg package-alist)))
   'force 'nosave)
  (package-install pkg 'dont-select))

-Stephane
[Message part 2 (text/html, inline)]

This bug report was last modified 3 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.