From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#63338: 29.0.90; package-vc-install'ing the same package multiple times results in duplication in package-selected-packages Date: Wed, 10 May 2023 06:56:07 +0000 Message-ID: <87h6skfzeg.fsf@posteo.net> References: <873547jeig.fsf@posteo.net> <83h6snc9ms.fsf@gnu.org> <5727a6ad-b2c6-4c8f-ac85-b6478c57a749@Spark> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40574"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 63338@debbugs.gnu.org To: Jimmy Wong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 10 08:57:15 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pwdlB-000AJ5-O1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 May 2023 08:57:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwdl2-0007MU-6o; Wed, 10 May 2023 02:57:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwdl0-0007M8-L3 for bug-gnu-emacs@gnu.org; Wed, 10 May 2023 02:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pwdl0-00079g-03 for bug-gnu-emacs@gnu.org; Wed, 10 May 2023 02:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pwdkz-0002ta-Rs for bug-gnu-emacs@gnu.org; Wed, 10 May 2023 02:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 May 2023 06:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63338 X-GNU-PR-Package: emacs Original-Received: via spool by 63338-submit@debbugs.gnu.org id=B63338.168370177711065 (code B ref 63338); Wed, 10 May 2023 06:57:01 +0000 Original-Received: (at 63338) by debbugs.gnu.org; 10 May 2023 06:56:17 +0000 Original-Received: from localhost ([127.0.0.1]:45062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwdkH-0002sP-4m for submit@debbugs.gnu.org; Wed, 10 May 2023 02:56:17 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:37795) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwdkE-0002sB-MI for 63338@debbugs.gnu.org; Wed, 10 May 2023 02:56:15 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id C03152404D1 for <63338@debbugs.gnu.org>; Wed, 10 May 2023 08:56:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1683701768; bh=1g2Q8aROlmJsraS5itNJiSKbEmatm7+5M1amYdDNrOc=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=CXTPXdCC4lw6j7p696Jlss1Et3tYaMPUIKDLDeoAL1lG5ajMlMJFgGG9KLTzKcAkb 2WBqtOsoJzRrZpY2HSizFCgjtH8Ne+0zh+8NPQVuCOGm/9OvKEVZ9lT4h/9W3T6xOv d8FZwisMN2GGJCrLNnULv29buJNq3Jh75q52LAT+Fo50WUAKnYiFGQBg/WnFpGmPBc PbIiRkJLL3idi0CF3ABm2H64qFq03jM5xP0UOT4E5FsVcVd/Oe49bYQEnN77KIRI9b JeuJTI8x0tKEEvCAQCwhfYYNhepEUhnxnPuRJy0zrdMVHIzCWCeEer4cGdBCcrhB5Z poUGg5XGFxc5g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QGQm80lcwz9rxN; Wed, 10 May 2023 08:56:08 +0200 (CEST) In-Reply-To: <5727a6ad-b2c6-4c8f-ac85-b6478c57a749@Spark> (Jimmy Wong's message of "Tue, 9 May 2023 03:56:46 +0100") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261471 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Jimmy Wong writes: > I don=E2=80=99t think you should dedup the variable that could have been > modified by something else such as package-install. This may make > debugging harder should package.el itself introduce a bug that > duplicates pacakages in the variable. How about just using good old > add-to-list? The issue is that we want to go through package--save-selected-packages, that is given a new value to assign to `package-selected-packages'. An otherwise, I my understanding is that add-to-list is not conventional in executed code. The alternative is to check for duplicates before invoking the function: --=-=-= Content-Type: text/plain Content-Disposition: inline diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index e9794eac783..b967aaa3d4d 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -507,9 +507,10 @@ package-vc--unpack-1 (package--reload-previously-loaded new-desc))) ;; Mark package as selected - (package--save-selected-packages - (cons (package-desc-name pkg-desc) - package-selected-packages)) + (let ((name (package-desc-name pkg-desc))) + (unless (memq name package-selected-packages) + (package--save-selected-packages + (cons name package-selected-packages)))) (package--quickstart-maybe-refresh) ;; Confirm that the installation was successful --=-=-= Content-Type: text/plain > On 8 May 2023 at 1:03 PM +0100, Eli Zaretskii , wrote: >> > Cc: 63338@debbugs.gnu.org >> > From: Philip Kaludercic >> > Date: Mon, 08 May 2023 10:36:55 +0000 >> > >> > Jimmy Yuen Ho Wong 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: >> >> This is OK for the emacs-29 branch, thanks. --=-=-=--