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: Sat, 13 May 2023 17:18:35 +0000 Message-ID: <87mt28880k.fsf@posteo.net> References: <873547jeig.fsf@posteo.net> <83h6snc9ms.fsf@gnu.org> <5727a6ad-b2c6-4c8f-ac85-b6478c57a749@Spark> <87h6skfzeg.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7870"; 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 Sat May 13 19:19:32 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 1pxsu3-0001qg-Tm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 May 2023 19:19:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxstb-0001ES-Pp; Sat, 13 May 2023 13:19:03 -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 1pxsta-0001E2-Lk for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 13:19: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 1pxsta-0001kb-DF for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 13:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pxsta-0002dv-9V for bug-gnu-emacs@gnu.org; Sat, 13 May 2023 13:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 May 2023 17:19:02 +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.168399832410127 (code B ref 63338); Sat, 13 May 2023 17:19:02 +0000 Original-Received: (at 63338) by debbugs.gnu.org; 13 May 2023 17:18:44 +0000 Original-Received: from localhost ([127.0.0.1]:39495 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxstH-0002dG-HW for submit@debbugs.gnu.org; Sat, 13 May 2023 13:18:43 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:36157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pxstG-0002d4-7Z for 63338@debbugs.gnu.org; Sat, 13 May 2023 13:18:42 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id B3A31240105 for <63338@debbugs.gnu.org>; Sat, 13 May 2023 19:18:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1683998316; bh=ejtRnX/Vc0owsHfBttITD46z3TlRgkDcIaD499NpI0U=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=gH21ridTzZq0uFtmUjMP8mYPtifMmYKrZMSD2p3Giz62/makl6tAMFeAPYghCTtLG TnvMhahmlW0bVdSmuxsbQMscO8Fk/VUN6zK8hA6U9AGDjimVq7NmIvfDHSxDC9DG2Q Ew9+hMMHOeCvPweBQbLZQOB/KLiOL4gx5uOcOKsZgKDt33ierNYiULifgCb3cdpS6J e5f5mktHN5EOnQwfHvUQv97wYe/8GQUIaCxVf41iKUAUgGb0/6RFXhXzjP1Py1NWbD ZrrVGuzpoHdDM5k5osQQdlRB7kkQcbl7JmbFfdv+MmFrAX/UgNYTmlgDHvGn4oNJHp M8fqZYu9G2/iQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QJXR02Qnpz6txR; Sat, 13 May 2023 19:18:36 +0200 (CEST) In-Reply-To: <87h6skfzeg.fsf@posteo.net> (Philip Kaludercic's message of "Wed, 10 May 2023 06:56:07 +0000") 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:261693 Archived-At: ping? Philip Kaludercic writes: > 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: > > 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))) >=20=20 > ;; 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) >=20=20 > ;; Confirm that the installation was successful > > > >> 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 duplicat= ion >>> > > 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.