GNU bug report logs - #63338
29.0.90; package-vc-install'ing the same package multiple times results in duplication in package-selected-packages

Previous Next

Package: emacs;

Reported by: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>

Date: Sat, 6 May 2023 23:28:01 UTC

Severity: normal

Found in version 29.0.90

Done: Philip Kaludercic <philipk <at> posteo.net>

Bug is archived. No further changes may be made.

Full log


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

From: Philip Kaludercic <philipk <at> posteo.net>
To: Jimmy Yuen Ho Wong <wyuenho <at> gmail.com>
Cc: 63338 <at> debbugs.gnu.org
Subject: Re: bug#63338: 29.0.90; package-vc-install'ing the same package
 multiple times results in duplication in package-selected-packages
Date: Mon, 08 May 2023 10:36:55 +0000
[Message part 1 (text/plain, inline)]
Jimmy Yuen Ho Wong <wyuenho <at> gmail.com> writes:

> Reproduction:
>
> 0. (setq custom-file (const user-emacs-directory "custom.el"))
> 1. M-x package-vc-install company
> 2. M-x package-vc-install company RET y
> 3. C-x C-f ~/.emacs/custom.el
> 4. Observe that `company` has been listed twice under
> `package-selected-packages`.
>
> Expectation:
>
> Installing the same package twice should not result in its duplication
> in `package-selected-packages`.

An easy fix would be just to ensure that package-selected-packages is
always deduplicated before assigning the value:

[Message part 2 (text/plain, inline)]
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index bbe2b8bb4af..988b92da75b 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1992,7 +1992,7 @@ package--find-non-dependencies
 (defun package--save-selected-packages (&optional value)
   "Set and save `package-selected-packages' to VALUE."
   (when value
-    (setq package-selected-packages value))
+    (setq package-selected-packages (delete-dups value)))
   (if after-init-time
       (customize-save-variable 'package-selected-packages package-selected-packages)
     (add-hook 'after-init-hook #'package--save-selected-packages)))

This bug report was last modified 2 years and 64 days ago.

Previous Next


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