From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 25 15:52:26 2025 Received: (at submit) by debbugs.gnu.org; 25 Feb 2025 20:52:26 +0000 Received: from localhost ([127.0.0.1]:48691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tn1uj-0001L4-MO for submit@debbugs.gnu.org; Tue, 25 Feb 2025 15:52:26 -0500 Received: from lists.gnu.org ([2001:470:142::17]:42974) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tn1uh-0001Kq-Ux for submit@debbugs.gnu.org; Tue, 25 Feb 2025 15:52:24 -0500 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 1tn1ub-000850-Kk for bug-gnu-emacs@gnu.org; Tue, 25 Feb 2025 15:52:18 -0500 Received: from mail-ua1-x936.google.com ([2607:f8b0:4864:20::936]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tn1uZ-0003hb-Sp for bug-gnu-emacs@gnu.org; Tue, 25 Feb 2025 15:52:17 -0500 Received: by mail-ua1-x936.google.com with SMTP id a1e0cc1a2514c-86b2cc5b3c4so57131241.3 for ; Tue, 25 Feb 2025 12:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740516734; x=1741121534; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=3BagMnZ1SFrt3AsAJTDbwOJFTMuAgBX3WGlaZ1vPOB0=; b=WxWpkC3p9kR7xcwXbJFern+BJXFjfB+7L0oBlabJwUlUAz9c0J6PTOIZUXEvpMPZQU 4CM50C1REMY1Dignq98xQtur58Trp0khxNetVo3Mdi9/30hH08D2wGWopSFUrAmVFniE b9lV7L2ovj2oWe2EipR3OBLTKotumTobp5i2VHgSP67M4psWkkkU6802cFl0979wHRIZ D0jIQsGlp3Kij5KVjSNVl7xRa8T68jo6s6CWOVncY4ZjcVf9Z4aJe5zndFhQpfr/Hz8x qpFVD++AuW//0bkbuBuLpJRPUrM/LRMKi7T6/rFPf0aqFkJZapO7RU4dUc1b9lOOmUzS qNMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740516734; x=1741121534; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=3BagMnZ1SFrt3AsAJTDbwOJFTMuAgBX3WGlaZ1vPOB0=; b=lt4XAwA3utYS+2QwTUq87dxBSwyJ4sgHbF5dAh/oVcpP2LLHoFnRrtXduSgCIMcs0S bv8xbDSjZEtXDjkM/oV5aQIlVuGpum766jpQPpZjtJ6N96bXirjhXVp37yeyTNWsObCw BruRqrOjB7zV11kH1HU+yvW2nmrXYQBjC9CE0owBVmFb7MpXMp5b5M7/V81b/5TpZ8fc ruw778UY90YrEQUkfDv6hPMqHTCw7WsgOq43EyEnU/d6O++tt9CiScvF98kNuhGRBvHE /cZaR/EzcDy1AJ+pY2nug5hrHA7A00b3X9vzNrRm13HDrpk0VQNfvPQIqEyG2o1dwaNO e9kg== X-Gm-Message-State: AOJu0YyYAMTUM3P2ruw8r24C5g5S2uuFeUwV8bqFpMBFtkZG1+6KT7Rn l8RWrZojyty+QLXQfLEbjm1OqrfGpvmwr8vLstrVbGOOuQjw080xHj/JbJ6Rypa4c4fQn4M8526 9+2V4KCS63zag7wMB8Bhx3HWy024/YmFi X-Gm-Gg: ASbGncvjHgcOEyUPozxqQeg7Tc4+3Alqj4Yk/6qHfA1g4K4PWXOqVBR3ig5aC5OhruS IYuDb/Cd9fHim4gWXwlPjgBw4fZIA5iAR3BleocrsJwGxB44xsDIntl7/Z7Zs8KIXACzDTA9Q6i Jippg55pU= X-Google-Smtp-Source: AGHT+IHUgOPGrLrW1JdoGcJbOGAk6RsW273UUSA0LnUbWRJXy1Dt8sN0HYwOBlVQHt2nlJrQdSb3R9kTlNT4su9s7yQ= X-Received: by 2002:a05:6122:2528:b0:51b:b750:8303 with SMTP id 71dfb90a1353d-5223cd6e736mr2695019e0c.11.1740516734024; Tue, 25 Feb 2025 12:52:14 -0800 (PST) MIME-Version: 1.0 From: Ship Mints Date: Tue, 25 Feb 2025 15:52:02 -0500 X-Gm-Features: AQ5f1JofZwIYLTHUmqw66JMvLFm138cFBOIF_gVNMW-g8Q9QClEvXorfFkYARww Message-ID: Subject: 'package-install' should not install duplicate packages To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="000000000000a84331062efda169" Received-SPF: pass client-ip=2607:f8b0:4864:20::936; envelope-from=shipmints@gmail.com; helo=mail-ua1-x936.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --000000000000a84331062efda169 Content-Type: text/plain; charset="UTF-8" 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 --000000000000a84331062efda169 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
As part of my production upgrade to 30.1, and before I wrote a program t= o install my local ELPA tree from scratch, I tried to first curate my packa= ges and change from MELPA to generally equivalent GNU ELPA or non-GNU ELPA = archives.=C2=A0 The result was that I had two of each package installed.

<= div class=3D"gmail_default" style=3D"font-family:monospace">I think there&#= 39;s a bug in 'package-install' which, when invoked from 'packa= ge-install-button-action', processes the new package spec, and incorrec= tly checks to see if the package is already installed.=C2=A0 Interactive in= vocation=C2=A0of '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)
...
=C2=A0 =C2=A0 (i= f-let* ((transaction
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(if (package-desc-p pkg)
;;=C2=A0Problem seems to be here.=C2=A0 If the new pk= g desc is for a=C2=A0
;; different archive directory name style, package-installed-p=
;; fails= as it checks to see if the new directory exists (which
;; does not), ignoring the o= ld archive directory.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(unless (package-installed-p pkg)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(package-compute= -transaction (list pkg)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-desc-reqs pkg= )))
<= br>
In contrast, 'package-reinstall' does the right thing b= y first deleting the existing package befor= e installing the new one.

(defu= n package-reinstall (pkg)
...
=C2=A0 (package-delete
=C2=A0 =C2=A0(if= (package-desc-p pkg) pkg (cadr (assq pkg package-alist)))
=C2=A0 =C2=A0= 'force 'nosave)
=C2=A0 (package-install pkg 'dont-select= ))

-Stephane
--000000000000a84331062efda169-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 08:32:06 2025 Received: (at 76568) by debbugs.gnu.org; 26 Feb 2025 13:32:06 +0000 Received: from localhost ([127.0.0.1]:51524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tnHW9-0001GV-NL for submit@debbugs.gnu.org; Wed, 26 Feb 2025 08:32:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43712) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tnHW8-0001Fy-4q for 76568@debbugs.gnu.org; Wed, 26 Feb 2025 08:32:04 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnHVx-00028a-Ma; Wed, 26 Feb 2025 08:31:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=vn2jFeB6MbfwMCd9PblhgOR6SC/cBoQgnVRHFJbKJEY=; b=rZCTcNTlpB4E jkP9zUH/uagmM0VKqOQnFUtIE3L9lk/QL852m22LgqDnkigp+/X3IlvWybM2jSGMyOiDIzBnUjLYy yE1sWg6jiJkt6l9rId7Ku/xf0r9k7WYxG2GJJXY89N+Dlq0Uo4m6gfSybwt2Vxy6v4xjDPDsxpWzr oLNKMb+rI09Gdw6fTAhQRm8BuTzmD0cb2pnrZ26LiqdfiZj3E1MX8Ex1HwUHbCs17gXfqk2JFdTVV 0fjAFF/JtPVsrDrbSvwmzoqTSz5Lv+qXvqPH+COCka0y+9ldC6SEbLJGTff1Q0/J43++hqI1pIsAS 6EvTAXZJfRlcQiX6Yv7hHA==; Date: Wed, 26 Feb 2025 15:31:52 +0200 Message-Id: <861pvkx25z.fsf@gnu.org> From: Eli Zaretskii To: Ship Mints , Philip Kaludercic In-Reply-To: (message from Ship Mints on Tue, 25 Feb 2025 15:52:02 -0500) Subject: Re: bug#76568: 'package-install' should not install duplicate packages References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Ship Mints > Date: Tue, 25 Feb 2025 15:52:02 -0500 > > 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)) Philip, any comments or suggestions? From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 03 21:35:04 2025 Received: (at 76568) by debbugs.gnu.org; 4 Mar 2025 02:35:04 +0000 Received: from localhost ([127.0.0.1]:53646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tpI7b-0004zi-TP for submit@debbugs.gnu.org; Mon, 03 Mar 2025 21:35:04 -0500 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]:52544) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tpI7a-0004yT-6I for 76568@debbugs.gnu.org; Mon, 03 Mar 2025 21:35:02 -0500 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-aaedd529ba1so592931866b.1 for <76568@debbugs.gnu.org>; Mon, 03 Mar 2025 18:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741055696; x=1741660496; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=3d5B/EKbO22Gcx1tYdqrJasMPAqMpzLfFQku7P9Kaa0=; b=C5jl27zM4AorMMt4y7T5zE3xFgf9nCcMqytEbI+DJNlyEakxdcGfjMnusBdYYVNb0w x89UNwH9Hm2MzGhTZTlbJBVl+rFWJU8F0TkA4iylnZRWSaRyjFSenchsO/N0G4MmGYl5 I/b/4u4QOhR/c+g3k46ogpK3aI2Uwo1q4SbRfJc1B+UkOq/z49GOwHAfN9ghi7Rnj4Zn GQLa8b41kAdCqbp3yw2Qkyw5ZtXg+8P1X7oaxk5P29psWe5C5gSEcbm0EzGyOpKX8lhd WA0L3/9njFAOZIDOaLsZTXtEHBEbTKBNFoCTsE38x+FqDMuwPFT2mZtt7/SZ+7FkPQSF 3aCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741055696; x=1741660496; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3d5B/EKbO22Gcx1tYdqrJasMPAqMpzLfFQku7P9Kaa0=; b=RKwpx9eKKWolvyvn23O2sI9M7a5MAwG7eYSIGcT6/vtycYJ6OT/ZnMjhkYde6kJ/IC 9xDexUFu4sdHGfiSQMqMI04NHJFD/kbqSNIrSnCqvKEQsJRzIB/D73M1yg7IpMLvJ88h UvxUNLZgA68IpeQDA1OjvDHMBv/CEhhXeJRM164ptz8YqdT99YcG/qx/fJlKad+dRFjZ ZFCgFKs+nVlOIqc9wlcvYiqfrl81riTiREM60EwQ8QyMUvKVmY+UU16dtSHswQc1HaFT 7OGrDIuTMFdxnMl6WvBaJKVOH8RnRLjKmB1aAfYGTkLBt4nc8JNNecB4LSyoU1v76oHs UTsA== X-Gm-Message-State: AOJu0Ywlomn9fCE8MuSqySEF5AHe59F9X+WgmQSr3B+LlfQijPDsCtXh +LlvanZi1NqeedsLSCcSaAG3WhJpeg1OukatXf8HCBWa2mCKS3iePQlMmEb4jSXeoLEopq+umlN mQuYcRfuEOL6tDDzpQ0HKwah9GN4= X-Gm-Gg: ASbGncu6Xe3Wsytrr8SLJH8JIeNAfdhWcuqgJWXRA+0hEnLD2m6ogt/YCUMfOuVprh0 I4TXt4u9SMPutkWxet8qlxx2dqqxdASd+S00VV6JgQ0ZOtBvXSP4furAjcn7nSkAs7SqURKMt4N i8XsDD0fqkD3tCEI6v1/gbY1Q47GM= X-Google-Smtp-Source: AGHT+IG8tCPXtcm5hgb784rDRbQeEWec8nsgC58ZJElYI+Hx9S0pbKvSIv/A6LDKALSXfk17CusVG9GHf4g6GDC+jK4= X-Received: by 2002:a05:6402:34c6:b0:5de:4a8b:4c9c with SMTP id 4fb4d7f45d1cf-5e4d6b62f6emr40575969a12.32.1741055695701; Mon, 03 Mar 2025 18:34:55 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 4 Mar 2025 02:34:54 +0000 From: Stefan Kangas In-Reply-To: References: MIME-Version: 1.0 Date: Tue, 4 Mar 2025 02:34:54 +0000 X-Gm-Features: AQ5f1JqDYRVT6cgnaMkjr3l8s6LhJ-GDXNCguoQE-MMkHLqrmeoL3YHGoJkYAOA Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Ship Mints Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Ship Mints writes: > 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. Please submit a patch, but could we also have tests for this please? Thanks in advance. > > (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 From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 05 12:01:14 2025 Received: (at 76568) by debbugs.gnu.org; 5 Mar 2025 17:01:14 +0000 Received: from localhost ([127.0.0.1]:39380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tps7O-00029r-CS for submit@debbugs.gnu.org; Wed, 05 Mar 2025 12:01:14 -0500 Received: from mail-vk1-xa32.google.com ([2607:f8b0:4864:20::a32]:50196) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tps7M-00029Y-Aj for 76568@debbugs.gnu.org; Wed, 05 Mar 2025 12:01:13 -0500 Received: by mail-vk1-xa32.google.com with SMTP id 71dfb90a1353d-523909ec175so1577202e0c.0 for <76568@debbugs.gnu.org>; Wed, 05 Mar 2025 09:01:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741194066; x=1741798866; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=eMxEzi16Q/aM/9YAGJiK5ZOveex8cbrboPYbsVE1fsk=; b=JzUL2+6J/evUpHGVELH0RHC5eoTPOGjx2a+N4Uoijo2jDoUDlKWq6M6NV8uIFX/2BS lT39V9Vv5nuyKzb++aMH2SH4qfm8tJuLWSLK4PclPnrEUW1i1vkYHOEf1Po0SAEHMDXD PhD0jpd8ZuSqXqhRs1cvGr1QO/sBuuDaPTEMuxf3Q09tBR/bFDzu1VvAIbRZi/D3eDp9 +7abxIK4QTg6cFbjwrl+d9jg516Ee05GNPH3TlCdCqlmfT2Jx7TAbl9fL/NmuCtBE4Dk k96Lx1BJm3tEnrTbTMANQX8OlpjS3gWFda71WRfxZXrtot/3NLWkcpkHkK7lRM+Kvcv9 Qdsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741194066; x=1741798866; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eMxEzi16Q/aM/9YAGJiK5ZOveex8cbrboPYbsVE1fsk=; b=IOyinJmbSoxphM77p1SVThNwCfUpGyyvkokPyzJACnmPFd5J4Wk1E5xO5Jos4QdhxW lMBkw+WbTVK7eVj7MI5haSpeaWSrmA3xUL1JdiV9PtG4OkmB0efUs7DWmEbT+ib29Z60 R5MeBFR6ND9ErGDUQ1C6LVo88fEGLRLvrxYFiq0qwH0GGH0t1Q0MhI+y56plj2mUURxe oGVAZDuiWz4FjWXVl12kGe63Cs8rKYC53u9ekmlRQQ1fPkles1e5oNi30jn0L984M8tI +eU/TPnBkNFnV+EQLHKIopJ10W6s8SUI0rU9LZDBTvY/8NgowcnOiH7VCPEM9+bedCU/ Gscw== X-Gm-Message-State: AOJu0YwgX16G5Ell7grml5SwUOB4pzWzjjyjMz6zT9LuBIl+lhVv1Trb FF72a5cxU10LBDVsT0dHgoRZJxlhTl1hbz3H2cnhmLXzC2GnFiUuUkb45YmlhpJNcepPCbWu868 Ero4heyTwa4kdkI4xwOpkVai5U84= X-Gm-Gg: ASbGncudatioY8HaflFva4k+Iz0E2CEqGbvUC2mv4Pljx2bW281OmHI1gzTRw5mulQo vDGoOcT3STdRHjAcVBZzlU8DRuAkxEEAYee0gbtVtH3bNv+GXVLxsaFYmj5oJhD0aCH++nfT04n ag7GFXmDpX9AimFCZtbzTuFDPgyw== X-Google-Smtp-Source: AGHT+IFjqI762RT4YHDzAZ3mhr05Jk3AIn/ZkVEyuS35v9wFk/Xi8GOgtFd4YCoXrHLCciwu7XviD38080PQ//+o4eU= X-Received: by 2002:a05:6122:d21:b0:51f:3ffb:79ab with SMTP id 71dfb90a1353d-523c62889d4mr2236708e0c.8.1741194066703; Wed, 05 Mar 2025 09:01:06 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ship Mints Date: Wed, 5 Mar 2025 12:00:55 -0500 X-Gm-Features: AQ5f1JpZxBIC91z3mdKdTkvpmoeo1Vq4bPFQ2_WtZYc0W27WUW5wxIHWlL0uQZ0 Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Stefan Kangas Content-Type: multipart/mixed; boundary="000000000000d4d271062f9b556b" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000d4d271062f9b556b Content-Type: multipart/alternative; boundary="000000000000d4d26f062f9b5569" --000000000000d4d26f062f9b5569 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas wrote: > Ship Mints writes: > > > 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. > > Please submit a patch, but could we also have tests for this please? > > Thanks in advance. > Patch attached. It prevents the menu-driven case from erasing the already installed message. It could suggest to the user to remove and then install or we could offer to use package upgrade to the chosen package-desc. At the very least, the patch prevents duplicates. -Stephane --000000000000d4d26f062f9b5569 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas <stefankangas@gmail.com> wrote:
<= /div>
Ship Mints <shipmints@gmail.com> writes:

> 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.=C2=A0 The resu= lt was that I had two of
> each package installed.
>
> I think there's a bug in 'package-install' which, when inv= oked from
> 'package-install-button-action', processes the new package spe= c, and incorrectly checks to
> see if the package is already installed.=C2=A0 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-ins= tall' behave like
> 'package-reinstall' for the non-interactive case.

Please submit a patch, but could we also have tests for this please?

Thanks in advance.

Patch attached.=C2=A0 It prevents the m= enu-driven case from erasing the already installed message.=C2=A0 It could = suggest to the user to remove and then install or we could offer to use pac= kage upgrade to the chosen package-desc.=C2=A0 At the very least, the patch= prevents duplicates.

-Stephane
--000000000000d4d26f062f9b5569-- --000000000000d4d271062f9b556b Content-Type: application/octet-stream; name="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Disposition: attachment; filename="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_m7w5xifu0 RnJvbSA3YWY5YmNhNDExN2Y1NjNiMzRkYWNiYmNiNj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ZXJ0aW9ucygrKSwgNSBkZWxldGlvbnMoLSkKCmRp ZmYgLS1naXQgYS9saXNwL2VtYWNzLWxpc3AvcGFja2FnZS5lbCBiL2xpc3AvZW1hY3MtbGlzcC9w YWNrYWdlLmVsCmluZGV4IDhkNDk4YzIxNmRjLi5hNWVhNTNkMTllYSAxMDA2NDQKLS0tIGEvbGlz cC9lbWFjcy1saXNwL3BhY2thZ2UuZWwKKysrIGIvbGlzcC9lbWFjcy1saXNwL3BhY2thZ2UuZWwK QEAgLTIyNDMsMTYgKzIyNDMsMjAgQEAgcGFja2FnZS1pbnN0YWxsCiAgICAgICAgICAgICAgICAo cGFja2FnZS0tYWN0aXZlLWJ1aWx0LWluLXAgcGtnKSkKICAgICAgIChzZXRxIHBrZyAob3IgKGNh ZHIgKGFzc3EgbmFtZSBwYWNrYWdlLWFyY2hpdmUtY29udGVudHMpKSBwa2cpKSkKICAgICAoaWYt bGV0KiAoKHRyYW5zYWN0aW9uCisgICAgICAgICAgICAgICA7OyBUZXN0IGZvciBhbHJlYWR5IGlu c3RhbGxlZCB1c2luZyB0aGUgcGtnIHN5bWJvbCwgbm90CisgICAgICAgICAgICAgICA7OyB0aGUg YXJjaGl2ZS1zcGVjaWZpYyBkaXJlY3Rvcnkgc3RydWN0dXJlLgogICAgICAgICAgICAgICAgKGlm IChwYWNrYWdlLWRlc2MtcCBwa2cpCi0gICAgICAgICAgICAgICAgICAgKHVubGVzcyAocGFja2Fn ZS1pbnN0YWxsZWQtcCBwa2cpCisgICAgICAgICAgICAgICAgICAgKHVubGVzcyAocGFja2FnZS1p bnN0YWxsZWQtcCAocGFja2FnZS1kZXNjLW5hbWUgcGtnKSkKICAgICAgICAgICAgICAgICAgICAg IChwYWNrYWdlLWNvbXB1dGUtdHJhbnNhY3Rpb24gKGxpc3QgcGtnKQogICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocGFja2FnZS1kZXNjLXJlcXMgcGtn KSkpCi0gICA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ZS1pbnN0YWxs JyByZXR1cm5zIG5pbCBpZiBhbHJlYWR5CisgICAgOzsgaW5zdGFsbGVkLgorICAgIChzaG91bGQt bm90IChwYWNrYWdlLWluc3RhbGwgc2ltcGxlLXNpbmdsZS1kZXNjKSkKICAgICAobGV0KiAoKHNp bXBsZS1wa2ctZGlyIChmaWxlLW5hbWUtYXMtZGlyZWN0b3J5CiAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgKGV4cGFuZC1maWxlLW5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg InNpbXBsZS1zaW5nbGUtMS4zIgotLSAKMi40Ny4xCgo= --000000000000d4d271062f9b556b-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 05 12:54:22 2025 Received: (at control) by debbugs.gnu.org; 5 Mar 2025 17:54:23 +0000 Received: from localhost ([127.0.0.1]:39647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tpswo-0007ll-Lh for submit@debbugs.gnu.org; Wed, 05 Mar 2025 12:54:22 -0500 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:50185) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tpswm-0007lW-6S for control@debbugs.gnu.org; Wed, 05 Mar 2025 12:54:20 -0500 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5e04064af07so13331457a12.0 for ; Wed, 05 Mar 2025 09:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741197254; x=1741802054; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=mfU07YGwtT4wSPNb1leY8VvLcE77FJBrUaiP/dsLyNc=; b=HR2AIDv4xsd5ddaSlec5lwFmDmRnvKj+SA4QMoUtNUmGAOPpouU5DmICpugtL41Pyf rj9vC2WcIhUC4MjYRx/0KiAi5turZJjxEpCHID2ZcSjWSpZonJ1xDw1KF35aQZpv4oCt 7cqDNsgXfFNclmTj/YzqfJFFJ1Qx6DfiM1Sc0IOMRm5oV29aIHwNokOdcGGoHEPr63ap UGX27Ue2jcbfUNyb2BQ3FvUXL0a3HiqZGW80P2JL7yO6g7K1UPYS3h0EmabXZ8Kirelw dba51DPQeGy7oZKU9l2wHQ93jU05ojhKtThZFo6wzIVKci8GRJIPSQMRrwYAi6E+EOfd zpWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741197254; x=1741802054; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mfU07YGwtT4wSPNb1leY8VvLcE77FJBrUaiP/dsLyNc=; b=dzV27nvs6QRTotiK9HGqj4Te7WDeRPCDaqoWKNJeiPB2OB6gbeWLdcgdukCyItIFdh prCjEEh7r3bp+1wF+Ux722ZRpNS1CbBlirEJh4+3Nce3hTR+MyckhNVlhkEmqms4tmGm 6bulV8RKBgFsV5NkODCfurfFd7Z2g6spOp8x6ctstd60FA5nXlObGwDLU0TAs+xXS5xB ej914jysXayi+CSFOJ1X1vtiZrjB9CForYwp7IYaZL1qtktsm3RuGcq5NBNusfxkDISU 7exDV2qEUc/mJwwA4ijE9eePKadydjZ7IYNuSOfQSY2qFHX0RuVMpp5gz6AkQI4Rlxn1 eHZg== X-Gm-Message-State: AOJu0YyztEsiftRFvaTT4bxVoKiLNyf/Ikul386JEXkWK1Mz9/dk+9ss jJNpzWiUTIlu0N6TEreAHQl/rwWY6TSyqzIiLORFuIgFij7uYf57YiH2BHHnLTAgO1yIDF95K6/ wiugQEc/UVzNjqi/nq8pXS/xq3cKG5svB X-Gm-Gg: ASbGncttzQtVvE6y7ACRGG0ifI1PuxsSOY/lbt/AFZMrlV7SPpqKS/lC7qsoigbkbnW +vhp8BNyQd8ZV4m51Q0J3fIsHxFhOwgDhaT/Qws75GZC/Ka4Lzbpj0y9Sv62h0Hg2jMv7tM7JdF fof/CXFGZ4wc+LDdCN0g+2fmSpsA== X-Google-Smtp-Source: AGHT+IE2e4wC5tAkYhNL4qF5cJiJbJtMopf6mbm9oZ2w0RwWoCQK//VuFN5gqOuuA5s7WX3sAOq+ddOEl78OWDqLVrs= X-Received: by 2002:a17:907:c22:b0:abf:6744:5e96 with SMTP id a640c23a62f3a-ac20d84a962mr381827566b.8.1741197253833; Wed, 05 Mar 2025 09:54:13 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 5 Mar 2025 09:54:13 -0800 From: Stefan Kangas MIME-Version: 1.0 Date: Wed, 5 Mar 2025 09:54:13 -0800 X-Gm-Features: AQ5f1JrXa-mFBNoZ1MwYst6_TYzkbkcCJkJqWR8Ia3qwX0pDmnSQWKTaJWaDxgY Message-ID: Subject: control message for bug #76568 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 76568 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 05 14:55:58 2025 Received: (at 76568) by debbugs.gnu.org; 5 Mar 2025 19:55:58 +0000 Received: from localhost ([127.0.0.1]:39995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tpuqU-0005jE-91 for submit@debbugs.gnu.org; Wed, 05 Mar 2025 14:55:58 -0500 Received: from mail-ua1-x932.google.com ([2607:f8b0:4864:20::932]:51366) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tpuqR-0005j2-Q7 for 76568@debbugs.gnu.org; Wed, 05 Mar 2025 14:55:56 -0500 Received: by mail-ua1-x932.google.com with SMTP id a1e0cc1a2514c-86b9ea43955so411704241.2 for <76568@debbugs.gnu.org>; Wed, 05 Mar 2025 11:55:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741204550; x=1741809350; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=keqaZyuboqdAMZBzbNibqPIp24WOIje27p/lQFCnAqg=; b=TEEjxTRgcHJ3MP23vxbXBBCAai2aC1emlK2I2S9ljtygPBQnt2iaxNR/BILasGGGOf vb0msxdn87WIsETy9xbLLpKr2hURksN4XI55BDPg+R6l1rLj0xxrdydMkvy6WR1hegWK a2B+eZLzveDtfEiyiOIbHOvCbvlp5vjKc4yOgwOeTmkyOL2Gk61pqlHrGcd9Pgan0nwv YwR9PzsAk7+LJrErRAj32TospsWp0zod130ihBQbnrWeL7jkAcHZ+mnQEzq8nHSz+D/M SmB33Wilw2MJIvEvkftrALxyrKwp4A64QzgHeb3koICe56yILtLFgDuVmcVmjJVD8FgP kUqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741204550; x=1741809350; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=keqaZyuboqdAMZBzbNibqPIp24WOIje27p/lQFCnAqg=; b=vScdFEdCUkBJlmOdId36x+mSZ1synzfwXR6rBh2G1SWwfC38jcQ0Gr9LXU+p4iLHma xHWekGtb5uBBYlExb7z8sZ9RKBTZRwQTQf8pFc1jtSQFxGjUUJT5srKBdpSIWwfLa7AR YQyOUxDOsUE5Ngag8TNCMPnePLbcFANVdXdXKzBUeb2m3rCbjukzF4HfxW7nS8fK8aOK EuxNFEptayXU3HJeQV6/hIf3ONd7tRtIK4xA/eV7LuBHKbnwaRaUH+IwXEcTov9ieZr1 KEGEk8uqt7cIkpyWlaQsMaMny7SXdPO4FuwW6Cbl53KOCSSGRu6dKB0cjgckAYEvRrY7 LJtw== X-Gm-Message-State: AOJu0YwPQUFcZtd9NrE03uwZEX5gg4WSti0tjt797/8OjBGxBQx0W4s3 tob3yBryWqxUT562rRT6+W5R/dnOTzrS3+13Ous2FWX/M1qlPWd40nwrN+WPzdK2rRax/WVF7zF xuyi3PYTZ/sgV608dL/waGI2eeRg= X-Gm-Gg: ASbGncv6UOB8Wi715RNlGUEm+sSsRtXyS7KZCZ+ro06ZAroWxjRQ33oOBgSRSzAAEeX Gm1eifu5WNROZn1+9Rs7GE6n4LDJlOLGHDXkOtu5Rg8s8IFoheF8b87jsEeR2fnWoRwhv4wE8x3 H3q0aV9s0Ig71w8ia0Bn9SLm098w== X-Google-Smtp-Source: AGHT+IH/ada+GWZ2KXMBx4W5SU5nLC9qBYbTnjBepjXg82sV/4sSFzUuN5opMOcg8cOxCPMm9k4uSASOrAmkS7afB3Y= X-Received: by 2002:a05:6102:f98:b0:4bb:e8c5:b172 with SMTP id ada2fe7eead31-4c2e276dd7cmr3600002137.8.1741204549962; Wed, 05 Mar 2025 11:55:49 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ship Mints Date: Wed, 5 Mar 2025 14:55:38 -0500 X-Gm-Features: AQ5f1JqNM0x-RS06zmI_5S2jQZJG6kXcjLx6ObOnt9m01H8ak-SXqABZzAfIfxs Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Stefan Kangas Content-Type: multipart/alternative; boundary="000000000000ae941f062f9dc607" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000ae941f062f9dc607 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints wr= ote: > On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas > wrote: > >> Ship Mints writes: >> >> > 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 wa= s >> 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. >> >> Please submit a patch, but could we also have tests for this please? >> >> Thanks in advance. >> > > Patch attached. It prevents the menu-driven case from erasing the alread= y > installed message. It could suggest to the user to remove and then insta= ll > or we could offer to use package upgrade to the chosen package-desc. At > the very least, the patch prevents duplicates. > Thinking about it a bit more, this patch needs a little more work. The menu-driven package "upgrade" in describe-package-1 workflow will be interrupted by this patch. It does not differentiate install vs. upgrade and calls package-install which will now complain the package already exists. This should be changed to run package-upgrade. I'll take a look. Any feedback on the minimal patch is still welcome in the meantime. > --000000000000ae941f062f9dc607 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On = Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas <stefankangas@gmail.com> wrote= :
Ship Mints <shipmints@gmail.com> writes:

> 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.=C2=A0 The resu= lt was that I had two of
> each package installed.
>
> I think there's a bug in 'package-install' which, when inv= oked from
> 'package-install-button-action', processes the new package spe= c, and incorrectly checks to
> see if the package is already installed.=C2=A0 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-ins= tall' behave like
> 'package-reinstall' for the non-interactive case.

Please submit a patch, but could we also have tests for this please?

Thanks in advance.

Patch attached.=C2=A0 It prevents the menu-driven case from era= sing the already installed message.=C2=A0 It could suggest to the user to r= emove and then install or we could offer to use package upgrade to the chos= en package-desc.=C2=A0 At the very least, the patch prevents duplicates.

Th= inking about it a bit more, this patch needs a little more work.=C2=A0=C2= =A0The menu-driven package "upgrade" in describe-package-1 workflow will be = interrupted=C2=A0by= this patch.=C2=A0 It does not differentiate install vs. upgrade and calls = package-install which will now complain the package already exists.=C2=A0 T= his should be changed to run package-upgrade.=C2=A0 I'll take a look.

Any feedback on the minimal patch is still welco= me in the meantime.
--000000000000ae941f062f9dc607-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 05 16:03:17 2025 Received: (at 76568) by debbugs.gnu.org; 5 Mar 2025 21:03:17 +0000 Received: from localhost ([127.0.0.1]:40077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tpvtc-0003Hp-Vg for submit@debbugs.gnu.org; Wed, 05 Mar 2025 16:03:17 -0500 Received: from mail-vk1-xa2b.google.com ([2607:f8b0:4864:20::a2b]:52398) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tpvta-0003HX-19 for 76568@debbugs.gnu.org; Wed, 05 Mar 2025 16:03:14 -0500 Received: by mail-vk1-xa2b.google.com with SMTP id 71dfb90a1353d-51eb181331bso3578264e0c.0 for <76568@debbugs.gnu.org>; Wed, 05 Mar 2025 13:03:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741208588; x=1741813388; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=smNGoBE5RvtNy0bfRWJqJFTLfsHy0VnM4cm/uLsA0C0=; b=ixLd0ThLcWcs6ZeWswuz2Fm0a7SVF0AYbIRIGG9uRDee8+qaihBKz813y5XjOCaS7/ SQmjsgWVf44oJusCMuEghz5GLqyoHORThyAKlzOcHlrlwFIbWoTS6FSfDR/fIyN8AjN+ 2BOGKpv98YE8Z3ZgsH5S4sybyb9Vz2wPqyCuB5nzGR7u8KHX6o/a4w5X3RP3sdbpVYOz NY1ZqLrHuCC+5GZMYuEFzaPvJ053lMfgVbts7yAfyhg0vplvJfn3gflV/Tl4ReVVSs3z Vyp1YGleGijCMb5ERaeSTncbXVFU0v7IWbH2FEymudZVS2MuFV3VQMK//xvz01pL1eeD +miQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741208588; x=1741813388; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=smNGoBE5RvtNy0bfRWJqJFTLfsHy0VnM4cm/uLsA0C0=; b=vvf7uUovTnXPOKAC1/DAvrSJLs3vk5welzl4c99mhbrBfVBrqIAaUnhnFkBqN+MdaL 9mVLd/f2Wtdi6/K2y2O3sSDTOWNhVqvH6AwHhzG9LKtEcy4hhdoeed0erXzwxIKYI1DC duLiw6jx3E90RoxHTeDMTF+641SjkthQ4wdX8tMBUQKwqZOBNER3i6hpaNGngsXUxfRG WZ89SRMXOfNTIifCFG90eSHCilovNsfJKmspci+raR/tzzb9cP9wKpNiwnE9F5REKow8 TeHkonyGK6cZZ0r77IL+KBImsgwSGFbDa90IyEz/TGh3CdwCgeeKS/cPTnFq5whWQQyY Ooug== X-Gm-Message-State: AOJu0YzN+IVI4MH0XJ/WjBzbb7GLiAgJlihZkBrnaD3RJGNb/UtIfMNZ +ux6PYgFn1lGVz2Fzs+hG/K92t1Eo9UY+PfSJ885bZRgyVRrXHlHBJ4VJypJyotxQrlq0EZ/MnJ T9aJU6C+c9QqJGms+aHN0wdJicCs= X-Gm-Gg: ASbGncu3g03PXeC0GKFhLMBlGiWQQYis+JS0C5OKBOFKaiMZO6NPHf0tLrXJk3aqVym Wd7hOvz3ggXqX3pyU+zAIWNZ39MDAXUW3EJgBgT3TmBBHZzvckXr2FXZKtEf7bauXzCGJ0KTqXm hHPVqAmLw1JCgTHeFXNMnJrblL7A== X-Google-Smtp-Source: AGHT+IG+pgQwLHuUNAl9lDG/d5RSdsOnZpgDt2k8/0kWkBrp18yHGwnG8JcHkGbdU9Ag+R112lBT8RsZA777PbiFNms= X-Received: by 2002:a05:6122:659f:b0:520:4d95:1319 with SMTP id 71dfb90a1353d-523c6150ff9mr3063591e0c.4.1741208588201; Wed, 05 Mar 2025 13:03:08 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ship Mints Date: Wed, 5 Mar 2025 16:02:57 -0500 X-Gm-Features: AQ5f1JoRv1mzf2kFdQhT4iWAln78AfEbBDYlgajo-SX4t-4OFnFXjpB-Ak8pAZ8 Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Stefan Kangas Content-Type: multipart/mixed; boundary="000000000000614e73062f9eb720" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000614e73062f9eb720 Content-Type: multipart/alternative; boundary="000000000000614e72062f9eb71e" --000000000000614e72062f9eb71e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints wro= te: > On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints = wrote: > >> On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas >> wrote: >> >>> Ship Mints writes: >>> >>> > As part of my production upgrade to 30.1, and before I wrote a progra= m >>> to install my local >>> > ELPA tree from scratch, I tried to first curate my packages and chang= e >>> 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. >>> >>> Please submit a patch, but could we also have tests for this please? >>> >>> Thanks in advance. >>> >> >> Patch attached. It prevents the menu-driven case from erasing the >> already installed message. It could suggest to the user to remove and t= hen >> install or we could offer to use package upgrade to the chosen >> package-desc. At the very least, the patch prevents duplicates. >> > > Thinking about it a bit more, this patch needs a little more work. The > menu-driven package "upgrade" in describe-package-1 workflow will be inte= rrupted by > this patch. It does not differentiate install vs. upgrade and calls > package-install which will now complain the package already exists. This > should be changed to run package-upgrade. I'll take a look. > > Any feedback on the minimal patch is still welcome in the meantime. > This patch now accommodates both scenarios. --000000000000614e72062f9eb71e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On W= ed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:<= /div>
On Mon, Mar= 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas <stefankangas@gmail.com> wrote:=
Ship Mints <shipmints@gmail.com> writes:

> 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.=C2=A0 The resu= lt was that I had two of
> each package installed.
>
> I think there's a bug in 'package-install' which, when inv= oked from
> 'package-install-button-action', processes the new package spe= c, and incorrectly checks to
> see if the package is already installed.=C2=A0 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-ins= tall' behave like
> 'package-reinstall' for the non-interactive case.

Please submit a patch, but could we also have tests for this please?

Thanks in advance.

Patch attached.=C2=A0 It prevents the menu-driven case from era= sing the already installed message.=C2=A0 It could suggest to the user to r= emove and then install or we could offer to use package upgrade to the chos= en package-desc.=C2=A0 At the very least, the patch prevents duplicates.

Th= inking about it a bit more, this patch needs a little more work.=C2=A0=C2= =A0The menu-driven package "upgrade" in describe-package-1 workflow will be = interrupted=C2=A0by= this patch.=C2=A0 It does not differentiate install vs. upgrade and calls = package-install which will now complain the package already exists.=C2=A0 T= his should be changed to run package-upgrade.=C2=A0 I'll take a look.

Any feedback on the minimal patch is still welco= me in the meantime.

This patch= now accommodates both scenarios.
--000000000000614e72062f9eb71e-- --000000000000614e73062f9eb720 Content-Type: application/octet-stream; name="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Disposition: attachment; filename="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_m7wemn560 RnJvbSAwMGI4OTk2MTY5ODI5ZDA4YmZhNzgwMWE3OWUyMGM0Njk0Y2I2NTcwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBzaGlwbWludHMgPHNoaXBtaW50c0BnbWFpbC5jb20+CkRhdGU6 IFdlZCwgNSBNYXIgMjAyNSAxMTozMzowNyAtMDUwMApTdWJqZWN0OiBbUEFUQ0hdIENvcnJlY3Qg J3BhY2thZ2UtaW5zdGFsbCcgdG8gZGV0ZWN0IGluc3RhbGxlZCBwYWNrYWdlcwogKGJ1ZyM3NjU2 OCkKCiogbGlzcC9lbWFjcy1saXN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0yMjQzLDE2ICsyMjQzLDIwIEBAIHBhY2thZ2UtaW5zdGFsbAogICAg ICAgICAgICAgICAgKHBhY2thZ2UtLWFjdGl2ZS1idWlsdC1pbi1wIHBrZykpCiAgICAgICAoc2V0 cSBwa2cgKG9yIChjYWRyIChhc3NxIG5hbWUgcGFja2FnZS1hcmNoaXZlLWNvbnRlbnRzKSkgcGtn KSkpCiAgICAgKGlmLWxldCogKCh0cmFuc2FjdGlvbgorICAgICAgICAgICAgICAgOzsgVGVzdCBm b3IgYWxyZWFkeSBpbnN0YWxsZWQgdXNpbmcgdGhlIHBrZyBzeW1ib2wsIG5vdAorICAgICAgICAg ICAgICAgOzsgdGhlIGFyY2hpdmUtc3BlY2lmaWMgZGlyZWN0b3J5IHN0cnVjdHVyZS4KICAgICAg ICAgICAgICAgIChpZiAocGFja2FnZS1kZXNjLXAgcGtnKQotICAgICAgICAgICAgICAgICAgICh1 bmxlc3MgKHBhY2thZ2UtaW5zdGFsbGVkLXAgcGtnKQorICAgICAgICAgICAgICAgICAgICh1bmxl c3MgKHBhY2thZ2UtaW5zdGFsbGVkLXAgKHBhY2thZ2UtZGVzYy1uYW1lIHBrZykpCiAgICAgICAg ICAgICAgICAgICAgICAocGFja2FnZS1jb21wdXRlLXRyYW5zYWN0aW9uIChsaXN0IHBrZykKICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBhY2thZ2Ut ZGVzYy1yZXFzIHBrZykpKQotICAgICAgICAgICAgICAgICAocGFja2FnZS1jb21wdXRlLXRyYW5z YWN0aW9uICgpIChsaXN0IChsaXN0IHBrZykpKSkpKQorICAgICAgICAgICAgICAgICAodW5sZXNz IChwYWNrYWdlLWluc3RhbGxlZC1wIHBrZykKKyAgICAgICAgICAgICAgICAgICAocGFja2FnZS1j b21wdXRlLXRyYW5zYWN0aW9uICgpIChsaXN0IChsaXN0IHBrZykpKSkpKSkKICAgICAgICAgKHBy b2duCiAgICAgICAgICAgKHBh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SkKKyAgICAgICAgKGxldCAoKGluc3RhbGxlZC1w a2ctZGVzYyAoY2FkciAoYXNzcQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAocGFja2FnZS1kZXNjLW5hbWUgcGtnLWRlc2MpCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHBhY2thZ2UtYWxpc3QpKSkpCisgICAgICAgICAgKHdoZW4KKyAg ICAgICAgICAgICAgKHktb3Itbi1wCisgICAgICAgICAgICAgICAoZm9ybWF0LW1lc3NhZ2UKKyAg ICAgICAgICAgICAgICAiSW5zdGFsbC91cGdyYWRlIGFscmVhZHkgaW5zdGFsbGVkIHBhY2thZ2Ug YCVzJz8gIgorICAgICAgICAgICAgICAgIChwYWNrYWdlLWRlc2MtZnVsbC1uYW1lIGluc3RhbGxl ZC1wa2ctZGVzYykpKQorICAgICAgICAgICAgKHBhY2thZ2UtZGVsZXRlIGluc3RhbGxlZC1wa2ct ZGVzYyAnZm9yY2UgJ2RvbnQtdW5zZWxlY3QpCisgICAgICAgICAgICAod2hlbiAocGFja2FnZS1p bnN0YWxsIHBrZy1kZXNjIG5pbCkKKyAgICAgICAgICAgICAgKGRlc2NyaWJlLXBhY2thZ2UgKHBh Y2thZ2UtZGVzYy1uYW1lIHBrZy1kZXNjKSkpKSkKKyAgICAgICh3aGVuICh5LW9yLW4tcCAoZm9y bWF0LW1lc3NhZ2UgIkluc3RhbGwgcGFja2FnZSBgJXMnPyAiCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIChwYWNrYWdlLWRlc2MtZnVsbC1uYW1lIHBrZy1kZXNjKSkpCisg ICAgICAgICh3aGVuIChwYWNrYWdlLWluc3RhbGwgcGtnLWRlc2MgbmlsKQorICAgICAgICAgIChk ZXNjcmliZS1wYWNrYWdlIChwYWNrYWdlLWRlc2MtbmFtZSBwa2ctZGVzYykpKSkpKSkKIAogKGRl ZnVuIHBhY2thZ2UtZGVsZXRlL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ICAgKGV4cGFuZC1maWxlLW5hbWUKICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgInNpbXBsZS1zaW5nbGUtMS4zIgotLSAKMi40Ny4xCgo= --000000000000614e73062f9eb720-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 05 16:05:45 2025 Received: (at 76568) by debbugs.gnu.org; 5 Mar 2025 21:05:45 +0000 Received: from localhost ([127.0.0.1]:40084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tpvw0-0003RR-VN for submit@debbugs.gnu.org; Wed, 05 Mar 2025 16:05:45 -0500 Received: from mail-vk1-xa2c.google.com ([2607:f8b0:4864:20::a2c]:58674) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tpvvz-0003RE-0r for 76568@debbugs.gnu.org; Wed, 05 Mar 2025 16:05:43 -0500 Received: by mail-vk1-xa2c.google.com with SMTP id 71dfb90a1353d-51eb1a6ca1bso3031362e0c.1 for <76568@debbugs.gnu.org>; Wed, 05 Mar 2025 13:05:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741208737; x=1741813537; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SQnYazM5sB3i2txqH6HPQekpcKmc8iwLjtXsIAhcUQM=; b=lqaeYto+mP8hmhw5RksOoDfC/UbMNYVjUfruRgutUtvrV0/Zm7KR5+qcmLxxbbftOQ /hUTMsSPFEZOVNMTPkPCvPRjONw30OHH2odEesP/4RoM3anChewKquOYw6G46vGd5Dxd +ZIUrWoOlKPjgMz2UJeA8SiSCnWECIGojnfzk9IrMcqrrF68UkK816UI1i1/PsGA7bOV gnilGR+3mC1Qa/WrdeebP2KgXoqQMxmgk3qMQlFozPGcJK4CNESVVPXThV9QvBgN6ncw 16jc1MhcVMQhlOjKk7jsYtoR8Y6U9yXhdJV9zvAZzWWpon5jPMX/3THzWDZu4yc2nxgB 0fjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741208737; x=1741813537; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SQnYazM5sB3i2txqH6HPQekpcKmc8iwLjtXsIAhcUQM=; b=wFPGtb3KcQPUcl/2I1Ci/d7g9VrtCT7VgV7rr4zDUb3ux8B5s8kvcUwsZK2bzctV3p J/k4XZp3+L/TET+/6KtP3kyQpSkghNXaLfl8At9ymnZ5fYXcsYxujof8G8/KNlzw57/Z 735fJOJHyR9zHSln755/V8AU4cGEdSWRUPShw7YbGX8PiSxB/x1Q4MDhfrbePc6TlEz1 /t6J8jK0L2be9y/3PqcJf+7yFc46KRI/+5wTXAektVtMnWcW1dJ5FEO9ZuKtVERXtyh3 QHt2KW2bLKQ5SVTyoWok7MHcnmG6aELEatf3CiTLRVYb6lALtDXCabf7X3dK0awKwEsC 99Sg== X-Gm-Message-State: AOJu0Yy0wMYztmi0Zh5OwywdCV2irim2FbHG+aFjMrtoW/zShaIoyY/V oCQnvVERTdetOSFQ28fNR/Ev10K2CxoD9BWMzSeslBh5khb1HSJKFpJh9IDKFx0SH995Gl52+VR coeRMyZ+sdZLmVonsIltieTF7C8oZWg== X-Gm-Gg: ASbGnctQLUtVIWhq0O+DoMWwN/jjwd36vPOlnyVE5U5RZ7p/a/HKgIocCKsJDmQMBM9 1vttCH1yNntvVsU6ARdz+3kZo58BYF2doP0uKGk1F6mmUbXmuT4hiX/LIKH0aIvgLIwcsjDKoNf TSxCHG9czJoseotAlKZeFoMFhrLQ== X-Google-Smtp-Source: AGHT+IE22JpPr3CNSUFAGFXBHv63urZSVpp7ez2o66Tbiebk8xhYIrYf70ZLbpEiNOy68DNyKWXlVWcVwWkNym7tt64= X-Received: by 2002:a05:6122:1ad0:b0:520:3536:feb5 with SMTP id 71dfb90a1353d-523c62f37c2mr2637769e0c.11.1741208737004; Wed, 05 Mar 2025 13:05:37 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ship Mints Date: Wed, 5 Mar 2025 16:05:25 -0500 X-Gm-Features: AQ5f1JrciSQIzphROUB-Jn267_IcKui3v9IDO_1E_dg0No8FOzo0MsryI8dLM10 Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Stefan Kangas Content-Type: multipart/mixed; boundary="0000000000004030d4062f9ec08c" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000004030d4062f9ec08c Content-Type: multipart/alternative; boundary="0000000000004030d0062f9ec08a" --0000000000004030d0062f9ec08a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints wro= te: > On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints w= rote: > >> On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints = wrote: >> >>> On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas >>> wrote: >>> >>>> Ship Mints writes: >>>> >>>> > 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. >>>> >>>> Please submit a patch, but could we also have tests for this please? >>>> >>>> Thanks in advance. >>>> >>> >>> Patch attached. It prevents the menu-driven case from erasing the >>> already installed message. It could suggest to the user to remove and = then >>> install or we could offer to use package upgrade to the chosen >>> package-desc. At the very least, the patch prevents duplicates. >>> >> >> Thinking about it a bit more, this patch needs a little more work. The >> menu-driven package "upgrade" in describe-package-1 workflow will be int= errupted by >> this patch. It does not differentiate install vs. upgrade and calls >> package-install which will now complain the package already exists. Thi= s >> should be changed to run package-upgrade. I'll take a look. >> >> Any feedback on the minimal patch is still welcome in the meantime. >> > > This patch now accommodates both scenarios. > Now with an amended commit log. --0000000000004030d0062f9ec08a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On W= ed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Wed, Mar = 5, 2025 at 12:00=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Mon, Mar 3, 2025= at 9:34=E2=80=AFPM Stefan Kangas <stefankangas@gmail.com> wrote:
Ship Mints <shipmints@gmail.com> writes:

> 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.=C2=A0 The resu= lt was that I had two of
> each package installed.
>
> I think there's a bug in 'package-install' which, when inv= oked from
> 'package-install-button-action', processes the new package spe= c, and incorrectly checks to
> see if the package is already installed.=C2=A0 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-ins= tall' behave like
> 'package-reinstall' for the non-interactive case.

Please submit a patch, but could we also have tests for this please?

Thanks in advance.

Patch attached.=C2=A0 It prevents the menu-driven case from era= sing the already installed message.=C2=A0 It could suggest to the user to r= emove and then install or we could offer to use package upgrade to the chos= en package-desc.=C2=A0 At the very least, the patch prevents duplicates.

Th= inking about it a bit more, this patch needs a little more work.=C2=A0=C2= =A0The menu-driven package "upgrade" in describe-package-1 workflow will be = interrupted=C2=A0by= this patch.=C2=A0 It does not differentiate install vs. upgrade and calls = package-install which will now complain the package already exists.=C2=A0 T= his should be changed to run package-upgrade.=C2=A0 I'll take a look.

Any feedback on the minimal patch is still welco= me in the meantime.

This patch now accommodates both s= cenarios.

Now with an amended commit log.
--0000000000004030d0062f9ec08a-- --0000000000004030d4062f9ec08c Content-Type: application/octet-stream; name="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Disposition: attachment; filename="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_m7wepu4o0 RnJvbSA5M2Y0Yzc4ODU2ODI5ZWUzOGM5OWZhYmQzNTYyOTBhYmM2NmE2OGRkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBzaGlwbWludHMgPHNoaXBtaW50c0BnbWFpbC5jb20+CkRhdGU6 IFdlZCwgNSBNYXIgMjAyNSAxMTozMzowNyAtMDUwMApTdWJqZWN0OiBbUEFUQ0hdIENvcnJlY3Qg J3BhY2thZ2UtaW5zdGFsbCcgdG8gZGV0ZWN0IGluc3RhbGxlZCBwYWNrYWdlcwogKGJ1ZyM3NjU2 OCkKCiogbGlzcC9lbWFjcy1saXNwL3BhY2thZ2UuZWwKKHBhY2thZ2UtaW5zdGFsbCk6IENoZWNr IGZvciBhbHJlYWR5IGluc3RhbGxlZCBwYWNrYWdlIHVzaW5nIGl0cyBzeW1ib2wKcmF0aGVyIHRo YW4gcmVseSBvbiBkaWZmZXJpbmcgYXJjaGl2ZSBkaXJlY3Rvcnkgc3RydWN0dXJlcy4gIFJldHVy biB0IGlmCmluc3RhbGxlZCwgbmlsIG90aGVyd2lzZS4KKH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hbWUgcGFja2FnZS1hcmNoaXZlLWNv bnRlbnRzKSkgcGtnKSkpCiAgICAgKGlmLWxldCogKCh0cmFuc2FjdGlvbgorICAgICAgICAgICAg ICAgOzsgVGVzdCBmb3IgYWxyZWFkeSBpbnN0YWxsZWQgdXNpbmcgdGhlIHBrZyBzeW1ib2wsIG5v dAorICAgICAgICAgICAgICAgOzsgdGhlIGFyY2hpdmUtc3BlY2lmaWMgZGlyZWN0b3J5IHN0cnVj dHVyZS4KICAgICAgICAgICAgICAgIChpZiAocGFja2FnZS1kZXNjLXAgcGtnKQotICAgICAgICAg ICAgICAgICAgICh1bmxlc3MgKHBhY2thZ2UtaW5zdGFsbGVkLXAgcGtnKQorICAgICAgICAgICAg ICAgICAgICh1bmxlc3MgKHBhY2thZ2UtaW5zdGFsbGVkLXAgKHBhY2thZ2UtZGVzYy1uYW1lIHBr ZykpCiAgICAgICAgICAgICAgICAgICAgICAocGFja2FnZS1jb21wdXRlLXRyYW5zYWN0aW9uIChs aXN0IHBrZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgKHBhY2thZ2UtZGVzYy1yZXFzIHBrZykpKQotICAgICAgICAgICAgICAgICAocGFja2FnZS1j b21wdXRlLXRyYW5zYWN0aW9uICgpIChsaXN0IChsaXN0IHBrZykpKSkpKQorICAgICAgICAgICAg ICAgICAodW5sZXNzIChwYWNrYWdlLWluc3RhbGxlZC1wIHBrZykKKyAgICAgICAgICAgICAgICAg ICAocGFja2FnZS1jb21wdXRlLXRyYW5zYWN0aW9uICgpIChsaXN0IChsaXN0IHBrZykpKSkpKSkK ICAgICAgICAgKHByb2duCiAgICAgICAgICAgKHBhY2thZ2UtZG93bmxvYWQtdHJhbnNhY3Rpb24g dHJhbnNhY3Rpb24pCiAgICAgICAgICAgKHBhY2thZ2UtLXF1aWNrc3RhcnQtbWF5YmUtcmVmcmVz aCkKICAgICAgICAgICAobWVzc2FnZSAgIlBhY2thZ2UgYCVzJ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WNrYWdlLXRlc3RzLmVsIGIvdGVzdC9s aXNwL2VtYWNzLWxpc3AvcGFja2FnZS10ZXN0cy5lbAppbmRleCBkOGUyNjAzMTliZC4uMzY2MTdl ZDZmNmUgMTAwNjQ0Ci0tLSBhL3Rlc3QvbGlzcC9lbWFjcy1saXNwL3BhY2thZ2UtdGVzdHMuZWwK KysrIGIvdGVzdC9saXNwL2VtYWNzLWxpc3AvcGFja2FnZS10ZXN0cy5lbApAQCAtMjQ4LDYgKzI0 OCwxMCBAQCBwYWNrYWdlLXRlc3QtaW5zdGFsbC1zaW5nbGUKICAgICAgIChzaG91bGQgKHN0cmlu Zy1tYXRjaCAiXltg4oCYJ11zaW1wbGUtc2luZ2xlW+KAmSddIGlzIGFscmVhZHkgaW5zdGFsbGVk XG4/XFwnIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIChidWZmZXItc3RyaW5nKSkpKQog ICAgIChzaG91bGQgKHBhY2thZ2UtaW5zdGFsbGVkLXAgJ3NpbXBsZS1zaW5nbGUpKQorICAgIDs7 IFRlc3QgZm9yIGBwYWNrYWdlLWluc3RhbGwnIGFscmVhZHkgaW5zdGFsbGVkIHVzaW5nIGEKKyAg ICA7OyBwYWNrYWdlLWRlc2MuICBgcGFja2FnZS1pbnN0YWxsJyByZXR1cm5zIG5pbCBpZiBhbHJl YWR5CisgICAgOzsgaW5zdGFsbGVkLgorICAgIChzaG91bGQtbm90IChwYWNrYWdlLWluc3RhbGwg c2ltcGxlLXNpbmdsZS1kZXNjKSkKICAgICAobGV0KiAoKHNpbXBsZS1wa2ctZGlyIChmaWxlLW5h bWUtYXMtZGlyZWN0b3J5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGV4cGFuZC1maWxl LW5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInNpbXBsZS1zaW5nbGUtMS4zIgot LSAKMi40Ny4xCgo= --0000000000004030d4062f9ec08c-- From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 07 06:33:41 2025 Received: (at 76568) by debbugs.gnu.org; 7 Mar 2025 11:33:41 +0000 Received: from localhost ([127.0.0.1]:47242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tqVxV-0002GM-6v for submit@debbugs.gnu.org; Fri, 07 Mar 2025 06:33:41 -0500 Received: from mail-vk1-xa35.google.com ([2607:f8b0:4864:20::a35]:55600) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tqVxS-0002G6-QW for 76568@debbugs.gnu.org; Fri, 07 Mar 2025 06:33:39 -0500 Received: by mail-vk1-xa35.google.com with SMTP id 71dfb90a1353d-51eb1823a8eso867706e0c.3 for <76568@debbugs.gnu.org>; Fri, 07 Mar 2025 03:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741347213; x=1741952013; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=nS06Jh7qXRxQ19STbJwFY0QSUhjMtTggA2iVdqGhKtc=; b=gCkJyYupgca48OUaY0CHmgZYIphzRD+Csuo1sj6KXYDVauwAteVkegLfdJHL2PSROX nd3Rl+VCmRrl5SJz7VDz36RZKZhrZ2wXOFB73YAvx2qSTCGMKCsomPjs94/O2a01Dqvw Ud3+Yig/nTMk3+E1i8ZoqsXWZZ0L3JexvvYS77M4nCu8hNbhsDF8UQvDMxzQTyj63xVL /FR9WzEnkw5fmEOIbhXvqsx1pHVoMPiofX55E6NzIfBn+PodOt1nyHuNpM4Qk0dwyLb8 nOLgN3ovEihX5sFVxo2XymIMI9gUc5txb8+3e0wALq+wbW3J6chrlaEu/sO0881IQtee qfvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741347213; x=1741952013; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nS06Jh7qXRxQ19STbJwFY0QSUhjMtTggA2iVdqGhKtc=; b=JlN45pBQbLkYrXhaF33bj4EAFZHNVRdJ/zGW9VMtqXVVpdSq3pkV7vZK9Ph+wGin29 c3QNTk993u6i77/giio1PXUUz/ttoGUOpDPk4twZSR3RO8RjTFPst64GWVIfYdobcRYJ lD6E2WHYMNDwwdb2vvBbsqw5T/Wr6byfuAvHwClnIAdEGordbCXg+MuFZlrmQbmbC4Ur nc8Ib7teVdYmnPoso6XlenSEEWD2VjkUr2EDVf8LMrPqQxelvC9AntwjLnBSBh80tX33 fmkM7G/pdQgpZ54azxPH3xvbXweuqWkomUG+JTQ4qYPQhnQnF4nwXv+Qtk6+BLLR0LlF qnCw== X-Gm-Message-State: AOJu0YyeAdNW4sQIIQW0u7JpGcll+oygvYsCaoQVIn69dupoBK11Zhc6 gFedyB1OEFX+5esGdgFAe8h+ZJLe43nmV2072/bYl5jwAe4paZQ6i5gTPSw0h6OBkuIWfjPDMyS 4ercybN0mGW969vgQFlax+1hXPRQ= X-Gm-Gg: ASbGnctvewf13rc6PttxHY2iGCUghF8GZR+TF3gjo0mhsjo3bjM2szawEoutGG/NfAU IclpZschXapcPlOOSZ1F2bg6oEPPMXNweUZT3VINyNxCIh5z/ia8GTWoIQdJAFyz07GVgEr2skl zij1KYUquEIj8kFD5uT9QZJaPDag== X-Google-Smtp-Source: AGHT+IHI93FDnnCVXRYZslufa6NXrsJMbE4R2Ujv4rkBDes/gBYZSIZ4YxXIQ44G3UibfSXlw/7qToEMnjvDyEvlrX4= X-Received: by 2002:a05:6122:2a12:b0:520:61ee:c7fc with SMTP id 71dfb90a1353d-523e4057872mr1707570e0c.4.1741347212882; Fri, 07 Mar 2025 03:33:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ship Mints Date: Fri, 7 Mar 2025 06:33:21 -0500 X-Gm-Features: AQ5f1JplzU-3wjn19DgkZ1Vq0jsQnMUEftzkAUE0OVUopEbb0N2YNJSOvVkSUn8 Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Stefan Kangas Content-Type: multipart/mixed; boundary="0000000000000e17c3062fbefe8d" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000000e17c3062fbefe8d Content-Type: multipart/alternative; boundary="0000000000000e17c1062fbefe8b" --0000000000000e17c1062fbefe8b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 5, 2025 at 4:05=E2=80=AFPM Ship Mints wro= te: > On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints w= rote: > >> On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints = wrote: >> >>> On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints wrote: >>> >>>> On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas >>>> wrote: >>>> >>>>> Ship Mints writes: >>>>> >>>>> > 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, an= d >>>>> 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. >>>>> >>>>> Please submit a patch, but could we also have tests for this please? >>>>> >>>>> Thanks in advance. >>>>> >>>> >>>> Patch attached. It prevents the menu-driven case from erasing the >>>> already installed message. It could suggest to the user to remove and= then >>>> install or we could offer to use package upgrade to the chosen >>>> package-desc. At the very least, the patch prevents duplicates. >>>> >>> >>> Thinking about it a bit more, this patch needs a little more work. The >>> menu-driven package "upgrade" in describe-package-1 workflow will be in= terrupted by >>> this patch. It does not differentiate install vs. upgrade and calls >>> package-install which will now complain the package already exists. Th= is >>> should be changed to run package-upgrade. I'll take a look. >>> >>> Any feedback on the minimal patch is still welcome in the meantime. >>> >> >> This patch now accommodates both scenarios. >> > > Now with an amended commit log. > Attached patch with improved package replacement prompt. --0000000000000e17c1062fbefe8b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Wed, Mar 5, 2025 at 4:05=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On W= ed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Wed, Mar = 5, 2025 at 2:55=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
= On Wed, Mar 5, 2025 = at 12:00=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Mon, Mar 3, 2025 at 9:34= =E2=80=AFPM Stefan Kangas <stefankangas@gmail.com> wrote:
Sh= ip Mints <shipm= ints@gmail.com> writes:

> 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.=C2=A0 The resu= lt was that I had two of
> each package installed.
>
> I think there's a bug in 'package-install' which, when inv= oked from
> 'package-install-button-action', processes the new package spe= c, and incorrectly checks to
> see if the package is already installed.=C2=A0 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-ins= tall' behave like
> 'package-reinstall' for the non-interactive case.

Please submit a patch, but could we also have tests for this please?

Thanks in advance.

Patch attached.=C2=A0 It prevents the menu-driven case from era= sing the already installed message.=C2=A0 It could suggest to the user to r= emove and then install or we could offer to use package upgrade to the chos= en package-desc.=C2=A0 At the very least, the patch prevents duplicates.

Th= inking about it a bit more, this patch needs a little more work.=C2=A0=C2= =A0The menu-driven package "upgrade" in describe-package-1 workflow will be = interrupted=C2=A0by= this patch.=C2=A0 It does not differentiate install vs. upgrade and calls = package-install which will now complain the package already exists.=C2=A0 T= his should be changed to run package-upgrade.=C2=A0 I'll take a look.

Any feedback on the minimal patch is still welco= me in the meantime.

This patch now accommodates both s= cenarios.

Now with an amended commit log.

Attached patch with improved package replacement prompt.
--0000000000000e17c1062fbefe8b-- --0000000000000e17c3062fbefe8d Content-Type: application/octet-stream; name="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Disposition: attachment; filename="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_m7yp5tum0 RnJvbSBmY2QxOWM0OTkwNTcyZDQ3YmU5NDNiMWY4ZDQwN2Q0MzJhYTFhZGNhIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBzaGlwbWludHMgPHNoaXBtaW50c0BnbWFpbC5jb20+CkRhdGU6 IFdlZCwgNSBNYXIgMjAyNSAxMTozMzowNyAtMDUwMApTdWJqZWN0OiBbUEFUQ0hdIENvcnJlY3Qg J3BhY2thZ2UtaW5zdGFsbCcgdG8gZGV0ZWN0IGluc3RhbGxlZCBwYWNrYWdlcwogKGJ1ZyM3NjU2 OCkKCiogbGlzcC9lbWFjcy1saXNwL3BhY2thZ2UuZWwKKHBhY2thZ2UtaW5zdGFsbCk6IENoZWNr IGZvciBhbHJlYWR5IGluc3RhbGxlZCBwYWNrYWdlIHVzaW5nIGl0cyBzeW1ib2wKcmF0aGVyIHRo YW4gcmVseSBvbiBkaWZmZXJpbmcgYXJjaGl2ZSBkaXJlY3Rvcnkgc3RydWN0dXJlcy4gIFJldHVy biB0IGlmC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V0cSBwa2cgKG9yIChjYWRyIChhc3NxIG5hbWUgcGFja2FnZS1hcmNoaXZlLWNv bnRlbnRzKSkgcGtnKSkpCiAgICAgKGlmLWxldCogKCh0cmFuc2FjdGlvbgorICAgICAgICAgICAg ICAgOzsgVGVzdCBmb3IgYWxyZWFkeSBpbnN0YWxsZWQgdXNpbmcgdGhlIHBrZyBzeW1ib2wsIG5v dAorICAgICAgICAgICAgICAgOzsgdGhlIGFyY2hpdmUtc3BlY2lmaWMgZGlyZWN0b3J5IHN0cnVj dHVyZS4KICAgICAgICAgICAgICAgIChpZiAocGFja2FnZS1kZXNjLXAgcGtnKQotICAgICAgICAg ICAgICAgICAgICh1bmxlc3MgKHBhY2thZ2UtaW5zdGFsbGVkLXAgcGtnKQorICAgICAgICAgICAg ICAgICAgICh1bmxlc3MgKHBhY2thZ2UtaW5zdGFsbGVkLXAgKHBhY2thZ2UtZGVzYy1uYW1lIHBr ZykpCiAgICAgICAgICAgICAgICAgICAgICAocGFja2FnZS1jb21wdXRlLXRyYW5zYWN0aW9uIChs aXN0IHBrZykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgKHBhY2thZ2UtZGVzYy1yZXFzIHBrZykpKQotICAgICAgICAgICAgICAgICAocGFja2FnZS1j b21wdXRlLXRyYW5zYWN0aW9uICgpIChsaXN0IChsaXN0IHBrZykpKSkpKQorICAgICAgICAgICAg ICAgICAodW5sZXNzIChwYWNrYWdlLWluc3RhbGxlZC1wIHBrZykKKyAgICAgICAgICAgICAgICAg ICAocGFja2FnZS1jb21wdXRlLXRyYW5zYWN0aW9uICgpIChsaXN0IChsaXN0IHBrZykpKSkpKSkK ICAgICAgICAgKHByb2duCiAgICAgICAgICAgKHBhY2thZ2UtZG93bmxvYWQtdHJhbnNhY3Rpb24g dHJhbnNhY3Rpb24pCiAgICAgICAgICAgKHBhY2thZ2UtLXF1aWNrc3RhcnQtbWF5YmUtcmVmcmVz aCkKICAgICAgICAg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LW5hbWUgcGtnLWRlc2MpCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhY2thZ2UtYWxpc3QpKSkpCisgICAgICAg ICAgKHdoZW4KKyAgICAgICAgICAgICAgKHktb3Itbi1wCisgICAgICAgICAgICAgICAoZm9ybWF0 LW1lc3NhZ2UKKyAgICAgICAgICAgICAgICAiUmVwbGFjZSBgJXMnIHdpdGggYCVzJz8gIgorICAg ICAgICAgICAgICAgIChwYWNrYWdlLWRlc2MtZnVsbC1uYW1lIGluc3RhbGxlZC1wa2ctZGVzYykK KyAgICAgICAgICAgICAgICAocGFja2FnZS1kZXNjLWZ1bGwtbmFtZSBwa2ctZGVzYykpKQorICAg ICAgICAgICAgKHBhY2thZ2UtZGVsZXRlIGluc3RhbGxlZC1wa2ctZGVzYyAnZm9yY2UgJ2RvbnQt dW5zZWxlY3QpCisgICAgICAgICAgICAod2hlbiAocGFja2FnZS1pbnN0YWxsIHBrZy1kZXNjIG5p bCkKKyAgICAgICAgICAgICAgKGRlc2NyaWJlLXBhY2thZ2UgKHBhY2thZ2UtZGVzYy1uYW1lIHBr Zy1kZXNjKSkpKSkKKyAgICAgICh3aGVuICh5LW9yLW4tcCAoZm9ybWF0LW1lc3NhZ2UgIkluc3Rh bGwgcGFja2FnZSBgJXMnPyAiCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IChwYWNrYWdlLWRlc2MtZnVsbC1uYW1lIHBrZy1kZXNjKSkpCisgICAgICAgICh3aGVuIChwYWNr YWdlLWluc3RhbGwgcGtnLWRlc2MgbmlsKQorICAgICAgICAgIChkZXNjcmliZS1wYWNrYWdlIChw YWNrYWdlLWRlc2MtbmFtZSBwa2ctZGVzYykpKSkpKSkKIAogKGRlZnVuIHBhY2thZ2UtZGVsZXRl LWJ1dHRvbi1hY3Rpb24gKGJ1dHRvbikKICAgIlJ1biBgcGFja2FnZS1kZWxldGUnIG9uIHRoZSBw YWNrYWdlIEJVVFRPTiB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Cgo= --0000000000000e17c3062fbefe8d-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 16 14:52:53 2025 Received: (at 76568) by debbugs.gnu.org; 16 Mar 2025 18:52:53 +0000 Received: from localhost ([127.0.0.1]:50716 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttt6T-0008Gh-9R for submit@debbugs.gnu.org; Sun, 16 Mar 2025 14:52:53 -0400 Received: from mail-ua1-x92a.google.com ([2607:f8b0:4864:20::92a]:48190) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ttt6Q-0008FH-DX for 76568@debbugs.gnu.org; Sun, 16 Mar 2025 14:52:52 -0400 Received: by mail-ua1-x92a.google.com with SMTP id a1e0cc1a2514c-86d42f08135so1481789241.0 for <76568@debbugs.gnu.org>; Sun, 16 Mar 2025 11:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742151164; x=1742755964; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=N5czE8b+5biur+yA2Le8/eQDz2Vk/46EDFlBFfTxe0I=; b=ltCzxN9h9R89YPRSATNQyfn8aOvHuHibp8kxfQvcUboJ8CClsaiaZAmd0KxBI0R175 AfJ3/L0pmISwIzpxGrPFR93VdQbX1XGBTcxKGkIKVwDTy3yUMJoJbMjzHwHLX2aFCWIP I3MUMjpztos/Q+Mzt75HXj36VTB9A3jkujQJZu6twD+Zp8zcFpxOtRKmHr7Iu9NaAcDx fLYalUUSMyygFLA+xcabucd2MxairJCvfBM00sKyWlOg1LUtfTtpqvZ0OwFj2kJAFXME 8npZJDMs5QpMtPgXUneNJEv2e8ENe+NNKqFoBJ2uilBu+tdpyhZoSuUDB2qk/z8aRkz3 EsZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742151164; x=1742755964; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=N5czE8b+5biur+yA2Le8/eQDz2Vk/46EDFlBFfTxe0I=; b=a9mTbCRj3Bq++sSDmzzC/L9Fw5Y5mGi/V5KjCP+fDC9P7300tPsG7B2xOxw6u1cpyw 49BkEzsS7Mc4RNk9d322IGoDr/hKF7Wp3/Y/Lr/qYeN41McpeHu+GWNd+/6J+xtuvGpm SQ1gdXZYrcNEiGJxe73tl/rQ2jqyhPul5U4BH+Q1MUzLpF9fZ2eoXRfP7OEACIOh8IEA urYTU3M2Q9MSrJjPqlzNc7HPXsCDZKALPrEewkA4zbFOvm+ZXlwKTK4dFD6Tp5AM299X mw2rV5a7bk4XXp+ZYJWL7LewFxEy9w63e94U/EVMClI5keVetDYmy3ob8KHmWTmvX8xb bsUA== X-Gm-Message-State: AOJu0YzjM78uBT1tWuycz/DwuC7TYx3NWV0eH+grVbEAkF3zTIj9OsIq c4YEVU+Wb0Rw1afSMOA8H824H4GiIHZ+8fWJ7gUTYEtF0hZbPDCO5gv8SR1lJnpk8aabT41V2Ux 6yYG00qkDCbrWKOrUIW24GGfU/kw= X-Gm-Gg: ASbGncvGEwccZ3AYHtOEFu43bWw77sURipecNe0g8p4MVw7hlyCAIiXZEvOeZbCERO9 /hlEaIqfizKgEdHVmFPChGGbqXSOTEN6dOda4Dfzhf9FCKUZp/HgohgtsTlmKCDZ5VPRNUncoRv Ag5sUrIRpQFCPHVElLYhx8cG7Ucg== X-Google-Smtp-Source: AGHT+IGX+6Bfg/0pPUXqfpLo72/15yR6Ws+LgyYIZeCUxS+P77ZKzzA/PCtO2M2a1z+53xEGNurf1mXY68MvGvZrlzI= X-Received: by 2002:a05:6102:3f50:b0:4bb:dba6:99cd with SMTP id ada2fe7eead31-4c38313ff97mr6580880137.8.1742151164601; Sun, 16 Mar 2025 11:52:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ship Mints Date: Sun, 16 Mar 2025 14:52:33 -0400 X-Gm-Features: AQ5f1JqWGsEnp46M0C3Styt8GfW8VZJkK7FllpP5t4mN8yF76Xd3c9k6ZYOLfVU Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Stefan Kangas Content-Type: multipart/alternative; boundary="0000000000004fae5606307a2dc2" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000004fae5606307a2dc2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Stefan, I see Philip and David working on package.el. It would be fruitful for them to do that on top of this patch. On Fri, Mar 7, 2025 at 6:33=E2=80=AFAM Ship Mints wro= te: > On Wed, Mar 5, 2025 at 4:05=E2=80=AFPM Ship Mints w= rote: > >> On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints = wrote: >> >>> On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints = wrote: >>> >>>> On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints wrote: >>>> >>>>> On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas >>>>> wrote: >>>>> >>>>>> Ship Mints writes: >>>>>> >>>>>> > 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 resul= t >>>>>> was that I had two of >>>>>> > each package installed. >>>>>> > >>>>>> > I think there's a bug in 'package-install' which, when invoked fro= m >>>>>> > 'package-install-button-action', processes the new package spec, >>>>>> and incorrectly checks to >>>>>> > see if the package is already installed. Interactive invocation o= f >>>>>> '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. >>>>>> >>>>>> Please submit a patch, but could we also have tests for this please? >>>>>> >>>>>> Thanks in advance. >>>>>> >>>>> >>>>> Patch attached. It prevents the menu-driven case from erasing the >>>>> already installed message. It could suggest to the user to remove an= d then >>>>> install or we could offer to use package upgrade to the chosen >>>>> package-desc. At the very least, the patch prevents duplicates. >>>>> >>>> >>>> Thinking about it a bit more, this patch needs a little more work. Th= e >>>> menu-driven package "upgrade" in describe-package-1 workflow will be i= nterrupted by >>>> this patch. It does not differentiate install vs. upgrade and calls >>>> package-install which will now complain the package already exists. T= his >>>> should be changed to run package-upgrade. I'll take a look. >>>> >>>> Any feedback on the minimal patch is still welcome in the meantime. >>>> >>> >>> This patch now accommodates both scenarios. >>> >> >> Now with an amended commit log. >> > > Attached patch with improved package replacement prompt. > --0000000000004fae5606307a2dc2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Stefan, I see Philip and David working on package.el.= =C2=A0 It would be fruitful for them to do that on top of this patch.
=

On Fri, Mar 7, 2025 at 6:33=E2=80=AFAM Ship Mints <= ;shipmints@gmail.com> wrote:<= br>
On Wed, Mar 5, 2025 at 4:05=E2=80=AFPM S= hip Mints <ship= mints@gmail.com> wrote:
On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mint= s <shipmints@gm= ail.com> wrote:
On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints <shipmints@gmail.com<= /a>> wrote:
On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints <shipmints@gmail.com&g= t; wrote:
On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas <stefankangas@gmail.com= > wrote:
Ship Mints <shipmints@gmail.com> writes:

> 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.=C2=A0 The resu= lt was that I had two of
> each package installed.
>
> I think there's a bug in 'package-install' which, when inv= oked from
> 'package-install-button-action', processes the new package spe= c, and incorrectly checks to
> see if the package is already installed.=C2=A0 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-ins= tall' behave like
> 'package-reinstall' for the non-interactive case.

Please submit a patch, but could we also have tests for this please?

Thanks in advance.

Patch attached.=C2=A0 It prevents the menu-driven case from era= sing the already installed message.=C2=A0 It could suggest to the user to r= emove and then install or we could offer to use package upgrade to the chos= en package-desc.=C2=A0 At the very least, the patch prevents duplicates.

Th= inking about it a bit more, this patch needs a little more work.=C2=A0=C2= =A0The menu-driven package "upgrade" in describe-package-1 workflow will be = interrupted=C2=A0by= this patch.=C2=A0 It does not differentiate install vs. upgrade and calls = package-install which will now complain the package already exists.=C2=A0 T= his should be changed to run package-upgrade.=C2=A0 I'll take a look.

Any feedback on the minimal patch is still welco= me in the meantime.

This patch now accommodates both s= cenarios.

Now with an amended commit log.

Attached patch with= improved package replacement prompt.
--0000000000004fae5606307a2dc2-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 20 10:41:44 2025 Received: (at 76568) by debbugs.gnu.org; 20 Mar 2025 14:41:44 +0000 Received: from localhost ([127.0.0.1]:58433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tvH5b-00024m-Gt for submit@debbugs.gnu.org; Thu, 20 Mar 2025 10:41:44 -0400 Received: from mail-vk1-xa2b.google.com ([2607:f8b0:4864:20::a2b]:49604) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tvH5X-00024V-MC for 76568@debbugs.gnu.org; Thu, 20 Mar 2025 10:41:40 -0400 Received: by mail-vk1-xa2b.google.com with SMTP id 71dfb90a1353d-523efb24fb9so409513e0c.3 for <76568@debbugs.gnu.org>; Thu, 20 Mar 2025 07:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742481694; x=1743086494; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uecFzm0yglSdXLL/EHY7u6PvM7mW1NK1PVAkZj6k9nw=; b=ULy43EuVyK6v4OqL9DpVO2k9NxRr31KJdK0QswqNKeRXWQjQrSnrKjMwEHXhYnrQx7 oufDVkRhYFRTCz2/EIhK2aFbK/5EVNmSrQ+yemU0T7fd+zineiRGtp09OxaG0L7EQnAY qHGtFTRyvLI8L8uYDXBo0sic18j6hGSKM0p/7JUi+HoOTl9vCOLE8G5mXrEf43dnwOJj 8YYlvzn1qHx05xkha742wSJu6b+QOVfhvJDdeLnmoklWWJgpqyJy0NKPkrqUI0fx/l4/ aFwBVF9uCncx5tEBoYBRzk8B87XrMMcPGDvY9FXKW48itqOv2fMrPorh0I+S3ohf14Li 45eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742481694; x=1743086494; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uecFzm0yglSdXLL/EHY7u6PvM7mW1NK1PVAkZj6k9nw=; b=VS+qL5At3g/nhOzi+q8byAZ4fnnJtMrQ8kJb27ldLtayqG7RMh5A3U23sdaEA4OiZ+ GbFp9sU96o2+AKG/0Q5D61MiP8r1AMt+z0KbYsX4dywZR97tSyKC9FV0bruyx73MIqLy 4Ciw8fYVALFu2RSpxoUMj3IixpKILLC9m9ayFPd/BS1AlTXqUXW/mLU9yez2MEBhG3E2 /8vbxMH/H3o1CJHpW5WYFi23m1TCct63dEKIITH+JGZp1svGfZsXdDtUn84wrm92fh2a sh0i7D7qClWAsQaTt+2O8e46A65gXuBelK2Je2LAHb8H90aJpWCO6fPtm6LGT3mKNltq fdOA== X-Gm-Message-State: AOJu0Yw2A39gCbfq3/zElXm+tn+TJs2DgnZ9hPB/UrTefcDHfuul2YKM KjAiseQK8Ob5aHoaW2R2yKnBfp3cN9i/Rl1K2RMnYGhyA/rlDyuwwgDHKUc/jhqXJJuFuyV22Cr +PK/QRYnThSyTppzkBTK4FgvROOk= X-Gm-Gg: ASbGncv2mrcCRfmiCgzF6ox0zbABTF0m6/lGLMvFr/LLDr8sdzWdOpnViJl6Kfdld67 rVZoi37cbAB310WCIxi32fFrkDd88kE5V0+7JoCRNgjP9qM55zTAf0OEL6vx2+5tv4mNt/btUYK DXzIl110xFpgl4PcXfLCyS9ZmCQg== X-Google-Smtp-Source: AGHT+IERlL4fSikmC250PbkY7nBOCD5FmXyjwZRE/M/VPhban52v/ccPd5MTt73PRze4Q7V/rDXhAYS/O1b2dKyET68= X-Received: by 2002:a05:6122:2487:b0:51f:fc9d:875d with SMTP id 71dfb90a1353d-52589218085mr5130867e0c.8.1742481693961; Thu, 20 Mar 2025 07:41:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ship Mints Date: Thu, 20 Mar 2025 10:41:22 -0400 X-Gm-Features: AQ5f1JqudTQoTBs_DcTOii5wmtFIiuFm057390wQF-_N8gMmfK313I7T_U4spQo Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Stefan Kangas Content-Type: multipart/mixed; boundary="000000000000659b370630c722e7" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000659b370630c722e7 Content-Type: multipart/alternative; boundary="000000000000659b350630c722e5" --000000000000659b350630c722e5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 7, 2025 at 6:33=E2=80=AFAM Ship Mints wro= te: > On Wed, Mar 5, 2025 at 4:05=E2=80=AFPM Ship Mints w= rote: > >> On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints = wrote: >> >>> On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints = wrote: >>> >>>> On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints wrote: >>>> >>>>> On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas >>>>> wrote: >>>>> >>>>>> Ship Mints writes: >>>>>> >>>>>> > 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 resul= t >>>>>> was that I had two of >>>>>> > each package installed. >>>>>> > >>>>>> > I think there's a bug in 'package-install' which, when invoked fro= m >>>>>> > 'package-install-button-action', processes the new package spec, >>>>>> and incorrectly checks to >>>>>> > see if the package is already installed. Interactive invocation o= f >>>>>> '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. >>>>>> >>>>>> Please submit a patch, but could we also have tests for this please? >>>>>> >>>>>> Thanks in advance. >>>>>> >>>>> >>>>> Patch attached. It prevents the menu-driven case from erasing the >>>>> already installed message. It could suggest to the user to remove an= d then >>>>> install or we could offer to use package upgrade to the chosen >>>>> package-desc. At the very least, the patch prevents duplicates. >>>>> >>>> >>>> Thinking about it a bit more, this patch needs a little more work. Th= e >>>> menu-driven package "upgrade" in describe-package-1 workflow will be i= nterrupted by >>>> this patch. It does not differentiate install vs. upgrade and calls >>>> package-install which will now complain the package already exists. T= his >>>> should be changed to run package-upgrade. I'll take a look. >>>> >>>> Any feedback on the minimal patch is still welcome in the meantime. >>>> >>> >>> This patch now accommodates both scenarios. >>> >> >> Now with an amended commit log. >> > > Attached patch with improved package replacement prompt. > Here's a refined version of the patch which allows users to optionally replace already-installed packages, or install/keep both. Testing this revealed some interesting other issues which may already be known. I'll see if I can find bug reports and if not I'll submit new ones. One example is that packages from different archives have incompatible version numbering schemes which causes false positives with the obsolete package detection mechanism. Another is that package-reinstall does not respect the originating archive, instead preferring package-archive-priorities which may install a different version than is expected by a user. Now might be a good time to consider that packages should be installed in archive-specific subdirectories rather than commingling them? I'd appreciate it if some others would look at this and test it. It might be adequate as a stop-gap for its intended purpose to avoid casual duplicate installs and some feedback would help. -Stephane --000000000000659b350630c722e5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Fri, Mar 7, 2025 at 6:33=E2=80=AFAM Ship Mints <shipmints@gmail.com> wrote:
On W= ed, Mar 5, 2025 at 4:05=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Wed, Mar = 5, 2025 at 4:02=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
= On Wed, Mar 5, 2025 = at 2:55=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Wed, Mar 5, 2025 at 12:00= =E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Mon, Mar 3, 2025 at 9:34=E2=80= =AFPM Stefan Kangas <stefankangas@gmail.com> wrote:
Ship Min= ts <shipmints@g= mail.com> writes:

> 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.=C2=A0 The resu= lt was that I had two of
> each package installed.
>
> I think there's a bug in 'package-install' which, when inv= oked from
> 'package-install-button-action', processes the new package spe= c, and incorrectly checks to
> see if the package is already installed.=C2=A0 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-ins= tall' behave like
> 'package-reinstall' for the non-interactive case.

Please submit a patch, but could we also have tests for this please?

Thanks in advance.

Patch attached.=C2=A0 It prevents the menu-driven case from era= sing the already installed message.=C2=A0 It could suggest to the user to r= emove and then install or we could offer to use package upgrade to the chos= en package-desc.=C2=A0 At the very least, the patch prevents duplicates.

Th= inking about it a bit more, this patch needs a little more work.=C2=A0=C2= =A0The menu-driven package "upgrade" in describe-package-1 workflow will be = interrupted=C2=A0by= this patch.=C2=A0 It does not differentiate install vs. upgrade and calls = package-install which will now complain the package already exists.=C2=A0 T= his should be changed to run package-upgrade.=C2=A0 I'll take a look.

Any feedback on the minimal patch is still welco= me in the meantime.

This patch now accommodates both s= cenarios.

Now with an amended commit log.

Attached patch with= improved package replacement prompt.
Here&#= 39;s a refined version of the patch which allows users to optionally replac= e already-installed packages, or install/keep both.

Testing this revealed some interesti= ng other issues which may already be known.=C2=A0 I'll see if I can fin= d bug reports and if not I'll submit new ones.=C2=A0 One example is tha= t packages from different archives have incompatible version numbering sche= mes which causes false positives with the obsolete package detection mechan= ism.=C2=A0 Another is that package-reinstall does not respect the originati= ng archive, instead preferring=C2=A0package-archive-priorities which may in= stall a different version than is expected by a user.=C2=A0 Now might be a = good time to consider that packages should be installed in archive-specific= subdirectories rather than commingling them?

I'd appreciate it if some others would= look at this and test it.=C2=A0 It might be adequate as a stop-gap for its= intended purpose to avoid casual duplicate installs and some feedback woul= d help.
<= br>
-Stephane=C2=A0<= /div>
--000000000000659b350630c722e5-- --000000000000659b370630c722e7 Content-Type: application/octet-stream; name="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Disposition: attachment; filename="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_m8hglarg0 RnJvbSA5ZGVlZTQ0OGUyN2Y5NGMyMTQ2OWU1OTY3N2ZkZTJjYmNlOGY5YmNkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOi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IHN0cnVjdHVyZS4KICAgICAgICAgICAgICAgIChpZiAocGFja2Fn ZS1kZXNjLXAgcGtnKQotICAgICAgICAgICAgICAgICAgICh1bmxlc3MgKHBhY2thZ2UtaW5zdGFs bGVkLXAgcGtnKQorICAgICAgICAgICAgICAgICAgICh1bmxlc3MgKGFuZCAobm90IGFsbG93LW11 bHQtb3ItcmVpbnN0YWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocGFja2Fn ZS1pbnN0YWxsZWQtcCAocGFja2FnZS1kZXNjLW5hbWUgcGtnKSkpCiAgICAgICAgICAgICAgICAg ICAgICAocGFja2FnZS1jb21wdXRlLXRyYW5zYWN0aW9uIChsaXN0IHBrZykKICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBhY2thZ2UtZGVzYy1yZXFz IHBrZykpKQotICAgICAgICAgICAgICAgICAocGFja2FnZS1jb21wdXRlLXRyYW5zYWN0aW9uICgp IChsaXN0IChsaXN0IHBrZykpKSkpKQorICAgICAgICAgICAgICAgICAodW5sZXNzIChhbmQgKG5v dCBhbGxvdy1tdWx0LW9yLXJlaW5zdGFsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IChwYWNrYWdlLWluc3RhbGxlZC1wIHBrZykpCisgICAgICAgICAgICAgICAgICAgKHBhY2thZ2Ut Y29tcHV0ZS10cmFuc2FjdGlvbiAoKSAobGlzdCAobGlzdCBwa2cpKSkpKSkpCiAgICAgICAgIChw cm9nbgogICAgICAgICAgIChwYWNrYWdlLWRvd25sb2FkLXRyYW5zYWN0aW9uIHRyYW5zYWN0aW9u KQogICAgICAgICAgIChwYWNrYWdlLS1xdWlja3N0YXJ0LW1heWJlLXJlZnJlc2gpCiAgICAgICAg ICAgKG1lc3NhZ2UgICJQYWNrYWdlIGAlcycgaW5zdGFsbGVkLiIgbmFtZSkpCi0gICAgICAobWVz c2FnZSAiYCVzJyBpcyBhbHJlYWR5IGluc3RhbGxl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3JpYmUt cGFja2FnZSAocGFja2FnZS1kZXNjLW5hbWUgcGtnLWRlc2MpKSkpKQorICAgIChpZiAocGFja2Fn ZS1pbnN0YWxsZWQtcCAocGFja2FnZS1kZXNjLW5hbWUgcGtnLWRlc2MpKQorICAgICAgICAobGV0 ICgoaW5zdGFsbGVkLXBrZy1kZXNjIChjYWRyIChhc3NxCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIChwYWNrYWdlLWRlc2MtbmFtZSBwa2ctZGVzYykKKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFja2FnZS1hbGlzdCkpKSkKKyAgICAg ICAgICAocGNhc2UgKGxldCAoKHJlYWQtYW5zd2VyLXNob3J0IHQpKQorICAgICAgICAgICAgICAg ICAgIChyZWFkLWFuc3dlcgorICAgICAgICAgICAgICAgICAgICAoZm9ybWF0LW1lc3NhZ2UKKyAg ICAgICAgICAgICAgICAgICAgICJSZXBsYWNlIGAlcycgd2l0aCBgJXMnLCBvciBJbnN0YWxsIGJv dGggKGFkdmFuY2VkIHVzZXJzKSAiCisgICAgICAgICAgICAgICAgICAgICAocGFja2FnZS1kZXNj LWZ1bGwtbmFtZSBpbnN0YWxsZWQtcGtnLWRlc2MpCisgICAgICAgICAgICAgICAgICAgICAocGFj a2FnZS1kZXNjLWZ1bGwtbmFtZSBwa2ctZGVzYykpCisgICAgICAgICAgICAgICAgICAgICcoKCJy ZXBsYWNlIiA/ciAiUmVwbGFjZSBleGlzdGluZyIpCisgICAgICAgICAgICAgICAgICAgICAgKCJp bnN0YWxsIiA/aSAiSW5zdGFsbCBib3RoIikKKyAgICAgICAgICAgICAgICAgICAgICAoImhlbHAi ID9oICJIZWxwIikKKyAgICAgICAgICAgICAgICAgICAgICAoInF1aXQiID9xICJRdWl0IHRvIGFi b3J0IikpKSkKKyAgICAgICAgICAgICgicmVwbGFjZSIKKyAgICAgICAgICAgICAocGFja2FnZS1k ZWxldGUgaW5zdGFs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lbWFjcy1saXNwL3BhY2thZ2UtdGVz dHMuZWwKKysrIGIvdGVzdC9saXNwL2VtYWNzLWxpc3AvcGFja2FnZS10ZXN0cy5lbApAQCAtMjQ4 LDYgKzI0OCwxMCBAQCBwYWNrYWdlLXRlc3QtaW5zdGFsbC1zaW5nbGUKICAgICAgIChzaG91bGQg KHN0cmluZy1tYXRjaCAiXltg4oCYJ11zaW1wbGUtc2luZ2xlW+KAmSddIGlzIGFscmVhZHkgaW5z dGFsbGVkXG4/XFwnIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIChidWZmZXItc3RyaW5n KSkpKQogICAgIChzaG91bGQgKHBhY2thZ2UtaW5zdGFsbGVkLXAgJ3NpbXBsZS1zaW5nbGUpKQor ICAgIDs7IFRlc3QgZm9yIGBwYWNrYWdlLWluc3RhbGwnIGFscmVhZHkgaW5zdGFsbGVkIHVzaW5n IGEKKyAgICA7OyBwYWNrYWdlLWRlc2MuICBgcGFja2FnZS1pbnN0YWxsJyByZXR1cm5zIG5pbCBp ZiBhbHJlYWR5CisgICAgOzsgaW5zdGFsbGVkLgorICAgIChzaG91bGQtbm90IChwYWNrYWdlLWlu c3RhbGwgc2ltcGxlLXNpbmdsZS1kZXNjKSkKICAgICAobGV0KiAoKHNpbXBsZS1wa2ctZGlyIChm aWxlLW5hbWUtYXMtZGlyZWN0b3J5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGV4cGFu ZC1maWxlLW5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInNpbXBsZS1zaW5nbGUt MS4zIgotLSAKMi40Ny4xCgo= --000000000000659b370630c722e7-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 10 07:35:47 2025 Received: (at 76568) by debbugs.gnu.org; 10 May 2025 11:35:47 +0000 Received: from localhost ([127.0.0.1]:44638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uDiUc-0001sv-Md for submit@debbugs.gnu.org; Sat, 10 May 2025 07:35:47 -0400 Received: from mail-ua1-x931.google.com ([2607:f8b0:4864:20::931]:51313) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uDiUa-0001sN-7D for 76568@debbugs.gnu.org; Sat, 10 May 2025 07:35:45 -0400 Received: by mail-ua1-x931.google.com with SMTP id a1e0cc1a2514c-87836f883e2so612878241.2 for <76568@debbugs.gnu.org>; Sat, 10 May 2025 04:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746876938; x=1747481738; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wfYA1x3b4N58z0KxoMaaXTnWNHna4av+OMZJD1AP6Ww=; b=LLeqjHabwGEKtd3J6u3z4yiWeqPEOSvKpolgeWxQ36e35dn3us0ywtpNAIJbeaCHOI DTSreH5Mu/Uz42DLtiuLM8HTu22Ybeb9i55Vnu/a+zMKT/SQ5RX8/z/gxxRg0xuMHWpM Pani1eHWxaRvM8QiKyemtGT04XxIm3ZC9x3BSI0qmTGKnz51JfVgNl0/LSPfSgvX/LO8 hoq04wJqbrega5xYkkRP8f9EOju2BukyAUE5yAKOsNw/AP+CLF5N7YEbnG6mogiB1tnu TACZLGQCbh45JlmZC2sbGZzgpuiBQrPnFuhoL8/2hVS85xP+u8nkcTBSmeJ8/11IHnvw gSig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746876938; x=1747481738; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wfYA1x3b4N58z0KxoMaaXTnWNHna4av+OMZJD1AP6Ww=; b=lij5QAe+nUQxHlLaZuraHx4tpdkllsZCSRjWFxRrP09b/wNL5gud5obfazcoYw7U5V rYhVNCIWqs8pLJlSsRVUOVBaPHIg8TV1pc35GBnfWqcRAABB7KZaEmMYNOOitVrgq5N4 aXWowkOUEfFjkBw3ckZWi0miobiQRR1WWBwY3n31ypz51fOPprGPVf3p7qKdwV/G0dcj ArWfhmS7TceU3Q+Uu4tymwjYmCoGyeRfoYUQo1PX8cEGBNifxLRWL1lTlbC0+ZTknztU s1IUye71EtkDviozs1Pj/fy6YSRjsXBmUY/io+V1cct4TAHRCJYyYmP0/CjbFEZ0H1ka Ldmg== X-Gm-Message-State: AOJu0YxIGkPhQELgp2YZBc3KpEK80qD2+NO8r0fIHkGqQu1JuspnwpC3 40YK5yJEK43OY2jh8/U4mMt7QL2TbQ/HFNgB6kVuvhK2clIJ2Ke+IzU2ecw2NPeOwcMV0wBBWkB YD7Qh/eooDVkQKOManRaxsDqcJ88= X-Gm-Gg: ASbGncvf/gOX0flvaTWCH90Et23O0FeyrkgPwLy1+QCL8y8/Mvwmi4II1ktUefqiFFh WwMM5YP4wV2VQxUiHYfRK05vL2+e5iriNDe3qjcLsJ2wfbIDSroJPsKT4sKrk+D78foeB/Tb552 NUyfo3WXe+povjlexydMwlX3b67KOS9ZdK X-Google-Smtp-Source: AGHT+IFYVrnc0gcXt/JEizgUWDDX65OW60qsvfTt90WZEaezVVa69Ls6qSUAbTnxsjaND0f2+XPjQCI/T8kPyt1j+cQ= X-Received: by 2002:a05:6102:2c02:b0:4c1:8e07:40b8 with SMTP id ada2fe7eead31-4deed351f3dmr5872164137.6.1746876938134; Sat, 10 May 2025 04:35:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ship Mints Date: Sat, 10 May 2025 07:35:27 -0400 X-Gm-Features: AX0GCFuxrKAj8xnySLSENGhGrG0aIr-J01AkZkxOjWi6FxCyBYnrmMF5KUumx6o Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Stefan Kangas Content-Type: multipart/alternative; boundary="0000000000005d2c470634c67b0c" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Eli Zaretskii , Philip Kaludercic X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000005d2c470634c67b0c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 20, 2025 at 10:41=E2=80=AFAM Ship Mints w= rote: > On Fri, Mar 7, 2025 at 6:33=E2=80=AFAM Ship Mints w= rote: > >> On Wed, Mar 5, 2025 at 4:05=E2=80=AFPM Ship Mints = wrote: >> >>> On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints = wrote: >>> >>>> On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints wrote: >>>> >>>>> On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints >>>>> wrote: >>>>> >>>>>> On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas >>>>>> wrote: >>>>>> >>>>>>> Ship Mints writes: >>>>>>> >>>>>>> > 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 fr= om >>>>>>> > '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. >>>>>>> >>>>>>> Please submit a patch, but could we also have tests for this please= ? >>>>>>> >>>>>>> Thanks in advance. >>>>>>> >>>>>> >>>>>> Patch attached. It prevents the menu-driven case from erasing the >>>>>> already installed message. It could suggest to the user to remove a= nd then >>>>>> install or we could offer to use package upgrade to the chosen >>>>>> package-desc. At the very least, the patch prevents duplicates. >>>>>> >>>>> >>>>> Thinking about it a bit more, this patch needs a little more work. T= he >>>>> menu-driven package "upgrade" in describe-package-1 workflow will be = interrupted by >>>>> this patch. It does not differentiate install vs. upgrade and calls >>>>> package-install which will now complain the package already exists. = This >>>>> should be changed to run package-upgrade. I'll take a look. >>>>> >>>>> Any feedback on the minimal patch is still welcome in the meantime. >>>>> >>>> >>>> This patch now accommodates both scenarios. >>>> >>> >>> Now with an amended commit log. >>> >> >> Attached patch with improved package replacement prompt. >> > > Here's a refined version of the patch which allows users to optionally > replace already-installed packages, or install/keep both. > > Testing this revealed some interesting other issues which may already be > known. I'll see if I can find bug reports and if not I'll submit new > ones. One example is that packages from different archives have > incompatible version numbering schemes which causes false positives with > the obsolete package detection mechanism. Another is that > package-reinstall does not respect the originating archive, instead > preferring package-archive-priorities which may install a different versi= on > than is expected by a user. Now might be a good time to consider that > packages should be installed in archive-specific subdirectories rather th= an > commingling them? > > I'd appreciate it if some others would look at this and test it. It migh= t > be adequate as a stop-gap for its intended purpose to avoid casual > duplicate installs and some feedback would help. > This bug/patch seems to have languished. It would be good to get it done. Duplicate installed packages are annoying to say the least. --0000000000005d2c470634c67b0c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Thu, Mar 20, 2025 at 10:41=E2=80=AFAM Ship Mints <shipmints@gmail.com> wrote:
On= Fri, Mar 7, 2025 at 6:33=E2=80=AFAM Ship Mints <shipmints@gmail.com> wrote:=
On Wed, Ma= r 5, 2025 at 4:05=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Wed, Mar 5, 202= 5 at 4:02=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Wed, Mar 5, 2025 at 2:5= 5=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Wed, Mar 5, 2025 at 12:00=E2= =80=AFPM Ship Mints <shipmints@gmail.com> wrote:
On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM= Stefan Kangas <stefankangas@gmail.com> wrote:
Ship Mints &l= t;shipmints@gmail.= com> writes:

> 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.=C2=A0 The resu= lt was that I had two of
> each package installed.
>
> I think there's a bug in 'package-install' which, when inv= oked from
> 'package-install-button-action', processes the new package spe= c, and incorrectly checks to
> see if the package is already installed.=C2=A0 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-ins= tall' behave like
> 'package-reinstall' for the non-interactive case.

Please submit a patch, but could we also have tests for this please?

Thanks in advance.

Patch attached.=C2=A0 It prevents the menu-driven case from era= sing the already installed message.=C2=A0 It could suggest to the user to r= emove and then install or we could offer to use package upgrade to the chos= en package-desc.=C2=A0 At the very least, the patch prevents duplicates.

Th= inking about it a bit more, this patch needs a little more work.=C2=A0=C2= =A0The menu-driven package "upgrade" in describe-package-1 workflow will be = interrupted=C2=A0by= this patch.=C2=A0 It does not differentiate install vs. upgrade and calls = package-install which will now complain the package already exists.=C2=A0 T= his should be changed to run package-upgrade.=C2=A0 I'll take a look.

Any feedback on the minimal patch is still welco= me in the meantime.

This patch now accommodates both s= cenarios.

Now with an amended commit log.

Attached patch with= improved package replacement prompt.
Here's a refined version o= f the patch which allows users to optionally replace already-installed pack= ages, or install/keep both.

<= /div>
Testing this revealed some intere= sting other issues which may already be known.=C2=A0 I'll see if I can = find bug reports and if not I'll submit new ones.=C2=A0 One example is = that packages from different archives have incompatible version numbering s= chemes which causes false positives with the obsolete package detection mec= hanism.=C2=A0 Another is that package-reinstall does not respect the origin= ating archive, instead preferring=C2=A0package-archive-priorities which may= install a different version than is expected by a user.=C2=A0 Now might be= a good time to consider that packages should be installed in archive-speci= fic subdirectories rather than commingling them?

I'd appr= eciate it if some others would look at this and test it.=C2=A0 It might be = adequate as a stop-gap for its intended purpose to avoid casual duplicate i= nstalls and some feedback would help.

Th= is bug/patch seems to have languished.=C2=A0 It would be good to get it don= e.=C2=A0 Duplicate installed packages are annoying to say the least.
<= /div> --0000000000005d2c470634c67b0c-- From debbugs-submit-bounces@debbugs.gnu.org Fri May 16 11:36:56 2025 Received: (at 76568) by debbugs.gnu.org; 16 May 2025 15:36:56 +0000 Received: from localhost ([127.0.0.1]:40153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uFx7H-0004gF-B9 for submit@debbugs.gnu.org; Fri, 16 May 2025 11:36:55 -0400 Received: from mout02.posteo.de ([185.67.36.66]:34845) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uFx7E-0004f8-Ir for 76568@debbugs.gnu.org; Fri, 16 May 2025 11:36:53 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7E7EF240103 for <76568@debbugs.gnu.org>; Fri, 16 May 2025 17:36:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1747409806; bh=3cXEAZ9UsPb0cjOyfhv6sq5b85CUAozVUqWHWgTkoq0=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=Z3DxLZeXe/mPJhnxrrQJ2YZ7RvQVpPTHzHfz4UGX5VhF87h57mkm8YN2lqbQtFm6n UEz5tyJyP8qPaXM1kTseN2uswsXrcPdZPFbddCMLjwTPOKiQjVo0NoKemtBx3r82IK 3yXrcZjw9Frrc40xOBG2Ro+3HjDiJE4z+V9Ob0I6yQM2hMIkX+MxMKw8pUnH8xl83m BVXqB7vMkUYXWN55EqfPzVg6f/YKlHr9ZAkXSagQOQIrwSVKeqhcj33oV3aBI3jEl3 6Awis4KtfNNXe3IMW7aEqYJ2ja7pJQRoqlN7yOewNOLUDJXsaPM45fWy7ThkNovo8p ZqCwD6vbEZ14g== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4ZzWQj2fX9z9rxS; Fri, 16 May 2025 17:36:45 +0200 (CEST) From: Philip Kaludercic To: Ship Mints Subject: Re: bug#76568: 'package-install' should not install duplicate packages In-Reply-To: References: 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 OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Date: Fri, 16 May 2025 15:36:44 +0000 Message-ID: <87h61kd0tv.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Eli Zaretskii , Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ship Mints writes: > On Thu, Mar 20, 2025 at 10:41=E2=80=AFAM Ship Mints = wrote: > >> On Fri, Mar 7, 2025 at 6:33=E2=80=AFAM Ship Mints = wrote: >> >>> On Wed, Mar 5, 2025 at 4:05=E2=80=AFPM Ship Mints = wrote: >>> >>>> On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints wrote: >>>> >>>>> On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints wrote: >>>>> >>>>>> On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints >>>>>> wrote: >>>>>> >>>>>>> On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas >>>>>>> wrote: >>>>>>> >>>>>>>> Ship Mints writes: >>>>>>>> >>>>>>>> > 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 f= rom >>>>>>>> > '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. >>>>>>>> >>>>>>>> Please submit a patch, but could we also have tests for this pleas= e? >>>>>>>> >>>>>>>> Thanks in advance. >>>>>>>> >>>>>>> >>>>>>> Patch attached. It prevents the menu-driven case from erasing the >>>>>>> already installed message. It could suggest to the user to remove = and then >>>>>>> install or we could offer to use package upgrade to the chosen >>>>>>> package-desc. At the very least, the patch prevents duplicates. >>>>>>> >>>>>> >>>>>> Thinking about it a bit more, this patch needs a little more work. = The >>>>>> menu-driven package "upgrade" in describe-package-1 workflow will be= interrupted by >>>>>> this patch. It does not differentiate install vs. upgrade and calls >>>>>> package-install which will now complain the package already exists. = This >>>>>> should be changed to run package-upgrade. I'll take a look. >>>>>> >>>>>> Any feedback on the minimal patch is still welcome in the meantime. >>>>>> >>>>> >>>>> This patch now accommodates both scenarios. >>>>> >>>> >>>> Now with an amended commit log. >>>> >>> >>> Attached patch with improved package replacement prompt. >>> >> >> Here's a refined version of the patch which allows users to optionally >> replace already-installed packages, or install/keep both. >> >> Testing this revealed some interesting other issues which may already be >> known. I'll see if I can find bug reports and if not I'll submit new >> ones. One example is that packages from different archives have >> incompatible version numbering schemes which causes false positives with >> the obsolete package detection mechanism. Another is that >> package-reinstall does not respect the originating archive, instead >> preferring package-archive-priorities which may install a different vers= ion >> than is expected by a user. Now might be a good time to consider that >> packages should be installed in archive-specific subdirectories rather t= han >> commingling them? >> >> I'd appreciate it if some others would look at this and test it. It mig= ht >> be adequate as a stop-gap for its intended purpose to avoid casual >> duplicate installs and some feedback would help. >> > > This bug/patch seems to have languished. It would be good to get it done. > Duplicate installed packages are annoying to say the least. Can you please summarise the relevant parts of this discussion? I see that a patch is being mentioned above, should I review it? From debbugs-submit-bounces@debbugs.gnu.org Fri May 16 11:42:51 2025 Received: (at 76568) by debbugs.gnu.org; 16 May 2025 15:42:52 +0000 Received: from localhost ([127.0.0.1]:40217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uFxCy-0005Rq-5p for submit@debbugs.gnu.org; Fri, 16 May 2025 11:42:51 -0400 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]:57613) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uFxCu-0005Qb-48 for 76568@debbugs.gnu.org; Fri, 16 May 2025 11:42:45 -0400 Received: by mail-vs1-xe2f.google.com with SMTP id ada2fe7eead31-4df85b07189so1457104137.3 for <76568@debbugs.gnu.org>; Fri, 16 May 2025 08:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747410158; x=1748014958; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ssTeKoF0YEKMBTl0oGlxoHnmpmdIKWL79GdEYFFgS9E=; b=N1zbSCrdZrj9CYMg3XfpsxJvzG2lpUwXJyZ3ZcBBKoN23eq4VYJjiAWFDfRcNzTa+a 7odHrjMYjRIPPfPkir3EKps4db1nylnInQenIty/tfGKr2bTyoQznjsvGNF1NSOqIcgD ZxBwx8uQYTA9ZYTD3cbNWkyYWAw2ajD5sUnaXiZZOerbXBfl9rGI9mIQ8urcHnT16kSm 0ImVscR8NQBswHxIaJY5LP3CKZ1fRH+bt5gupT/TzwLK0IpSX97YEWwh0bsXpo8cfKIK 17QrUtURcSbMUiiky90/E47f2BUqPUxRpafDVJFPNsl7hbqRPgRIZckIg2GaptBYJ45L aKBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747410158; x=1748014958; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ssTeKoF0YEKMBTl0oGlxoHnmpmdIKWL79GdEYFFgS9E=; b=M8PpGxt7awJ8IGjA8FVeY6Yrm1Ooyrtqwm6deLDBN3gnmAM7jvSE9yUwK2A1t33Okp i7P2M1vEd/i4o0QPPE7Ck+pOc7AFnhBN11JbGfIPlke/smjbO3QqVPaQiZxMz0kZpU9p vItcSTuCoVp98czwNGmDKuvLCXAYj0K5caY54cwX4YDrR80/14u8A62Z57tmZtSRZLNU fvqrdgoMU6iH3FbrSnVXZCqrX7fwo4JHFcqXOSscnMApbb/aK1B+jFH8R8IZUV1R1zQD VTtcLVeno2c4CKfTzS/W1GryWbxA4w5Ynryw7vAfdld4xFA18cKzQy6aYi4JYmHqGMML sabA== X-Forwarded-Encrypted: i=1; AJvYcCWpJjCMxVSxwkGUYIFZnuQtRJt1wuOd1mS9ZgQJ6YrVYgiwqdg46MiBNpeuIURzkvMfKZM3vg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxMkME8wUjPUVMfbD/fS8BxOE0BufqxM70C1WIzfI2fMQuadVaZ inOvHiPbJQT82o2UuX0B9ABcPmMarVDhf/NSyqBcBfDqYTitYJZ9kmjkdX2+lPcF/RxjWbIQX5b Lr6hGo0pmtiHgnDPrgwEuxepyvTrLwQA= X-Gm-Gg: ASbGnct0LE8QxzTKHZEm7ieL9gDW+3UBhWUb41sUiCdcgc4p4wKIFC+ZDsqtorceSHQ AyTUn9Jbifqxo1MA48Nrx+h7eZsx8CjyvWJpjYktn7oj4TXqxYh1neDyFg9YaIUSwHeHxZLbUbk Yulox20rLWSzZcnFEY40GpbuL64ApL1l5qM8/dzvuMNhq0FA== X-Google-Smtp-Source: AGHT+IEyUCDkZeh8w54k+EC7J1sTh5TYv7EZ2gqk676WVlJbywUo5dBIGhPcLBGf7Wz4+5XbcM4Mo/5s9Vbyu8XMEn0= X-Received: by 2002:a05:6102:14a1:b0:4df:a58d:9db2 with SMTP id ada2fe7eead31-4dfa6b586f8mr5737410137.9.1747410158320; Fri, 16 May 2025 08:42:38 -0700 (PDT) MIME-Version: 1.0 References: <87h61kd0tv.fsf@posteo.net> In-Reply-To: <87h61kd0tv.fsf@posteo.net> From: Ship Mints Date: Fri, 16 May 2025 11:42:26 -0400 X-Gm-Features: AX0GCFsW5hm_UA_Cl4jmBrfRkdUWkmwufApAVVYynJ6OOU8WrfDvp20yfA1AlJE Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Philip Kaludercic Content-Type: multipart/mixed; boundary="000000000000c39f40063542a160" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Eli Zaretskii , Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000c39f40063542a160 Content-Type: multipart/alternative; boundary="000000000000c39f3f063542a15e" --000000000000c39f3f063542a15e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 16, 2025 at 11:36=E2=80=AFAM Philip Kaludercic wrote: > Ship Mints writes: > > > On Thu, Mar 20, 2025 at 10:41=E2=80=AFAM Ship Mints wrote: > > > >> On Fri, Mar 7, 2025 at 6:33=E2=80=AFAM Ship Mints wrote: > >> > >>> On Wed, Mar 5, 2025 at 4:05=E2=80=AFPM Ship Mints wrote: > >>> > >>>> On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints > wrote: > >>>> > >>>>> On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints > wrote: > >>>>> > >>>>>> On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints > >>>>>> wrote: > >>>>>> > >>>>>>> On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan Kangas < > stefankangas@gmail.com> > >>>>>>> wrote: > >>>>>>> > >>>>>>>> Ship Mints writes: > >>>>>>>> > >>>>>>>> > 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 an= d > >>>>>>>> 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 spe= c, > >>>>>>>> and incorrectly checks to > >>>>>>>> > see if the package is already installed. Interactive invocati= on > >>>>>>>> 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. > >>>>>>>> > >>>>>>>> Please submit a patch, but could we also have tests for this > please? > >>>>>>>> > >>>>>>>> Thanks in advance. > >>>>>>>> > >>>>>>> > >>>>>>> Patch attached. It prevents the menu-driven case from erasing th= e > >>>>>>> already installed message. It could suggest to the user to remov= e > and then > >>>>>>> install or we could offer to use package upgrade to the chosen > >>>>>>> package-desc. At the very least, the patch prevents duplicates. > >>>>>>> > >>>>>> > >>>>>> Thinking about it a bit more, this patch needs a little more work. > The > >>>>>> menu-driven package "upgrade" in describe-package-1 workflow will > be interrupted by > >>>>>> this patch. It does not differentiate install vs. upgrade and cal= ls > >>>>>> package-install which will now complain the package already > exists. This > >>>>>> should be changed to run package-upgrade. I'll take a look. > >>>>>> > >>>>>> Any feedback on the minimal patch is still welcome in the meantime= . > >>>>>> > >>>>> > >>>>> This patch now accommodates both scenarios. > >>>>> > >>>> > >>>> Now with an amended commit log. > >>>> > >>> > >>> Attached patch with improved package replacement prompt. > >>> > >> > >> Here's a refined version of the patch which allows users to optionally > >> replace already-installed packages, or install/keep both. > >> > >> Testing this revealed some interesting other issues which may already = be > >> known. I'll see if I can find bug reports and if not I'll submit new > >> ones. One example is that packages from different archives have > >> incompatible version numbering schemes which causes false positives wi= th > >> the obsolete package detection mechanism. Another is that > >> package-reinstall does not respect the originating archive, instead > >> preferring package-archive-priorities which may install a different > version > >> than is expected by a user. Now might be a good time to consider that > >> packages should be installed in archive-specific subdirectories rather > than > >> commingling them? > >> > >> I'd appreciate it if some others would look at this and test it. It > might > >> be adequate as a stop-gap for its intended purpose to avoid casual > >> duplicate installs and some feedback would help. > >> > > > > This bug/patch seems to have languished. It would be good to get it > done. > > Duplicate installed packages are annoying to say the least. > > Can you please summarise the relevant parts of this discussion? I see > that a patch is being mentioned above, should I review it? > The latest version of this patch from this discussion is attached. It amends both the menu-driven package upgrade and the package-upgrade command to assist the user with avoiding (or permitting) installing a package more than once. I introduced "tangents" in the discussion along the way as I learned more about the package infrastructure: "Testing this revealed some interesting other issues which may already be known. I'll see if I can find bug reports and if not I'll submit new ones. One example is that packages from different archives have incompatible version numbering schemes which causes false positives with the obsolete package detection mechanism. Another is that package-reinstall does not respect the originating archive, instead preferring package-archive-priorities which may install a different version than is expected by a user. Now might be a good time to consider that packages should be installed in archive-specific subdirectories rather than commingling them?" -Stephane --000000000000c39f3f063542a15e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Fri, May 16, 2025 at 11:36=E2=80=AFAM Philip Kaludercic <philipk@posteo.net> wrote:
Ship Mints <shipmints@gmail.com> writes:

> On Thu, Mar 20, 2025 at 10:41=E2=80=AFAM Ship Mints <shipmints@gmail.com> wrot= e:
>
>> On Fri, Mar 7, 2025 at 6:33=E2=80=AFAM Ship Mints <shipmints@gmail.com> wr= ote:
>>
>>> On Wed, Mar 5, 2025 at 4:05=E2=80=AFPM Ship Mints <shipmints@gmail.com&g= t; wrote:
>>>
>>>> On Wed, Mar 5, 2025 at 4:02=E2=80=AFPM Ship Mints <shipmints@gmail.com> wrote:
>>>>
>>>>> On Wed, Mar 5, 2025 at 2:55=E2=80=AFPM Ship Mints <=
shipmints@gmail.co= m> wrote:
>>>>>
>>>>>> On Wed, Mar 5, 2025 at 12:00=E2=80=AFPM Ship Mints= <shipmints@gma= il.com>
>>>>>> wrote:
>>>>>>
>>>>>>> On Mon, Mar 3, 2025 at 9:34=E2=80=AFPM Stefan = Kangas <stef= ankangas@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Ship Mints <shipmints@gmail.com> writes:
>>>>>>>>
>>>>>>>> > As part of my production upgrade to 3= 0.1, and before I wrote a
>>>>>>>> program to install my local
>>>>>>>> > ELPA tree from scratch, I tried to fi= rst curate my packages and
>>>>>>>> change from MELPA to
>>>>>>>> > generally equivalent GNU ELPA or non-= GNU ELPA archives.=C2=A0 The
>>>>>>>> result was that I had two of
>>>>>>>> > each package installed.
>>>>>>>> >
>>>>>>>> > I think there's a bug in 'pac= kage-install' which, when invoked from
>>>>>>>> > 'package-install-button-action= 9;, processes the new package spec,
>>>>>>>> and incorrectly checks to
>>>>>>>> > see if the package is already install= ed.=C2=A0 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 n= on-interactive case.
>>>>>>>>
>>>>>>>> Please submit a patch, but could we also h= ave tests for this please?
>>>>>>>>
>>>>>>>> Thanks in advance.
>>>>>>>>
>>>>>>>
>>>>>>> Patch attached.=C2=A0 It prevents the menu-dri= ven case from erasing the
>>>>>>> already installed message.=C2=A0 It could sugg= est to the user to remove and then
>>>>>>> install or we could offer to use package upgra= de to the chosen
>>>>>>> package-desc.=C2=A0 At the very least, the pat= ch prevents duplicates.
>>>>>>>
>>>>>>
>>>>>> Thinking about it a bit more, this patch needs a l= ittle more work.=C2=A0 The
>>>>>> menu-driven package "upgrade" in describ= e-package-1 workflow will be interrupted by
>>>>>> this patch.=C2=A0 It does not differentiate instal= l vs. upgrade and calls
>>>>>> package-install which will now complain the packag= e already exists.=C2=A0 This
>>>>>> should be changed to run package-upgrade.=C2=A0 I&= #39;ll take a look.
>>>>>>
>>>>>> Any feedback on the minimal patch is still welcome= in the meantime.
>>>>>>
>>>>>
>>>>> This patch now accommodates both scenarios.
>>>>>
>>>>
>>>> Now with an amended commit log.
>>>>
>>>
>>> Attached patch with improved package replacement prompt.
>>>
>>
>> Here's a refined version of the patch which allows users to op= tionally
>> replace already-installed packages, or install/keep both.
>>
>> Testing this revealed some interesting other issues which may alre= ady be
>> known.=C2=A0 I'll see if I can find bug reports and if not I&#= 39;ll submit new
>> ones.=C2=A0 One example is that packages from different archives h= ave
>> incompatible version numbering schemes which causes false positive= s with
>> the obsolete package detection mechanism.=C2=A0 Another is that >> package-reinstall does not respect the originating archive, instea= d
>> preferring package-archive-priorities which may install a differen= t version
>> than is expected by a user.=C2=A0 Now might be a good time to cons= ider that
>> packages should be installed in archive-specific subdirectories ra= ther than
>> commingling them?
>>
>> I'd appreciate it if some others would look at this and test i= t.=C2=A0 It might
>> be adequate as a stop-gap for its intended purpose to avoid casual=
>> duplicate installs and some feedback would help.
>>
>
> This bug/patch seems to have languished.=C2=A0 It would be good to get= it done.
> Duplicate installed packages are annoying to say the least.

Can you please summarise the relevant parts of this discussion?=C2=A0 I see=
that a patch is being mentioned above, should I review it?
=

The latest version of this patch from this discussion is attached.=C2=A0 I= t amends both the menu-driven package upgrade and the package-upgrade comma= nd to assist the user with avoiding (or permitting) installing a package mo= re than once.

I introduced "tangents" in the discussion along the way as I lea= rned more about the package infrastructure:

"Testing this revealed some interesting= other issues which may already be known.=C2=A0 I'll see if I can find = bug reports and if not I'll submit new ones.=C2=A0 One example is that = packages from different archives have incompatible version numbering scheme= s which causes false positives with the obsolete package detection mechanis= m.=C2=A0 Another is that package-reinstall does not respect the originating= archive, instead preferring=C2=A0package-archive-priorities which may inst= all a different version than is expected by a user.=C2=A0 Now might be a go= od time to consider that packages should be installed in archive-specific s= ubdirectories rather than commingling them?"

-Stephane
--000000000000c39f3f063542a15e-- --000000000000c39f40063542a160 Content-Type: application/octet-stream; name="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Disposition: attachment; filename="0001-Correct-package-install-to-detect-installed-packages.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_maqyrmoo0 RnJvbSA5ZGVlZTQ0OGUyN2Y5NGMyMTQ2OWU1OTY3N2ZkZTJjYmNlOGY5YmNkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBzaGlwbWludHMgPHNoaXBtaW50c0BnbWFpbC5jb20+CkRhdGU6 IFdlZCwgNSBNYXIgMjAyNSAxMTozMzowNyAtMDUwMApTdWJqZWN0OiBbUEFUQ0hdIENvcnJlY3Qg J3BhY2thZ2UtaW5zdGFsbCcgdG8gZGV0ZWN0IGluc3RhbGxlZCBwYWNrYWdlcwogKGJ1ZyM3NjU2 OCkKCiogbGlzcC9lbWFjcy1saXNwL3BhY2thZ2UuZWwKKHBhY2thZ2UtaW5zdGFsbCk6IENoZWNr IGZvciBhbHJlYWR5IGluc3RhbGxlZCBwYWNrYWdlIHVzaW5nIGl0cyBzeW1ib2wKcmF0aGVyIHRo YW4gcmVseSBvbiBkaWZmZXJpbmcgYXJjaGl2ZSBkaXJlY3Rvcnkgc3RydWN0dXJlcy4gIFJldHVy biB0IGlmCmluc3RhbGxlZCwgbmlsIG90aGVyd2lzZS4KKHBhY2thZ2UtaW5zdGFsbC1idXR0b24t YWN0aW9uKTogJ2Rlc2NyaWJlLXBhY2thZ2UnIG9ubHkgd2hlbgoncGFja2FnZS1pbnN0YWxsJyBh Y3R1YWxseSBpbnN0YWxsZWQgdGhlIHBhY2thZ2UuICBQcm9tcHQgdGhlIHVzZXIgdG8KaW5zdGFs bCBvciB1cGdyYWRlIGFuIGFscmVhZHkgaW5zdGFsbGVkIHBhY2thZ2UuCiogdGVzdC9saXNwL2Vt YWNzLWxpc3AvcGFja2FnZS10ZXN0cy5lbCAocGFja2FnZS10ZXN0LWluc3RhbGwtc2luZ2xlKToK QWRkIGFscmVhZHktaW5zdGFsbGVkIHRlc3QgdXNpbmcgJ3BhY2thZ2UtaW5zdGFsb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WxldCogKCh0 cmFuc2FjdGlvbgorICAgICAgICAgICAgICAgOzsgVGVzdCBmb3IgYWxyZWFkeSBpbnN0YWxsZWQg dXNpbmcgdGhlIHBrZyBzeW1ib2wsIG5vdAorICAgICAgICAgICAgICAgOzsgdGhlIGFyY2hpdmUt c3BlY2lmaWMgZGlyZWN0b3J5IHN0cnVjdHVyZS4KICAgICAgICAgICAgICAgIChpZiAocGFja2Fn ZS1kZXNjLXAgcGtnKQotICAgICAgICAgICAgICAgICAgICh1bmxlc3MgKHBhY2thZ2UtaW5zdGFs bGVkLXAgcGtnKQorICAgICAgICAgICAgICAgICAgICh1bmxlc3MgKGFuZCAobm90IGFsbG93LW11 bHQtb3ItcmVpbnN0YWxsKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocGFja2Fn ZS1pbnN0YWxsZWQtcCAocGFja2FnZS1kZXNjLW5hbWUgcGtnKSkpCiAgICAgICAgICAgICAgICAg ICAgICAocGFja2FnZS1jb21wdXRlLXRyYW5zYWN0aW9uIChsaXN0IHBrZykKICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHBhY2thZ2UtZGVzYy1yZXFz IHBrZykpKQotICAgICAgICAgICAgICAgICAocGFja2FnZS1jb21wdXRlLXRyYW5zYWN0aW9uICgp IChsaXN0IChsaXN0IHBrZykpKSkpKQorICAgICAgICAgICAgICAgICAodW5sZXNzIChhbmQgKG5v dCBhbGxvdy1tdWx0LW9yLXJlaW5zdGFsbCkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IChwYWNrYWdlLWluc3RhbGxlZC1wIHBrZykpCisgICAgICAgICAgICAgICAgICAgKHBhY2thZ2Ut Y29tcHV0ZS10cmFuc2FjdGlvbiAoKSAobGlzdCAobGlzdCBwa2cpKSkpKSkpCiAgICAgICAgIChw cm9nbgogICAgICAgICAgIChwYWNrYWdlLWRvd25sb2FkLXRyYW5zYWN0aW9uIHRyYW5zYWN0aW9u KQogICA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c3RhbGwgcGFja2FnZSBgJXMnPyAiCi0gICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAocGFja2FnZS1kZXNjLWZ1bGwtbmFtZSBwa2ctZGVzYykp KQotICAgICAgKHBhY2thZ2UtaW5zdGFsbCBwa2ctZGVzYyBuaWwpCi0gICAgICAoZGVzY3JpYmUt cGFja2FnZSAocGFja2FnZS1kZXNjLW5hbWUgcGtnLWRlc2MpKSkpKQorICAgIChpZiAocGFja2Fn ZS1pbnN0YWxsZWQtcCAocGFja2FnZS1kZXNjLW5hbWUgcGtnLWRlc2MpKQorICAgICAgICAobGV0 ICgoaW5zdGFsbGVkLXBrZy1kZXNjIChjYWRyIChhc3NxCisgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIChwYWNrYWdlLWRlc2MtbmFtZSBwa2ctZGVzYykKKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFja2FnZS1hbGlzdCkpKSkKKyAgICAg ICAgICAocGNhc2UgKGxldCAoKHJlYWQtYW5zd2VyLXNob3J0IHQpKQorICAgICAgICAgICAgICAg ICAgIChyZWFkLWFuc3dlcgorICAgICAgICAgICAgICAgICAgICAoZm9ybWF0LW1lc3NhZ2UKKyAg ICAgICAgICAgICAgICAgICAgICJSZXBsYWNlIGAlcycgd2l0aCBgJXMnLCBvciBJbnN0YWxsIGJv dGggKGFkdmFuY2VkIHVzZXJzKSAiCisgICAgICAgICAgICAgICAgICAgICAocGFja2FnZS1kZXNj LWZ1bGwtbmFtZSBpbnN0YWxsZWQtcGtnLWRlc2MpCisgICAgICAgICAgICAgICAgICAgICAocGFj a2FnZS1kZXNjLWZ1bGwtbmFtZSBwa2ctZGVzYykpCisgICAgICAgICAgICAgICAgICAgICcoKCJy ZXBsYWNlIiA/ciAiUmVwbGFjZSBleGlzdGluZyIpCisgICAgICAgICAgICAgICAgICAgICAgKCJp bnN0YWxsIiA/aSAiSW5zdGFsbCBib3RoIikKKyAgICAgICAgICAgICAgICAgICAgICAoImhlbHAi ID9oICJIZWxwIikKKyAgICAgICAgICAgICAgICAgICAgICAoInF1aXQiID9xICJRdWl0IHRvIGFi b3J0IikpKSkKKyAgICAgICAgICAgICgicmVwbGFjZSIKKyAgICAgICAgICAgICAocGFja2FnZS1k ZWxldGUgaW5zdGFsbGVkLXBrZy1kZXNjICdmb3JjZSAnZG9udC11bnNlbGVjdCkKKyAgICAgICAg ICAgICAod2hlbiAocGFja2FnZS1pbnN0YWxsIHBrZy1kZXNjIG5pbCkKKyAgICAgICAgICAgICAg IChkZXNjcmliZS1wYWNrYWdlIChwYWNrYWdlLWRlc2MtbmFtZSBwa2ctZGVzYykpKSkKKyAgICAg ICAgICAgICgiaW5zdGFsbCIKKyAgICAgICAgICAgICAod2hlbiAocGFja2FnZS1pbnN0YWxsIHBr Zy1kZXNjIG5pbCAnYWxsb3ctbXVsdC1vci1yZWluc3RhbGwpCisgICAgICAgICAgICAgICAoZGVz Y3JpYmUtcGFja2FnZSAocGFja2FnZS1kZXNjLW5hbWUgcGtnLWRlc2MpKSkpKSkKKyAgICAgICh3 aGVuICh5LW9yLW4tcCAoZm9ybWF0LW1lc3NhZ2UgIkluc3RhbGwgcGFja2FnZSBgJXMnPyAiCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChwYWNrYWdlLWRlc2MtZnVsbC1u YW1lIHBrZy1kZXNjKSkpCisgICAgICAgICh3aGVuIChwYWNrYWdlLWluc3RhbGwgcGtnLWRlc2Mg bmlsKQorICAgICAgICAgIChkZXNjcmliZS1wYWNrYWdlIChwYWNrYWdlLWRlc2MtbmFtZSBwa2ct ZGVzYykpKSkpKSkKIAogKGRlZnVuIHBhY2thZ2UtZGVsZXRlLWJ1dHRvbi1hY3Rpb24gKGJ1dHRv bikKICAgIlJ1biBgcGFja2FnZS1kZWxldGUnIG9uIHRoZSBwYWNrYWdlIEJVVFRPTiBwb2ludHMg dG8uCmRpZmYgLS1naXQgYS90ZXN0L2xpc3AvZW1hY3MtbGlzcC9wYWNrYWdlLXRlc3RzLmVsIGIv dGVzdC9saXNwL2VtYWNzLWxpc3AvcGFja2FnZS10ZXN0cy5lbAppbmRleCBkOGUyNjAzMTliZC4u MzY2MTdlZDZmNmUgMTAwNjQ0Ci0tLSBhL3Rlc3QvbGlzcC9lbWFjcy1saXNwL3BhY2thZ2UtdGVz dHMuZWwKKysrIGIvdGVzdC9saXNwL2VtYWNzLWxpc3AvcGFja2FnZS10ZXN0cy5lbApAQCAtMjQ4 LDYgKzI0OCwxMCBAQCBwYWNrYWdlLXRlc3QtaW5zdGFsbC1zaW5nbGUKICAgICAgIChzaG91bGQg KHN0cmluZy1tYXRjaCAiXltg4oCYJ11zaW1wbGUtc2luZ2xlW+KAmSddIGlzIGFscmVhZHkgaW5z dGFsbGVkXG4/XFwnIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgIChidWZmZXItc3RyaW5n KSkpKQogICAgIChzaG91bGQgKHBhY2thZ2UtaW5zdGFsbGVkLXAgJ3NpbXBsZS1zaW5nbGUpKQor ICAgIDs7IFRlc3QgZm9yIGBwYWNrYWdlLWluc3RhbGwnIGFscmVhZHkgaW5zdGFsbGVkIHVzaW5n IGEKKyAgICA7OyBwYWNrYWdlLWRlc2MuICBgcGFja2FnZS1pbnN0YWxsJyByZXR1cm5zIG5pbCBp ZiBhbHJlYWR5CisgICAgOzsgaW5zdGFsbGVkLgorICAgIChzaG91bGQtbm90IChwYWNrYWdlLWlu c3RhbGwgc2ltcGxlLXNpbmdsZS1kZXNjKSkKICAgICAobGV0KiAoKHNpbXBsZS1wa2ctZGlyIChm aWxlLW5hbWUtYXMtZGlyZWN0b3J5CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGV4cGFu ZC1maWxlLW5hbWUKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInNpbXBsZS1zaW5nbGUt MS4zIgotLSAKMi40Ny4xCgo= --000000000000c39f40063542a160-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 24 05:13:29 2025 Received: (at 76568) by debbugs.gnu.org; 24 May 2025 09:13:29 +0000 Received: from localhost ([127.0.0.1]:57023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uIkwb-00085L-3v for submit@debbugs.gnu.org; Sat, 24 May 2025 05:13:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33980) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uIkwY-00084q-L4 for 76568@debbugs.gnu.org; Sat, 24 May 2025 05:13:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uIkwT-0001a4-41; Sat, 24 May 2025 05:13:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=vXixUiZM7OcRBhfBL2HEz/UxGJRTgQFDkXhdEFkRX20=; b=WHLZJVXuqY+URyGjJ8mu 17RaRPwRYi3vunQDiprw54jV+b1GW1h0SfVcibrnglNCuJfb6yTWFEwW3w590H4SF/VylEN/UkglK o43Hpe2qyf+2hMsLNtsOc2aouGRI92QiBFIytIozjduxGEspa380ZSkk4jj1z9CIOE+HVsS2q/DY9 /vm5WaqgitlPLBR1sAK52fgKLMqytwC2dO81lDrogRfanyyB1Yhv1Fz5L8jqd2nzcuPWO09ixOGs+ yShtyzO3MLVCoW8F5pMnIDHtuQSVvIsyIITAD2Q2JcAy3fsNwgzDv/OJ7BvFAefZIUQNbCEmqbFub 9hnaYX8zEi8idw==; Date: Sat, 24 May 2025 12:13:19 +0300 Message-Id: <86r00e1ids.fsf@gnu.org> From: Eli Zaretskii To: philipk@posteo.net, Ship Mints In-Reply-To: (message from Ship Mints on Fri, 16 May 2025 11:42:26 -0400) Subject: Re: bug#76568: 'package-install' should not install duplicate packages References: <87h61kd0tv.fsf@posteo.net> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! Can we make some further progress in this matter? > From: Ship Mints > Date: Fri, 16 May 2025 11:42:26 -0400 > Cc: Stefan Kangas , 76568@debbugs.gnu.org, > Eli Zaretskii > > On Fri, May 16, 2025 at 11:36 AM Philip Kaludercic wrote: > > Ship Mints writes: > > > On Thu, Mar 20, 2025 at 10:41 AM Ship Mints wrote: > > > >> On Fri, Mar 7, 2025 at 6:33 AM Ship Mints wrote: > >> > >>> On Wed, Mar 5, 2025 at 4:05 PM Ship Mints wrote: > >>> > >>>> On Wed, Mar 5, 2025 at 4:02 PM Ship Mints wrote: > >>>> > >>>>> On Wed, Mar 5, 2025 at 2:55 PM Ship Mints wrote: > >>>>> > >>>>>> On Wed, Mar 5, 2025 at 12:00 PM Ship Mints > >>>>>> wrote: > >>>>>> > >>>>>>> On Mon, Mar 3, 2025 at 9:34 PM Stefan Kangas > >>>>>>> wrote: > >>>>>>> > >>>>>>>> Ship Mints writes: > >>>>>>>> > >>>>>>>> > 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. > >>>>>>>> > >>>>>>>> Please submit a patch, but could we also have tests for this please? > >>>>>>>> > >>>>>>>> Thanks in advance. > >>>>>>>> > >>>>>>> > >>>>>>> Patch attached. It prevents the menu-driven case from erasing the > >>>>>>> already installed message. It could suggest to the user to remove and then > >>>>>>> install or we could offer to use package upgrade to the chosen > >>>>>>> package-desc. At the very least, the patch prevents duplicates. > >>>>>>> > >>>>>> > >>>>>> Thinking about it a bit more, this patch needs a little more work. The > >>>>>> menu-driven package "upgrade" in describe-package-1 workflow will be interrupted by > >>>>>> this patch. It does not differentiate install vs. upgrade and calls > >>>>>> package-install which will now complain the package already exists. This > >>>>>> should be changed to run package-upgrade. I'll take a look. > >>>>>> > >>>>>> Any feedback on the minimal patch is still welcome in the meantime. > >>>>>> > >>>>> > >>>>> This patch now accommodates both scenarios. > >>>>> > >>>> > >>>> Now with an amended commit log. > >>>> > >>> > >>> Attached patch with improved package replacement prompt. > >>> > >> > >> Here's a refined version of the patch which allows users to optionally > >> replace already-installed packages, or install/keep both. > >> > >> Testing this revealed some interesting other issues which may already be > >> known. I'll see if I can find bug reports and if not I'll submit new > >> ones. One example is that packages from different archives have > >> incompatible version numbering schemes which causes false positives with > >> the obsolete package detection mechanism. Another is that > >> package-reinstall does not respect the originating archive, instead > >> preferring package-archive-priorities which may install a different version > >> than is expected by a user. Now might be a good time to consider that > >> packages should be installed in archive-specific subdirectories rather than > >> commingling them? > >> > >> I'd appreciate it if some others would look at this and test it. It might > >> be adequate as a stop-gap for its intended purpose to avoid casual > >> duplicate installs and some feedback would help. > >> > > > > This bug/patch seems to have languished. It would be good to get it done. > > Duplicate installed packages are annoying to say the least. > > Can you please summarise the relevant parts of this discussion? I see > that a patch is being mentioned above, should I review it? > > The latest version of this patch from this discussion is attached. It amends both the menu-driven package > upgrade and the package-upgrade command to assist the user with avoiding (or permitting) installing a > package more than once. > > I introduced "tangents" in the discussion along the way as I learned more about the package infrastructure: > > "Testing this revealed some interesting other issues which may already be known. I'll see if I can find bug > reports and if not I'll submit new ones. One example is that packages from different archives have > incompatible version numbering schemes which causes false positives with the obsolete package detection > mechanism. Another is that package-reinstall does not respect the originating archive, instead preferring > package-archive-priorities which may install a different version than is expected by a user. Now might be a > good time to consider that packages should be installed in archive-specific subdirectories rather than > commingling them?" > > -Stephane From debbugs-submit-bounces@debbugs.gnu.org Sun May 25 11:02:05 2025 Received: (at 76568) by debbugs.gnu.org; 25 May 2025 15:02:05 +0000 Received: from localhost ([127.0.0.1]:46646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uJCrU-00031G-DY for submit@debbugs.gnu.org; Sun, 25 May 2025 11:02:05 -0400 Received: from mout02.posteo.de ([185.67.36.66]:51209) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uJCrR-00030R-39 for 76568@debbugs.gnu.org; Sun, 25 May 2025 11:02:02 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id B65D5240101 for <76568@debbugs.gnu.org>; Sun, 25 May 2025 17:01:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1748185314; bh=eQHS9Rl2YMdREx4AmQNBL9hWG0NAssEMS3fNpQz6ucw=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=Tzh99lxZZJuz1R/b5H2zzaCIDHyrcpWf00LlA96iU4ayMeyXYPYcFIbaO28LV+Jyl 1x99O3YXGuBZe8KsE/fjjQwx2IL+xJK+Ge3x/kiixwAMV5XE/Wz9PbfGlgXiZwhoas 1Df4QPiY4ds3LpDAXpQr3FepK1MVqbIikPgliWzFUfz1YBG/cNcyQgL50EbFaqtkZQ /hIXkqOQjYyrWRcGEJbihMPn+x7RREURIV0WQxzsL2CpTyPiXAVduxcbrbgbp1xMeD pAyBiN5DkqhnHXr4bbg9NflxQNB1DCcIXltbg5Uf0aGzdsA0ZOY+bqkPJP6a4h99SO nDl6SZW4iOBWA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4b52DK602Gz9rxF; Sun, 25 May 2025 17:01:53 +0200 (CEST) From: Philip Kaludercic To: Ship Mints Subject: Re: bug#76568: 'package-install' should not install duplicate packages In-Reply-To: References: <87h61kd0tv.fsf@posteo.net> 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 OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Date: Sun, 25 May 2025 15:01:53 +0000 Message-ID: <87y0uklony.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Eli Zaretskii , Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) Ship Mints writes: [...] >> Can you please summarise the relevant parts of this discussion? I see >> that a patch is being mentioned above, should I review it? >> > > The latest version of this patch from this discussion is attached. It > amends both the menu-driven package upgrade and the package-upgrade comma= nd > to assist the user with avoiding (or permitting) installing a package more > than once. > [...] > > -Stephane > From 9deee448e27f94c21469e59677fde2cbce8f9bcd Mon Sep 17 00:00:00 2001 > From: shipmints > Date: Wed, 5 Mar 2025 11:33:07 -0500 > Subject: [PATCH] Correct 'package-install' to detect installed packages > (bug#76568) > > * lisp/emacs-lisp/package.el > (package-install): Check for already installed package using its symbol > rather than rely on differing archive directory structures. Return t if > installed, nil otherwise. > (package-install-button-action): 'describe-package' only when > 'package-install' actually installed the package. Prompt the user to > install or upgrade an already installed package. > * test/lisp/emacs-lisp/package-tests.el (package-test-install-single): > Add already-installed test using 'package-install' with a > 'package-desc'. > --- > lisp/emacs-lisp/package.el | 54 +++++++++++++++++++++------ > test/lisp/emacs-lisp/package-tests.el | 4 ++ > 2 files changed, 47 insertions(+), 11 deletions(-) > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > index 8d498c216dc..7c7e99168aa 100644 > --- a/lisp/emacs-lisp/package.el > +++ b/lisp/emacs-lisp/package.el > @@ -2194,7 +2194,7 @@ package-install-upgrade-built-in > :version "29.1") >=20=20 > ;;;###autoload > -(defun package-install (pkg &optional dont-select) > +(defun package-install (pkg &optional dont-select allow-mult-or-reinstal= l) > "Install the package PKG. >=20=20 > PKG can be a `package-desc', or a symbol naming one of the available > @@ -2207,8 +2207,13 @@ package-install > non-nil, install the package but do not add it to > `package-selected-packages'. >=20=20 > -If PKG is a `package-desc' and it is already installed, don't try > -to install it but still mark it as selected. > +When called from Lisp and optional argument ALLOW-MULT-OR-REINSTALL is > +non-nil, install the package even if it is already installed from > +another source, allowing more than one simultaneous version. > + > +If PKG is a `package-desc' and it is already installed, and > +ALLOW-MULT-OR-REINSTALL is nil, don't try to install it but still mark > +it as selected. Why is this yet another optional argument, instead of a user option? >=20=20 > If the command is invoked with a prefix argument, it will allow > upgrading of built-in packages, as if `package-install-upgrade-built-in' > @@ -2243,16 +2248,22 @@ package-install > (package--active-built-in-p pkg)) > (setq pkg (or (cadr (assq name package-archive-contents)) pkg))) > (if-let* ((transaction > + ;; Test for already installed using the pkg symbol, not > + ;; the archive-specific directory structure. > (if (package-desc-p pkg) > - (unless (package-installed-p pkg) > + (unless (and (not allow-mult-or-reinstall) > + (package-installed-p (package-desc-name = pkg))) > (package-compute-transaction (list pkg) > (package-desc-reqs pkg= ))) > - (package-compute-transaction () (list (list pkg)))))) > + (unless (and (not allow-mult-or-reinstall) > + (package-installed-p pkg)) > + (package-compute-transaction () (list (list pkg))))))) > (progn > (package-download-transaction transaction) > (package--quickstart-maybe-refresh) > (message "Package `%s' installed." name)) > - (message "`%s' is already installed" name)))) > + (message "`%s' is already installed" name) > + nil))) >=20=20 > (declare-function package-vc-upgrade "package-vc" (pkg)) >=20=20 > @@ -2587,7 +2598,7 @@ package-reinstall > (package-delete > (if (package-desc-p pkg) pkg (cadr (assq pkg package-alist))) > 'force 'nosave) > - (package-install pkg 'dont-select)) > + (package-install pkg 'dont-select 'allow-mult-or-reinstall)) >=20=20 > ;;;###autoload > (defun package-recompile (pkg) > @@ -3051,10 +3062,31 @@ package-install-button-action > Used for the `action' property of buttons in the buffer created by > `describe-package'." > (let ((pkg-desc (button-get button 'package-desc))) > - (when (y-or-n-p (format-message "Install package `%s'? " > - (package-desc-full-name pkg-desc))) > - (package-install pkg-desc nil) > - (describe-package (package-desc-name pkg-desc))))) > + (if (package-installed-p (package-desc-name pkg-desc)) > + (let ((installed-pkg-desc (cadr (assq > + (package-desc-name pkg-desc) > + package-alist)))) > + (pcase (let ((read-answer-short t)) > + (read-answer > + (format-message > + "Replace `%s' with `%s', or Install both (advanced = users) " > + (package-desc-full-name installed-pkg-desc) > + (package-desc-full-name pkg-desc)) > + '(("replace" ?r "Replace existing") > + ("install" ?i "Install both") > + ("help" ?h "Help") > + ("quit" ?q "Quit to abort")))) > + ("replace" > + (package-delete installed-pkg-desc 'force 'dont-unselect) > + (when (package-install pkg-desc nil) > + (describe-package (package-desc-name pkg-desc)))) > + ("install" > + (when (package-install pkg-desc nil 'allow-mult-or-reinstal= l) > + (describe-package (package-desc-name pkg-desc)))))) > + (when (y-or-n-p (format-message "Install package `%s'? " > + (package-desc-full-name pkg-desc))) > + (when (package-install pkg-desc nil) > + (describe-package (package-desc-name pkg-desc))))))) >=20=20 > (defun package-delete-button-action (button) > "Run `package-delete' on the package BUTTON points to. > diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp= /package-tests.el > index d8e260319bd..36617ed6f6e 100644 > --- a/test/lisp/emacs-lisp/package-tests.el > +++ b/test/lisp/emacs-lisp/package-tests.el > @@ -248,6 +248,10 @@ package-test-install-single > (should (string-match "^[`=E2=80=98']simple-single[=E2=80=99'] is = already installed\n?\\'" > (buffer-string)))) > (should (package-installed-p 'simple-single)) > + ;; Test for `package-install' already installed using a > + ;; package-desc. `package-install' returns nil if already > + ;; installed. > + (should-not (package-install simple-single-desc)) > (let* ((simple-pkg-dir (file-name-as-directory > (expand-file-name > "simple-single-1.3" For some reason I find this patch very difficult to follow... Perhaps I don't understand the issue you are trying to fix, or how it is related to your patch. From debbugs-submit-bounces@debbugs.gnu.org Sun May 25 11:08:54 2025 Received: (at 76568) by debbugs.gnu.org; 25 May 2025 15:08:54 +0000 Received: from localhost ([127.0.0.1]:46690 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uJCy5-0003aM-EN for submit@debbugs.gnu.org; Sun, 25 May 2025 11:08:54 -0400 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]:55602) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uJCy1-0003Zs-Ct for 76568@debbugs.gnu.org; Sun, 25 May 2025 11:08:50 -0400 Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-6faa4307e15so14213496d6.3 for <76568@debbugs.gnu.org>; Sun, 25 May 2025 08:08:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748185723; x=1748790523; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=O7DfLX4pHOS23C+dPEwWGqMzG46wPBvF771ymj3KzAs=; b=Foo5XkqBBZYRuZxnrhB8YuUyYxD0i8Rq83RjxWUzo79mWsrtu9MlV+m+FrAVqKGrqB wobDBPO6dMu5SS+BxoLDWYQz3S2M+NFRjCziFg4mPsnhlqZ5PT1aLp1D5ZppRj9CmePt q6AZ43UgXQ66XqMPjvT4LlsvEBIO2AxQceBoon1doW/NHJ7eu42+KKoPHdgdClZAxsOH t2e8CKGrLgoxxl0e6B72yf3Ut1YfH6X59hdnkvnE/P/N0z6rr9Y9fzB8yX9ECGkaD487 NOPILZ8MeuQxfPYVONlXc9kUXi7f0IBaftTgNCpDD+FlaxTmuU/5CpQujzQzwO1jF9yh oIKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748185723; x=1748790523; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O7DfLX4pHOS23C+dPEwWGqMzG46wPBvF771ymj3KzAs=; b=CCyTttfRVaipOyms3sGjWah1aVvWHtA4VJOMutkxSqczx4VGZ/cZEQUye9tbpLA78l /HaPkpcOFha+rNEHLVNA2iu/HsmITzEhinloP+Jh6CNCA9DRZzjSRmzNZWJzVZ+xBMOj Q0sOGPz4FKkkvHMisSS7PjrQoR0zMLwLxMv1HuSQ/ZWTwb+FIwB4nMd4jzUmTlhj4hhe IuF5NuaPItV3MiSHnbxNmkHB0ag0k/ILjbJ8aTZyOHGjX3G9IoS+romWhM66IWW0+UUT aKu55nXNRKAFpYUYfRx4rWVPfFKZ7+VX8gPhijhv82T04qzh7wmaF1HYjzo5TC5/Hwc6 2lZg== X-Gm-Message-State: AOJu0YxAw5k0HLyTRJjl+rQxe3gxTNdBt5JzucC1Tgz4J3tOjq1qVSpF S5NBeCvBZEmAsnPjTntnoUNj3bb06gzDBcodJguq2vVo89E7jlcYbwAz0gjx+1hJ0YdGBfmpIHH WAfnh5rdc+q857ZoqnN6DXxqKxns6wrqOQA== X-Gm-Gg: ASbGncvT8BLsAh/+ONyuqMNv1lS3SZzWfW1PI44p7Jz+sbQK5Ds7sbrQ/+01mAJVX4U KDT4Egp6yXbA46yRfjxFAhsvEYrFbUjCvyTGG3O6EP6uWPuPvEpx3JBAjfB5ULcYtzuvDJ0rhUo LA55SzTWfS5e+05eY6DVZDu84JQ1eLd3fpPZg= X-Google-Smtp-Source: AGHT+IGQQpXZ3Slb42S/gXL/s9cCqZWx7bi4o67Ed73RKoyKtGP8hVOMQB+1DCGA3Fad7TxCYKQg/yJlXgnhIh6KsYI= X-Received: by 2002:a05:620a:44c6:b0:7cc:fef2:51b9 with SMTP id af79cd13be357-7ceecc4597fmr955576885a.52.1748185711760; Sun, 25 May 2025 08:08:31 -0700 (PDT) MIME-Version: 1.0 References: <87h61kd0tv.fsf@posteo.net> <87y0uklony.fsf@posteo.net> In-Reply-To: <87y0uklony.fsf@posteo.net> From: Ship Mints Date: Sun, 25 May 2025 11:08:20 -0400 X-Gm-Features: AX0GCFvwQVpYAwSzRSSrokJMGfh3TrbBq-3cTatF6otpO647NCA9HkeB22e9BOk Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Philip Kaludercic Content-Type: multipart/alternative; boundary="00000000000059da380635f73436" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Eli Zaretskii , Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --00000000000059da380635f73436 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, May 25, 2025 at 11:01=E2=80=AFAM Philip Kaludercic wrote: > Ship Mints writes: > > > [...] > > >> Can you please summarise the relevant parts of this discussion? I see > >> that a patch is being mentioned above, should I review it? > >> > > > > The latest version of this patch from this discussion is attached. It > > amends both the menu-driven package upgrade and the package-upgrade > command > > to assist the user with avoiding (or permitting) installing a package > more > > than once. > > > > [...] > > > > > -Stephane > > From 9deee448e27f94c21469e59677fde2cbce8f9bcd Mon Sep 17 00:00:00 2001 > > From: shipmints > > Date: Wed, 5 Mar 2025 11:33:07 -0500 > > Subject: [PATCH] Correct 'package-install' to detect installed packages > > (bug#76568) > > > > * lisp/emacs-lisp/package.el > > (package-install): Check for already installed package using its symbol > > rather than rely on differing archive directory structures. Return t i= f > > installed, nil otherwise. > > (package-install-button-action): 'describe-package' only when > > 'package-install' actually installed the package. Prompt the user to > > install or upgrade an already installed package. > > * test/lisp/emacs-lisp/package-tests.el (package-test-install-single): > > Add already-installed test using 'package-install' with a > > 'package-desc'. > > --- > > lisp/emacs-lisp/package.el | 54 +++++++++++++++++++++------ > > test/lisp/emacs-lisp/package-tests.el | 4 ++ > > 2 files changed, 47 insertions(+), 11 deletions(-) > > > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > > index 8d498c216dc..7c7e99168aa 100644 > > --- a/lisp/emacs-lisp/package.el > > +++ b/lisp/emacs-lisp/package.el > > @@ -2194,7 +2194,7 @@ package-install-upgrade-built-in > > :version "29.1") > > > > ;;;###autoload > > -(defun package-install (pkg &optional dont-select) > > +(defun package-install (pkg &optional dont-select > allow-mult-or-reinstall) > > "Install the package PKG. > > > > PKG can be a `package-desc', or a symbol naming one of the available > > @@ -2207,8 +2207,13 @@ package-install > > non-nil, install the package but do not add it to > > `package-selected-packages'. > > > > -If PKG is a `package-desc' and it is already installed, don't try > > -to install it but still mark it as selected. > > +When called from Lisp and optional argument ALLOW-MULT-OR-REINSTALL is > > +non-nil, install the package even if it is already installed from > > +another source, allowing more than one simultaneous version. > > + > > +If PKG is a `package-desc' and it is already installed, and > > +ALLOW-MULT-OR-REINSTALL is nil, don't try to install it but still mark > > +it as selected. > > Why is this yet another optional argument, instead of a user option? > As the maintainer, you pick what suits your taste. > > > If the command is invoked with a prefix argument, it will allow > > upgrading of built-in packages, as if `package-install-upgrade-built-i= n' > > @@ -2243,16 +2248,22 @@ package-install > > (package--active-built-in-p pkg)) > > (setq pkg (or (cadr (assq name package-archive-contents)) pkg))) > > (if-let* ((transaction > > + ;; Test for already installed using the pkg symbol, not > > + ;; the archive-specific directory structure. > > (if (package-desc-p pkg) > > - (unless (package-installed-p pkg) > > + (unless (and (not allow-mult-or-reinstall) > > + (package-installed-p (package-desc-nam= e > pkg))) > > (package-compute-transaction (list pkg) > > (package-desc-reqs > pkg))) > > - (package-compute-transaction () (list (list pkg)))))) > > + (unless (and (not allow-mult-or-reinstall) > > + (package-installed-p pkg)) > > + (package-compute-transaction () (list (list > pkg))))))) > > (progn > > (package-download-transaction transaction) > > (package--quickstart-maybe-refresh) > > (message "Package `%s' installed." name)) > > - (message "`%s' is already installed" name)))) > > + (message "`%s' is already installed" name) > > + nil))) > > > > (declare-function package-vc-upgrade "package-vc" (pkg)) > > > > @@ -2587,7 +2598,7 @@ package-reinstall > > (package-delete > > (if (package-desc-p pkg) pkg (cadr (assq pkg package-alist))) > > 'force 'nosave) > > - (package-install pkg 'dont-select)) > > + (package-install pkg 'dont-select 'allow-mult-or-reinstall)) > > > > ;;;###autoload > > (defun package-recompile (pkg) > > @@ -3051,10 +3062,31 @@ package-install-button-action > > Used for the `action' property of buttons in the buffer created by > > `describe-package'." > > (let ((pkg-desc (button-get button 'package-desc))) > > - (when (y-or-n-p (format-message "Install package `%s'? " > > - (package-desc-full-name pkg-desc))= ) > > - (package-install pkg-desc nil) > > - (describe-package (package-desc-name pkg-desc))))) > > + (if (package-installed-p (package-desc-name pkg-desc)) > > + (let ((installed-pkg-desc (cadr (assq > > + (package-desc-name pkg-desc) > > + package-alist)))) > > + (pcase (let ((read-answer-short t)) > > + (read-answer > > + (format-message > > + "Replace `%s' with `%s', or Install both (advance= d > users) " > > + (package-desc-full-name installed-pkg-desc) > > + (package-desc-full-name pkg-desc)) > > + '(("replace" ?r "Replace existing") > > + ("install" ?i "Install both") > > + ("help" ?h "Help") > > + ("quit" ?q "Quit to abort")))) > > + ("replace" > > + (package-delete installed-pkg-desc 'force 'dont-unselect) > > + (when (package-install pkg-desc nil) > > + (describe-package (package-desc-name pkg-desc)))) > > + ("install" > > + (when (package-install pkg-desc nil > 'allow-mult-or-reinstall) > > + (describe-package (package-desc-name pkg-desc)))))) > > + (when (y-or-n-p (format-message "Install package `%s'? " > > + (package-desc-full-name > pkg-desc))) > > + (when (package-install pkg-desc nil) > > + (describe-package (package-desc-name pkg-desc))))))) > > > > (defun package-delete-button-action (button) > > "Run `package-delete' on the package BUTTON points to. > > diff --git a/test/lisp/emacs-lisp/package-tests.el > b/test/lisp/emacs-lisp/package-tests.el > > index d8e260319bd..36617ed6f6e 100644 > > --- a/test/lisp/emacs-lisp/package-tests.el > > +++ b/test/lisp/emacs-lisp/package-tests.el > > @@ -248,6 +248,10 @@ package-test-install-single > > (should (string-match "^[`=E2=80=98']simple-single[=E2=80=99'] i= s already > installed\n?\\'" > > (buffer-string)))) > > (should (package-installed-p 'simple-single)) > > + ;; Test for `package-install' already installed using a > > + ;; package-desc. `package-install' returns nil if already > > + ;; installed. > > + (should-not (package-install simple-single-desc)) > > (let* ((simple-pkg-dir (file-name-as-directory > > (expand-file-name > > "simple-single-1.3" > > For some reason I find this patch very difficult to follow... Perhaps I > don't understand the issue you are trying to fix, or how it is related > to your patch. > The issue is that package install will install multiple versions of the same package (from the same archive) without warning. This will and does confuse users especially using the interactive package menu. The patch works for me. The related issue is that multiple versions of the same packages that come from different archives are also installed but this patch does not attempt to deal with that. I proposed that we segregate archives under the package tree to ease the package infrastructure's ability to detect that. --00000000000059da380635f73436 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Sun, May 25, 2025 at 11:01=E2=80=AFAM Philip Kaludercic <philipk@posteo.net> wrote:
Ship Mints <shipmints@gmail.com> writes:


[...]

>> Can you please summarise the relevant parts of this discussion?=C2= =A0 I see
>> that a patch is being mentioned above, should I review it?
>>
>
> The latest version of this patch from this discussion is attached.=C2= =A0 It
> amends both the menu-driven package upgrade and the package-upgrade co= mmand
> to assist the user with avoiding (or permitting) installing a package = more
> than once.
>

[...]

>
> -Stephane
> From 9deee448e27f94c21469e59677fde2cbce8f9bcd Mon Sep 17 00:00:00 2001=
> From: shipmints <shipmints@gmail.com>
> Date: Wed, 5 Mar 2025 11:33:07 -0500
> Subject: [PATCH] Correct 'package-install' to detect installed= packages
>=C2=A0 (bug#76568)
>
> * lisp/emacs-lisp/package.el
> (package-install): Check for already installed package using its symbo= l
> rather than rely on differing archive directory structures.=C2=A0 Retu= rn t if
> installed, nil otherwise.
> (package-install-button-action): 'describe-package' only when<= br> > 'package-install' actually installed the package.=C2=A0 Prompt= the user to
> install or upgrade an already installed package.
> * test/lisp/emacs-lisp/package-tests.el (package-test-install-single):=
> Add already-installed test using 'package-install' with a
> 'package-desc'.
> ---
>=C2=A0 lisp/emacs-lisp/package.el=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 | 54 +++++++++++++++++++++------
>=C2=A0 test/lisp/emacs-lisp/package-tests.el |=C2=A0 4 ++
>=C2=A0 2 files changed, 47 insertions(+), 11 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > index 8d498c216dc..7c7e99168aa 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -2194,7 +2194,7 @@ package-install-upgrade-built-in
>=C2=A0 =C2=A0 :version "29.1")
>=C2=A0
>=C2=A0 ;;;###autoload
> -(defun package-install (pkg &optional dont-select)
> +(defun package-install (pkg &optional dont-select allow-mult-or-r= einstall)
>=C2=A0 =C2=A0 "Install the package PKG.
>=C2=A0
>=C2=A0 PKG can be a `package-desc', or a symbol naming one of the a= vailable
> @@ -2207,8 +2207,13 @@ package-install
>=C2=A0 non-nil, install the package but do not add it to
>=C2=A0 `package-selected-packages'.
>=C2=A0
> -If PKG is a `package-desc' and it is already installed, don't= try
> -to install it but still mark it as selected.
> +When called from Lisp and optional argument ALLOW-MULT-OR-REINSTALL i= s
> +non-nil, install the package even if it is already installed from
> +another source, allowing more than one simultaneous version.
> +
> +If PKG is a `package-desc' and it is already installed, and
> +ALLOW-MULT-OR-REINSTALL is nil, don't try to install it but still= mark
> +it as selected.

Why is this yet another optional argument, instead of a user option?

As the maintainer, you pick what suits your taste.

>=C2=A0
>=C2=A0 If the command is invoked with a prefix argument, it will allow<= br> >=C2=A0 upgrading of built-in packages, as if `package-install-upgrade-b= uilt-in'
> @@ -2243,16 +2248,22 @@ package-install
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(package-= -active-built-in-p pkg))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq pkg (or (cadr (assq name package-arch= ive-contents)) pkg)))
>=C2=A0 =C2=A0 =C2=A0 (if-let* ((transaction
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Test for al= ready installed using the pkg symbol, not
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; the archive= -specific directory structure.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(if (pack= age-desc-p pkg)
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (unless (package-installed-p pkg)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (unless (and (not allow-mult-or-reinstall)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-installed-p (package-de= sc-name pkg)))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(package-compute-transaction (list pkg)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-desc-reqs pkg)))
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(packag= e-compute-transaction () (list (list pkg))))))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(unless= (and (not allow-mult-or-reinstall)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-installed-p pkg))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (package-compute-transaction () (list (list pkg)))))))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (progn
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-download-transaction= transaction)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package--quickstart-maybe-re= fresh)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message=C2=A0 "Package = `%s' installed." name))
> -=C2=A0 =C2=A0 =C2=A0 (message "`%s' is already installed&quo= t; name))))
> +=C2=A0 =C2=A0 =C2=A0 (message "`%s' is already installed&quo= t; name)
> +=C2=A0 =C2=A0 =C2=A0 nil)))
>=C2=A0
>=C2=A0 (declare-function package-vc-upgrade "package-vc" (pkg= ))
>=C2=A0
> @@ -2587,7 +2598,7 @@ package-reinstall
>=C2=A0 =C2=A0 (package-delete
>=C2=A0 =C2=A0 =C2=A0(if (package-desc-p pkg) pkg (cadr (assq pkg packag= e-alist)))
>=C2=A0 =C2=A0 =C2=A0'force 'nosave)
> -=C2=A0 (package-install pkg 'dont-select))
> +=C2=A0 (package-install pkg 'dont-select 'allow-mult-or-reins= tall))
>=C2=A0
>=C2=A0 ;;;###autoload
>=C2=A0 (defun package-recompile (pkg)
> @@ -3051,10 +3062,31 @@ package-install-button-action
>=C2=A0 Used for the `action' property of buttons in the buffer crea= ted by
>=C2=A0 `describe-package'."
>=C2=A0 =C2=A0 (let ((pkg-desc (button-get button 'package-desc))) > -=C2=A0 =C2=A0 (when (y-or-n-p (format-message "Install package `= %s'? "
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-desc-full= -name pkg-desc)))
> -=C2=A0 =C2=A0 =C2=A0 (package-install pkg-desc nil)
> -=C2=A0 =C2=A0 =C2=A0 (describe-package (package-desc-name pkg-desc)))= ))
> +=C2=A0 =C2=A0 (if (package-installed-p (package-desc-name pkg-desc))<= br> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((installed-pkg-desc (cadr (assq
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(package-desc-name pkg-desc)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0package-alist))))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (pcase (let ((read-answer-short t)= )
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (read-answer
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (format-message
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0"Replace `%s' with `%s', or Install both (advanced user= s) "
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0(package-desc-full-name installed-pkg-desc)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0(package-desc-full-name pkg-desc))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= '(("replace" ?r "Replace existing")
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 ("install" ?i "Install both")
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 ("help" ?h "Help")
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 ("quit" ?q "Quit to abort"))))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ("replace"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(package-delete insta= lled-pkg-desc 'force 'dont-unselect)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (package-instal= l pkg-desc nil)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(describe-pack= age (package-desc-name pkg-desc))))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ("install"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (package-instal= l pkg-desc nil 'allow-mult-or-reinstall)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(describe-pack= age (package-desc-name pkg-desc))))))
> +=C2=A0 =C2=A0 =C2=A0 (when (y-or-n-p (format-message "Install pa= ckage `%s'? "
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-de= sc-full-name pkg-desc)))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (package-install pkg-desc nil)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (describe-package (package-desc-na= me pkg-desc)))))))
>=C2=A0
>=C2=A0 (defun package-delete-button-action (button)
>=C2=A0 =C2=A0 "Run `package-delete' on the package BUTTON poin= ts to.
> diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-l= isp/package-tests.el
> index d8e260319bd..36617ed6f6e 100644
> --- a/test/lisp/emacs-lisp/package-tests.el
> +++ b/test/lisp/emacs-lisp/package-tests.el
> @@ -248,6 +248,10 @@ package-test-install-single
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (should (string-match "^[`=E2=80=98= 9;]simple-single[=E2=80=99'] is already installed\n?\\'"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (buffer-string))))
>=C2=A0 =C2=A0 =C2=A0 (should (package-installed-p 'simple-single))<= br> > +=C2=A0 =C2=A0 ;; Test for `package-install' already installed usi= ng a
> +=C2=A0 =C2=A0 ;; package-desc.=C2=A0 `package-install' returns ni= l if already
> +=C2=A0 =C2=A0 ;; installed.
> +=C2=A0 =C2=A0 (should-not (package-install simple-single-desc))
>=C2=A0 =C2=A0 =C2=A0 (let* ((simple-pkg-dir (file-name-as-directory
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (expand-file-name
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"simple-single-1.3"

For some reason I find this patch very difficult to follow...=C2=A0 Perhaps= I
don't understand the issue you are trying to fix, or how it is related<= br> to your patch.

The issue is that package install will inst= all multiple versions of the same package (from the same archive) without w= arning.=C2=A0 This will and does confuse users especially using the interac= tive package menu.=C2=A0 The patch works for me.

The related issue is that multiple vers= ions of the same packages that come from different archives are also instal= led but this patch does not attempt to deal with that.=C2=A0 I proposed tha= t we segregate archives under the package tree to ease the package infrastr= ucture's ability to detect that.
--00000000000059da380635f73436-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 07 04:36:03 2025 Received: (at 76568) by debbugs.gnu.org; 7 Jun 2025 08:36:03 +0000 Received: from localhost ([127.0.0.1]:46791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uNp22-0005SB-GI for submit@debbugs.gnu.org; Sat, 07 Jun 2025 04:36:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51548) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uNp20-0005Rd-EO for 76568@debbugs.gnu.org; Sat, 07 Jun 2025 04:36:01 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uNp1u-0004wU-VR; Sat, 07 Jun 2025 04:35:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=c1wOGvJs7yzXNbdPzMQPkWHdACEyBKoXTnFY74y+huQ=; b=HdIq1gKyP3BU0CXEcKha jOBR1U8iDI7jLF9hxFH5KzhMzZeT2ar70MbfrXNeQTuUxk6fyknP8eKsY205BSKcE+M8pMwEBcz8x mdgDQOKS+zHFPxs49rfE6X6nwkKVrTw7k3yc9VDGDj6pjnlmg98Frg4IHgBDLIldXyTS5hHHsqBvp 4qSguyqeNAjvMcTKILR5ljDaYoos414fGKWQTtbpoIF1onUgCjPI42Yl+WMtHkjQh2TRAofG888RU I1hZTQBO6t7ogkbQIhLGtj87zf6jsqCdViBmEf8lMGbQ9onP3mwsNB7Z66eiQclF9vfr3dUc3oTH5 3rkCBB6vAU83FQ==; Date: Sat, 07 Jun 2025 11:35:52 +0300 Message-Id: <861prwj6dz.fsf@gnu.org> From: Eli Zaretskii To: philipk@posteo.net, Ship Mints In-Reply-To: (message from Ship Mints on Sun, 25 May 2025 11:08:20 -0400) Subject: Re: bug#76568: 'package-install' should not install duplicate packages References: <87h61kd0tv.fsf@posteo.net> <87y0uklony.fsf@posteo.net> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! Can we make further progress with this issue? > From: Ship Mints > Date: Sun, 25 May 2025 11:08:20 -0400 > Cc: 76568@debbugs.gnu.org, Eli Zaretskii , > Stefan Kangas > > On Sun, May 25, 2025 at 11:01 AM Philip Kaludercic wrote: > > Ship Mints writes: > > [...] > > >> Can you please summarise the relevant parts of this discussion? I see > >> that a patch is being mentioned above, should I review it? > >> > > > > The latest version of this patch from this discussion is attached. It > > amends both the menu-driven package upgrade and the package-upgrade command > > to assist the user with avoiding (or permitting) installing a package more > > than once. > > > > [...] > > > > > -Stephane > > From 9deee448e27f94c21469e59677fde2cbce8f9bcd Mon Sep 17 00:00:00 2001 > > From: shipmints > > Date: Wed, 5 Mar 2025 11:33:07 -0500 > > Subject: [PATCH] Correct 'package-install' to detect installed packages > > (bug#76568) > > > > * lisp/emacs-lisp/package.el > > (package-install): Check for already installed package using its symbol > > rather than rely on differing archive directory structures. Return t if > > installed, nil otherwise. > > (package-install-button-action): 'describe-package' only when > > 'package-install' actually installed the package. Prompt the user to > > install or upgrade an already installed package. > > * test/lisp/emacs-lisp/package-tests.el (package-test-install-single): > > Add already-installed test using 'package-install' with a > > 'package-desc'. > > --- > > lisp/emacs-lisp/package.el | 54 +++++++++++++++++++++------ > > test/lisp/emacs-lisp/package-tests.el | 4 ++ > > 2 files changed, 47 insertions(+), 11 deletions(-) > > > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el > > index 8d498c216dc..7c7e99168aa 100644 > > --- a/lisp/emacs-lisp/package.el > > +++ b/lisp/emacs-lisp/package.el > > @@ -2194,7 +2194,7 @@ package-install-upgrade-built-in > > :version "29.1") > > > > ;;;###autoload > > -(defun package-install (pkg &optional dont-select) > > +(defun package-install (pkg &optional dont-select allow-mult-or-reinstall) > > "Install the package PKG. > > > > PKG can be a `package-desc', or a symbol naming one of the available > > @@ -2207,8 +2207,13 @@ package-install > > non-nil, install the package but do not add it to > > `package-selected-packages'. > > > > -If PKG is a `package-desc' and it is already installed, don't try > > -to install it but still mark it as selected. > > +When called from Lisp and optional argument ALLOW-MULT-OR-REINSTALL is > > +non-nil, install the package even if it is already installed from > > +another source, allowing more than one simultaneous version. > > + > > +If PKG is a `package-desc' and it is already installed, and > > +ALLOW-MULT-OR-REINSTALL is nil, don't try to install it but still mark > > +it as selected. > > Why is this yet another optional argument, instead of a user option? > > As the maintainer, you pick what suits your taste. > > > > > If the command is invoked with a prefix argument, it will allow > > upgrading of built-in packages, as if `package-install-upgrade-built-in' > > @@ -2243,16 +2248,22 @@ package-install > > (package--active-built-in-p pkg)) > > (setq pkg (or (cadr (assq name package-archive-contents)) pkg))) > > (if-let* ((transaction > > + ;; Test for already installed using the pkg symbol, not > > + ;; the archive-specific directory structure. > > (if (package-desc-p pkg) > > - (unless (package-installed-p pkg) > > + (unless (and (not allow-mult-or-reinstall) > > + (package-installed-p (package-desc-name pkg))) > > (package-compute-transaction (list pkg) > > (package-desc-reqs pkg))) > > - (package-compute-transaction () (list (list pkg)))))) > > + (unless (and (not allow-mult-or-reinstall) > > + (package-installed-p pkg)) > > + (package-compute-transaction () (list (list pkg))))))) > > (progn > > (package-download-transaction transaction) > > (package--quickstart-maybe-refresh) > > (message "Package `%s' installed." name)) > > - (message "`%s' is already installed" name)))) > > + (message "`%s' is already installed" name) > > + nil))) > > > > (declare-function package-vc-upgrade "package-vc" (pkg)) > > > > @@ -2587,7 +2598,7 @@ package-reinstall > > (package-delete > > (if (package-desc-p pkg) pkg (cadr (assq pkg package-alist))) > > 'force 'nosave) > > - (package-install pkg 'dont-select)) > > + (package-install pkg 'dont-select 'allow-mult-or-reinstall)) > > > > ;;;###autoload > > (defun package-recompile (pkg) > > @@ -3051,10 +3062,31 @@ package-install-button-action > > Used for the `action' property of buttons in the buffer created by > > `describe-package'." > > (let ((pkg-desc (button-get button 'package-desc))) > > - (when (y-or-n-p (format-message "Install package `%s'? " > > - (package-desc-full-name pkg-desc))) > > - (package-install pkg-desc nil) > > - (describe-package (package-desc-name pkg-desc))))) > > + (if (package-installed-p (package-desc-name pkg-desc)) > > + (let ((installed-pkg-desc (cadr (assq > > + (package-desc-name pkg-desc) > > + package-alist)))) > > + (pcase (let ((read-answer-short t)) > > + (read-answer > > + (format-message > > + "Replace `%s' with `%s', or Install both (advanced users) " > > + (package-desc-full-name installed-pkg-desc) > > + (package-desc-full-name pkg-desc)) > > + '(("replace" ?r "Replace existing") > > + ("install" ?i "Install both") > > + ("help" ?h "Help") > > + ("quit" ?q "Quit to abort")))) > > + ("replace" > > + (package-delete installed-pkg-desc 'force 'dont-unselect) > > + (when (package-install pkg-desc nil) > > + (describe-package (package-desc-name pkg-desc)))) > > + ("install" > > + (when (package-install pkg-desc nil 'allow-mult-or-reinstall) > > + (describe-package (package-desc-name pkg-desc)))))) > > + (when (y-or-n-p (format-message "Install package `%s'? " > > + (package-desc-full-name pkg-desc))) > > + (when (package-install pkg-desc nil) > > + (describe-package (package-desc-name pkg-desc))))))) > > > > (defun package-delete-button-action (button) > > "Run `package-delete' on the package BUTTON points to. > > diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el > > index d8e260319bd..36617ed6f6e 100644 > > --- a/test/lisp/emacs-lisp/package-tests.el > > +++ b/test/lisp/emacs-lisp/package-tests.el > > @@ -248,6 +248,10 @@ package-test-install-single > > (should (string-match "^[`‘']simple-single[’'] is already installed\n?\\'" > > (buffer-string)))) > > (should (package-installed-p 'simple-single)) > > + ;; Test for `package-install' already installed using a > > + ;; package-desc. `package-install' returns nil if already > > + ;; installed. > > + (should-not (package-install simple-single-desc)) > > (let* ((simple-pkg-dir (file-name-as-directory > > (expand-file-name > > "simple-single-1.3" > > For some reason I find this patch very difficult to follow... Perhaps I > don't understand the issue you are trying to fix, or how it is related > to your patch. > > The issue is that package install will install multiple versions of the same package (from the same archive) > without warning. This will and does confuse users especially using the interactive package menu. The > patch works for me. > > The related issue is that multiple versions of the same packages that come from different archives are also > installed but this patch does not attempt to deal with that. I proposed that we segregate archives under the > package tree to ease the package infrastructure's ability to detect that. From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 07 17:23:25 2025 Received: (at 76568) by debbugs.gnu.org; 7 Jun 2025 21:23:25 +0000 Received: from localhost ([127.0.0.1]:49780 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uO10e-00028a-Ic for submit@debbugs.gnu.org; Sat, 07 Jun 2025 17:23:25 -0400 Received: from mout01.posteo.de ([185.67.36.65]:44347) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uO10a-000289-8L for 76568@debbugs.gnu.org; Sat, 07 Jun 2025 17:23:22 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4C19D240027 for <76568@debbugs.gnu.org>; Sat, 7 Jun 2025 23:23:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=1984.ea087b; t=1749331393; bh=XoEid3sT233dP1ZgvF/F+QK4Yv9IGZBjwjoScklgejQ=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=hQskH6PrPiXgm7lH/PkWAxoIFD6jpngnGkfwN16fKsd79QfUcO0d4oscdpWg7P3QT PrabZncJEuebC5XkRcG8V/h6qIiiexX6ukyiHzxoImzxYAkGNR7P8IsYOBcwfvETic Hp3wn3aK+D6rsN/Y8Ng22Uaf9AaP7NUts6Q7MBXStyZW3yMW5zl5d7xIKDcjodjQFX sqfl7UMhI5FG4GBosqF9/W6QXPbOAYVe1AyNEiCHZ235bZZuLKorv89tX+8Odfl31q 4OqLXK97xIgzr3NTwyzUqvVF7VogYKMvL23RpMKHuMqKjkY6RDw6hY+yscErBv0Rpa gYg0EaYaWHNUnNHU387dg+tRyQKlLctjaRbRHYMvt63eaPgWRGTEMuFZZuZYEGJ8yW id25hG8lOSHfvwradI5j/B0Ojo2FISRaCwR5QnWbosTdUd1/oTSpGi/9N8W3toeDQ6 pmdvWej6kfoQwzheqEL2SIjYsrUaEblnDeR7lpE7AqsY3n4uxI3 Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4bFB4J19m1z6tvq; Sat, 7 Jun 2025 23:23:11 +0200 (CEST) From: Philip Kaludercic To: Eli Zaretskii Subject: Re: bug#76568: 'package-install' should not install duplicate packages In-Reply-To: <861prwj6dz.fsf@gnu.org> References: <87h61kd0tv.fsf@posteo.net> <87y0uklony.fsf@posteo.net> <861prwj6dz.fsf@gnu.org> 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 OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Date: Sat, 07 Jun 2025 21:23:11 +0000 Message-ID: <87msajdz5s.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Ship Mints , Stefan Monnier , stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: > Ping! Can we make further progress with this issue? Sorry, understanding this bug report still takes me forever... Just composing this message took me an hour. I have added Stefan to the CCs to get some more input. >> From: Ship Mints >> Date: Sun, 25 May 2025 11:08:20 -0400 >> Cc: 76568@debbugs.gnu.org, Eli Zaretskii ,=20 >> Stefan Kangas >>=20 >> On Sun, May 25, 2025 at 11:01=E2=80=AFAM Philip Kaludercic wrote: >>=20 >> Ship Mints writes: >>=20 >> [...] >>=20 >> >> Can you please summarise the relevant parts of this discussion? I s= ee >> >> that a patch is being mentioned above, should I review it? >> >> >> > >> > The latest version of this patch from this discussion is attached. It >> > amends both the menu-driven package upgrade and the package-upgrade c= ommand >> > to assist the user with avoiding (or permitting) installing a package= more >> > than once. >> > >>=20 >> [...] >>=20 >> > >> > -Stephane >> > From 9deee448e27f94c21469e59677fde2cbce8f9bcd Mon Sep 17 00:00:00 2001 >> > From: shipmints >> > Date: Wed, 5 Mar 2025 11:33:07 -0500 >> > Subject: [PATCH] Correct 'package-install' to detect installed packag= es >> > (bug#76568) >> > >> > * lisp/emacs-lisp/package.el >> > (package-install): Check for already installed package using its symb= ol >> > rather than rely on differing archive directory structures. Return t= if ^ Why are you mentioning this here? >> > installed, nil otherwise. >> > (package-install-button-action): 'describe-package' only when >> > 'package-install' actually installed the package. Prompt the user to >> > install or upgrade an already installed package. >> > * test/lisp/emacs-lisp/package-tests.el (package-test-install-single): >> > Add already-installed test using 'package-install' with a >> > 'package-desc'. >> > --- >> > lisp/emacs-lisp/package.el | 54 +++++++++++++++++++++----= -- >> > test/lisp/emacs-lisp/package-tests.el | 4 ++ >> > 2 files changed, 47 insertions(+), 11 deletions(-) >> > >> > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el >> > index 8d498c216dc..7c7e99168aa 100644 >> > --- a/lisp/emacs-lisp/package.el >> > +++ b/lisp/emacs-lisp/package.el >> > @@ -2194,7 +2194,7 @@ package-install-upgrade-built-in >> > :version "29.1") >> >=20=20 >> > ;;;###autoload >> > -(defun package-install (pkg &optional dont-select) >> > +(defun package-install (pkg &optional dont-select allow-mult-or-rein= stall) >> > "Install the package PKG. >> >=20=20 >> > PKG can be a `package-desc', or a symbol naming one of the available >> > @@ -2207,8 +2207,13 @@ package-install >> > non-nil, install the package but do not add it to >> > `package-selected-packages'. >> >=20=20 >> > -If PKG is a `package-desc' and it is already installed, don't try >> > -to install it but still mark it as selected. >> > +When called from Lisp and optional argument ALLOW-MULT-OR-REINSTALL = is >> > +non-nil, install the package even if it is already installed from >> > +another source, allowing more than one simultaneous version. >> > + >> > +If PKG is a `package-desc' and it is already installed, and >> > +ALLOW-MULT-OR-REINSTALL is nil, don't try to install it but still ma= rk >> > +it as selected. >>=20 >> Why is this yet another optional argument, instead of a user option? >>=20 >> As the maintainer, you pick what suits your taste. No, what I meant is if there is a reason that we should sometimes allow installing multiple versions of a package in some cases and not in others? Is that a genuine use-case, or do you (as the person experiencing the issue you are trying to solve) assume that most people with the same problem would be OK with setting this once via a user-option. I am under the impression that that would simplify the change. (Also, if we go with the optional argument, please rename it to something cleaner like "allow-multiple". Perhaps it is just me, but an "-or-" in a argument name bugs me.) >> >=20=20 >> > If the command is invoked with a prefix argument, it will allow >> > upgrading of built-in packages, as if `package-install-upgrade-built= -in' >> > @@ -2243,16 +2248,22 @@ package-install >> > (package--active-built-in-p pkg)) >> > (setq pkg (or (cadr (assq name package-archive-contents)) pkg)= )) >> > (if-let* ((transaction >> > + ;; Test for already installed using the pkg symbol, n= ot >> > + ;; the archive-specific directory structure. >> > (if (package-desc-p pkg) >> > - (unless (package-installed-p pkg) >> > + (unless (and (not allow-mult-or-reinstall) >> > + (package-installed-p (package-desc-n= ame pkg))) >> > (package-compute-transaction (list pkg) >> > (package-desc-reqs= pkg))) >> > - (package-compute-transaction () (list (list pkg))))= )) >> > + (unless (and (not allow-mult-or-reinstall) >> > + (package-installed-p pkg)) >> > + (package-compute-transaction () (list (list pkg))= ))))) >> > (progn >> > (package-download-transaction transaction) >> > (package--quickstart-maybe-refresh) >> > (message "Package `%s' installed." name)) >> > - (message "`%s' is already installed" name)))) >> > + (message "`%s' is already installed" name) >> > + nil))) This last change appears to be unrelated to the remaining patch? >> >=20=20 >> > (declare-function package-vc-upgrade "package-vc" (pkg)) >> >=20=20 >> > @@ -2587,7 +2598,7 @@ package-reinstall >> > (package-delete >> > (if (package-desc-p pkg) pkg (cadr (assq pkg package-alist))) >> > 'force 'nosave) >> > - (package-install pkg 'dont-select)) >> > + (package-install pkg 'dont-select 'allow-mult-or-reinstall)) >> >=20=20 >> > ;;;###autoload >> > (defun package-recompile (pkg) >> > @@ -3051,10 +3062,31 @@ package-install-button-action (OK, one of the things that had me confused is that I misread the diff and assumed you were patching `package-recompile' ^^) >> > Used for the `action' property of buttons in the buffer created by >> > `describe-package'." >> > (let ((pkg-desc (button-get button 'package-desc))) >> > - (when (y-or-n-p (format-message "Install package `%s'? " >> > - (package-desc-full-name pkg-desc= ))) >> > - (package-install pkg-desc nil) >> > - (describe-package (package-desc-name pkg-desc))))) >> > + (if (package-installed-p (package-desc-name pkg-desc)) >> > + (let ((installed-pkg-desc (cadr (assq >> > + (package-desc-name pkg-desc) >> > + package-alist)))) >> > + (pcase (let ((read-answer-short t)) I don't think you should shadow the user's preference here. >> > + (read-answer >> > + (format-message >> > + "Replace `%s' with `%s', or Install both (advan= ced users) " Without some additional explanation here, I would assume that this prompt could confuse users. If we go with this approach, can you look into describing why the user would be interested in either replacing or keeping both versions of a package somewhere? Also, why not move this prompt into `package-install', that the user would get presented with if they invoke the command interactively? >> > + (package-desc-full-name installed-pkg-desc) >> > + (package-desc-full-name pkg-desc)) >> > + '(("replace" ?r "Replace existing") >> > + ("install" ?i "Install both") >> > + ("help" ?h "Help") >> > + ("quit" ?q "Quit to abort")))) >> > + ("replace" >> > + (package-delete installed-pkg-desc 'force 'dont-unselec= t) >> > + (when (package-install pkg-desc nil) >> > + (describe-package (package-desc-name pkg-desc)))) >> > + ("install" >> > + (when (package-install pkg-desc nil 'allow-mult-or-rein= stall) >> > + (describe-package (package-desc-name pkg-desc)))))) I think it would be good to add a message confirming that the "quit" operat= ion. >> > + (when (y-or-n-p (format-message "Install package `%s'? " >> > + (package-desc-full-name pkg-de= sc))) >> > + (when (package-install pkg-desc nil) >> > + (describe-package (package-desc-name pkg-desc))))))) >> >=20=20 >> > (defun package-delete-button-action (button) >> > "Run `package-delete' on the package BUTTON points to. >> > diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-= lisp/package-tests.el >> > index d8e260319bd..36617ed6f6e 100644 >> > --- a/test/lisp/emacs-lisp/package-tests.el >> > +++ b/test/lisp/emacs-lisp/package-tests.el >> > @@ -248,6 +248,10 @@ package-test-install-single >> > (should (string-match "^[`=E2=80=98']simple-single[=E2=80=99']= is already installed\n?\\'" >> > (buffer-string)))) >> > (should (package-installed-p 'simple-single)) >> > + ;; Test for `package-install' already installed using a >> > + ;; package-desc. `package-install' returns nil if already >> > + ;; installed. >> > + (should-not (package-install simple-single-desc)) >> > (let* ((simple-pkg-dir (file-name-as-directory >> > (expand-file-name >> > "simple-single-1.3" >>=20 >> For some reason I find this patch very difficult to follow... Perhaps I >> don't understand the issue you are trying to fix, or how it is related >> to your patch. >>=20 >> The issue is that package install will install multiple versions of the = same package (from the same archive) >> without warning. This will and does confuse users especially using the = interactive package menu. The >> patch works for me. Thanks for the explanation! I would rephrase the commit message to express the "Warn user when installing multiple versions of the same package" part more prominently. >> The related issue is that multiple versions of the same packages that co= me from different archives are also >> installed but this patch does not attempt to deal with that. I proposed= that we segregate archives under the >> package tree to ease the package infrastructure's ability to detect that. That is a different issue, one that I would like to solve ideally by convincing package maintainers not to have their packages on multiple archives, but that is not an issue we can solve here. From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 08 00:38:20 2025 Received: (at 76568) by debbugs.gnu.org; 8 Jun 2025 04:38:20 +0000 Received: from localhost ([127.0.0.1]:50349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uO7nY-0005ot-5V for submit@debbugs.gnu.org; Sun, 08 Jun 2025 00:38:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41880) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uO7nU-0005oc-Te for 76568@debbugs.gnu.org; Sun, 08 Jun 2025 00:38:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uO7nN-0002A1-LY; Sun, 08 Jun 2025 00:38:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UdSL7qRA2022PqcqzRV6RIwP+PT8DN92zPntc7+VOfQ=; b=T/lkkAGDPEmo 5jvBzMEBASHbDk3tccfrnNIltANP/nMGRTm7mulpWryxsUvM1a7fytjQuiOSODbfn5GaCzvlt95cN Vu52U4km0pVUfEq8X2kS/BXdiVr33rlPDfqgVjpQjCZkzqa3y+deS1dGIfjFgn2MNtxymbr04KFJ0 CJRZQ/JryVc4faFA5I6PB9k/sGbgbv02a1pQIgeIopYw7SR1wb3pWisYH59b4BEgXWKqzjIz887pH KOGLtf+dYvjD3GRibw4Ynk3NysWMy70Dkte40imt16U78VRI4XiiXqM8lRzuIPHkvH4WYboIVLxkP j/udOuxVQGi68OIa6I69kw==; Date: Sun, 08 Jun 2025 07:38:05 +0300 Message-Id: <86jz5mhmqa.fsf@gnu.org> From: Eli Zaretskii To: Philip Kaludercic In-Reply-To: <87msajdz5s.fsf@posteo.net> (message from Philip Kaludercic on Sat, 07 Jun 2025 21:23:11 +0000) Subject: Re: bug#76568: 'package-install' should not install duplicate packages References: <87h61kd0tv.fsf@posteo.net> <87y0uklony.fsf@posteo.net> <861prwj6dz.fsf@gnu.org> <87msajdz5s.fsf@posteo.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, shipmints@gmail.com, monnier@iro.umontreal.ca, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Philip Kaludercic > Cc: Ship Mints , 76568@debbugs.gnu.org, > stefankangas@gmail.com, "Stefan Monnier" > Date: Sat, 07 Jun 2025 21:23:11 +0000 > > Eli Zaretskii writes: > > > Ping! Can we make further progress with this issue? > > Sorry, understanding this bug report still takes me forever... Just > composing this message took me an hour. I have added Stefan to the CCs > to get some more input. Thank you for your efforts. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 13 02:39:42 2025 Received: (at 76568) by debbugs.gnu.org; 13 Jun 2025 06:39:43 +0000 Received: from localhost ([127.0.0.1]:37507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uPy4d-0007Tn-SL for submit@debbugs.gnu.org; Fri, 13 Jun 2025 02:39:42 -0400 Received: from mail-vs1-xe33.google.com ([2607:f8b0:4864:20::e33]:53745) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uPy4X-0007Rn-9D for 76568@debbugs.gnu.org; Fri, 13 Jun 2025 02:39:33 -0400 Received: by mail-vs1-xe33.google.com with SMTP id ada2fe7eead31-4e7b9cbd19dso456839137.3 for <76568@debbugs.gnu.org>; Thu, 12 Jun 2025 23:39:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749796763; x=1750401563; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=veNZqc600FsvQCAelBGlOs1gE/kNugS/lieNpRKD4+4=; b=m4pxE+Vuu/wAGUIEt6tNCNyTD4r9x+tCBCM5iVKKyUvlhUw2jeeRPxxHB0MF/ByA5N /B9Id1B3/lbZjru/4HgeY7mDxFT/ZynmF4wfgMXo7CD7nBfZEaimlLaZhh9xOmaR05vX n+/BuzfOuSV4wJ6KJ9LA+XJ0P924uaaEUXQFGkJoWpL9z6kfwqjNDu46RLyqwQmlmtHE lwEqwYSD2H7EXE3rcsCKtIoWLt63/IccjY7MPBqfjwKiNDY89QFxXCoi5m3feSd0meGQ txb8w6c+WIFhj3kAJYEDkDr6THCwQgBxWyV9HTY9KOWXRLVgCzHvZZlXpPp94LSDTDcd V2ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749796763; x=1750401563; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=veNZqc600FsvQCAelBGlOs1gE/kNugS/lieNpRKD4+4=; b=PKEOU3SweDzz390RuD5Xavj8FjwOXt/4hgyKCDLXOthM/K7e85MASnlvUtnSL4r9tC 5oK+FIS1/1twWscZAskELduBqbmL13phhtJAEEHh4+FRGb71JzXEdwNFCiNniMeBAh4Y u5H6/a8PBjVLU5L69Fmku5Vf4SDMZlwv819bX6khQ1h4gtEnQJiWyYmW9rSogWpWFJWw vaIX4ht8bfwJ0ct6dKj+yzvfl6hKa1xoCsSwYnCgnS4BhSWzWf5ULwJ7aak+Bvqx9jjY TvIhQbmDOhz5+hakPK5Gx3LE00AHWx5Kkx48DwW4MFwXNvHOzuph+E+QWLPIxPRoPYDC WZBg== X-Forwarded-Encrypted: i=1; AJvYcCWL9as62fYDEURPwoLjIEEXYur3v82A0+uXXq/WCqn88nxGoKbTD9sXs4KDdp7s27K2PI9S6Q==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyO0tdFlKVQ2GsQlymt/v6J/D5YZZ/27Ajs0c2dFs9Yuzz6QEN4 Rd7+uOowekrkV8maG1YjWEMLbBKs2xqQcgfnIZPj0rYg+VuupEbCWnOT9cFJ4T9ZCchwnPxUm+h pXOLnCs5wsSvbdqF3eB8GI98zIB1u37E= X-Gm-Gg: ASbGncuKhWDNUao7wzV0cjB9xwtK95WgkKyoHgi821S0MdTDwPC8/QDkGIoN/kqqMxj PnYiQlFKZ9LrQWeneFy+mRZz2W2SmmGsizaI0Wp6sd+pvrPrPH9luWj9sADhkGlvCwunEA7dpdk KSL2jhdHlBABTyCAs0duUj9TMJDP8aSi/hY+jxOMFdselDpL8JHHJ7vV0VDUWSlwpM5kcx+W5pO g== X-Google-Smtp-Source: AGHT+IHl1QaRp4E0i6hs8Zqm6iqr1SZbKqOqfMVGdVQZduXQatmxcYQYsEI7n8DyXARWhNw4ZJrq2u5serAoxrwClZ0= X-Received: by 2002:a05:6102:5786:b0:4e6:d911:dd89 with SMTP id ada2fe7eead31-4e7e3c6f50fmr1115106137.21.1749796763071; Thu, 12 Jun 2025 23:39:23 -0700 (PDT) MIME-Version: 1.0 References: <87h61kd0tv.fsf@posteo.net> <87y0uklony.fsf@posteo.net> <861prwj6dz.fsf@gnu.org> <87msajdz5s.fsf@posteo.net> In-Reply-To: <87msajdz5s.fsf@posteo.net> From: =?UTF-8?Q?St=C3=A9phane_Marks?= Date: Fri, 13 Jun 2025 08:39:11 +0200 X-Gm-Features: AX0GCFuSIw1AWb7c6h4V4dIDomqebrZk-ZTG0wDzyM2k7aa2fht6tRTPtjGv2V0 Message-ID: Subject: Re: bug#76568: 'package-install' should not install duplicate packages To: Philip Kaludercic Content-Type: multipart/alternative; boundary="0000000000007df9c706376e4eed" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Eli Zaretskii , stefankangas@gmail.com, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000007df9c706376e4eed Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Jun 7, 2025 at 11:23=E2=80=AFPM Philip Kaludercic wrote: > Eli Zaretskii writes: > > > Ping! Can we make further progress with this issue? > > Sorry, understanding this bug report still takes me forever... Just > composing this message took me an hour. I have added Stefan to the CCs > to get some more input. > > >> From: Ship Mints > >> Date: Sun, 25 May 2025 11:08:20 -0400 > >> Cc: 76568@debbugs.gnu.org, Eli Zaretskii , > >> Stefan Kangas > >> > >> On Sun, May 25, 2025 at 11:01=E2=80=AFAM Philip Kaludercic > wrote: > >> > >> Ship Mints writes: > >> > >> [...] > >> > >> >> Can you please summarise the relevant parts of this discussion? I > see > >> >> that a patch is being mentioned above, should I review it? > >> >> > >> > > >> > The latest version of this patch from this discussion is attached. > It > >> > amends both the menu-driven package upgrade and the package-upgrade > command > >> > to assist the user with avoiding (or permitting) installing a > package more > >> > than once. > >> > > >> > >> [...] > >> > >> > > >> > -Stephane > >> > From 9deee448e27f94c21469e59677fde2cbce8f9bcd Mon Sep 17 00:00:00 > 2001 > >> > From: shipmints > >> > Date: Wed, 5 Mar 2025 11:33:07 -0500 > >> > Subject: [PATCH] Correct 'package-install' to detect installed > packages > >> > (bug#76568) > >> > > >> > * lisp/emacs-lisp/package.el > >> > (package-install): Check for already installed package using its > symbol > >> > rather than rely on differing archive directory structures. Return > t if > ^ > Why are you mentioning this here? > That's the root source of duplicate package installations--packages that exist in multiple archives. Expanding the language to be more expansive is useful and as we move ahead with this, I'll update the text. >> > installed, nil otherwise. > >> > (package-install-button-action): 'describe-package' only when > >> > 'package-install' actually installed the package. Prompt the user = to > >> > install or upgrade an already installed package. > >> > * test/lisp/emacs-lisp/package-tests.el > (package-test-install-single): > >> > Add already-installed test using 'package-install' with a > >> > 'package-desc'. > >> > --- > >> > lisp/emacs-lisp/package.el | 54 > +++++++++++++++++++++------ > >> > test/lisp/emacs-lisp/package-tests.el | 4 ++ > >> > 2 files changed, 47 insertions(+), 11 deletions(-) > >> > > >> > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.e= l > >> > index 8d498c216dc..7c7e99168aa 100644 > >> > --- a/lisp/emacs-lisp/package.el > >> > +++ b/lisp/emacs-lisp/package.el > >> > @@ -2194,7 +2194,7 @@ package-install-upgrade-built-in > >> > :version "29.1") > >> > > >> > ;;;###autoload > >> > -(defun package-install (pkg &optional dont-select) > >> > +(defun package-install (pkg &optional dont-select > allow-mult-or-reinstall) > >> > "Install the package PKG. > >> > > >> > PKG can be a `package-desc', or a symbol naming one of the availab= le > >> > @@ -2207,8 +2207,13 @@ package-install > >> > non-nil, install the package but do not add it to > >> > `package-selected-packages'. > >> > > >> > -If PKG is a `package-desc' and it is already installed, don't try > >> > -to install it but still mark it as selected. > >> > +When called from Lisp and optional argument ALLOW-MULT-OR-REINSTAL= L > is > >> > +non-nil, install the package even if it is already installed from > >> > +another source, allowing more than one simultaneous version. > >> > + > >> > +If PKG is a `package-desc' and it is already installed, and > >> > +ALLOW-MULT-OR-REINSTALL is nil, don't try to install it but still > mark > >> > +it as selected. > >> > >> Why is this yet another optional argument, instead of a user option? > >> > >> As the maintainer, you pick what suits your taste. > > No, what I meant is if there is a reason that we should sometimes allow > installing multiple versions of a package in some cases and not in > others? Is that a genuine use-case, or do you (as the person > experiencing the issue you are trying to solve) assume that most people > with the same problem would be OK with setting this once via a > user-option. I am under the impression that that would simplify the > change. > I figured there's someone out there that depends on this for some reason and Emacs tries to provide backward compatibility. I prefer the simpler route, if agreed. (Also, if we go with the optional argument, please rename it to > something cleaner like "allow-multiple". Perhaps it is just me, but an > "-or-" in a argument name bugs me.) > Sure. >> > If the command is invoked with a prefix argument, it will allow > >> > upgrading of built-in packages, as if > `package-install-upgrade-built-in' > >> > @@ -2243,16 +2248,22 @@ package-install > >> > (package--active-built-in-p pkg)) > >> > (setq pkg (or (cadr (assq name package-archive-contents)) > pkg))) > >> > (if-let* ((transaction > >> > + ;; Test for already installed using the pkg symbol, > not > >> > + ;; the archive-specific directory structure. > >> > (if (package-desc-p pkg) > >> > - (unless (package-installed-p pkg) > >> > + (unless (and (not allow-mult-or-reinstall) > >> > + (package-installed-p > (package-desc-name pkg))) > >> > (package-compute-transaction (list pkg) > >> > > (package-desc-reqs pkg))) > >> > - (package-compute-transaction () (list (list > pkg)))))) > >> > + (unless (and (not allow-mult-or-reinstall) > >> > + (package-installed-p pkg)) > >> > + (package-compute-transaction () (list (list > pkg))))))) > >> > (progn > >> > (package-download-transaction transaction) > >> > (package--quickstart-maybe-refresh) > >> > (message "Package `%s' installed." name)) > >> > - (message "`%s' is already installed" name)))) > >> > + (message "`%s' is already installed" name) > >> > + nil))) > > This last change appears to be unrelated to the remaining patch? > Last meaning the message, or last meaning the whole of the above? >> > (declare-function package-vc-upgrade "package-vc" (pkg)) > >> > > >> > @@ -2587,7 +2598,7 @@ package-reinstall > >> > (package-delete > >> > (if (package-desc-p pkg) pkg (cadr (assq pkg package-alist))) > >> > 'force 'nosave) > >> > - (package-install pkg 'dont-select)) > >> > + (package-install pkg 'dont-select 'allow-mult-or-reinstall)) > >> > > >> > ;;;###autoload > >> > (defun package-recompile (pkg) > >> > @@ -3051,10 +3062,31 @@ package-install-button-action > > (OK, one of the things that had me confused is that I misread the diff > and assumed you were patching `package-recompile' ^^) > > >> > Used for the `action' property of buttons in the buffer created by > >> > `describe-package'." > >> > (let ((pkg-desc (button-get button 'package-desc))) > >> > - (when (y-or-n-p (format-message "Install package `%s'? " > >> > - (package-desc-full-name > pkg-desc))) > >> > - (package-install pkg-desc nil) > >> > - (describe-package (package-desc-name pkg-desc))))) > >> > + (if (package-installed-p (package-desc-name pkg-desc)) > >> > + (let ((installed-pkg-desc (cadr (assq > >> > + (package-desc-name > pkg-desc) > >> > + package-alist)))) > >> > + (pcase (let ((read-answer-short t)) > > I don't think you should shadow the user's preference here. > I need more coffee. Not following. >> > + (read-answer > >> > + (format-message > >> > + "Replace `%s' with `%s', or Install both > (advanced users) " > > Without some additional explanation here, I would assume that this > prompt could confuse users. If we go with this approach, can you look > into describing why the user would be interested in either replacing or > keeping both versions of a package somewhere? > If we decide to disallow multiple side-by-side installs, this becomes moot. Also, why not move this prompt into `package-install', that the user > would get presented with if they invoke the command interactively? > I'd have to reread this from scratch to see as I can't recall. >> > + (package-desc-full-name installed-pkg-desc) > >> > + (package-desc-full-name pkg-desc)) > >> > + '(("replace" ?r "Replace existing") > >> > + ("install" ?i "Install both") > >> > + ("help" ?h "Help") > >> > + ("quit" ?q "Quit to abort")))) > >> > + ("replace" > >> > + (package-delete installed-pkg-desc 'force > 'dont-unselect) > >> > + (when (package-install pkg-desc nil) > >> > + (describe-package (package-desc-name pkg-desc)))) > >> > + ("install" > >> > + (when (package-install pkg-desc nil > 'allow-mult-or-reinstall) > >> > + (describe-package (package-desc-name pkg-desc)))))) > > I think it would be good to add a message confirming that the "quit" > operation. > Alright. > >> > + (when (y-or-n-p (format-message "Install package `%s'? " > >> > + (package-desc-full-name > pkg-desc))) > >> > + (when (package-install pkg-desc nil) > >> > + (describe-package (package-desc-name pkg-desc))))))) > >> > > >> > (defun package-delete-button-action (button) > >> > "Run `package-delete' on the package BUTTON points to. > >> > diff --git a/test/lisp/emacs-lisp/package-tests.el > b/test/lisp/emacs-lisp/package-tests.el > >> > index d8e260319bd..36617ed6f6e 100644 > >> > --- a/test/lisp/emacs-lisp/package-tests.el > >> > +++ b/test/lisp/emacs-lisp/package-tests.el > >> > @@ -248,6 +248,10 @@ package-test-install-single > >> > (should (string-match "^[`=E2=80=98']simple-single[=E2=80=99= '] is already > installed\n?\\'" > >> > (buffer-string)))) > >> > (should (package-installed-p 'simple-single)) > >> > + ;; Test for `package-install' already installed using a > >> > + ;; package-desc. `package-install' returns nil if already > >> > + ;; installed. > >> > + (should-not (package-install simple-single-desc)) > >> > (let* ((simple-pkg-dir (file-name-as-directory > >> > (expand-file-name > >> > "simple-single-1.3" > >> > >> For some reason I find this patch very difficult to follow... Perhap= s > I > >> don't understand the issue you are trying to fix, or how it is relate= d > >> to your patch. > >> > >> The issue is that package install will install multiple versions of th= e > same package (from the same archive) > >> without warning. This will and does confuse users especially using th= e > interactive package menu. The > >> patch works for me. > > Thanks for the explanation! I would rephrase the commit message to > express the > > "Warn user when installing multiple versions of the same > package" > > part more prominently. > Okay. >> The related issue is that multiple versions of the same packages that > come from different archives are also > >> installed but this patch does not attempt to deal with that. I > proposed that we segregate archives under the > >> package tree to ease the package infrastructure's ability to detect > that. > > That is a different issue, one that I would like to solve ideally by > convincing package maintainers not to have their packages on multiple > archives, but that is not an issue we can solve here. > I suppose the "convenience" of MELPA's publish on most recent commit is attractive to some. Doesn't this still bite us if people use both ELPA devel and ELPA production since they're treated as different archives? Perhaps we can unify duplicate package detection at least in the core Emacs archives. -Stephane --0000000000007df9c706376e4eed Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
= On Sat, Jun 7, 2025 at 11:23=E2=80=AFPM Philip Kaludercic <philipk@posteo.net> wrote:
Eli Zaretskii <eliz@gnu.org> writes:

> Ping!=C2=A0 Can we make further progress with this issue?

Sorry, understanding this bug report still takes me forever...=C2=A0 Just composing this message took me an hour.=C2=A0 I have added Stefan to the CC= s
to get some more input.

>> From: Ship Mints <shipmints@gmail.com>
>> Date: Sun, 25 May 2025 11:08:20 -0400
>> Cc: 765= 68@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
>>=C2=A0 =C2=A0 =C2=A0 Stefan Kangas <stefankangas@gmail.com>
>>
>> On Sun, May 25, 2025 at 11:01=E2=80=AFAM Philip Kaludercic <philipk@posteo.net= > wrote:
>>
>>=C2=A0 Ship Mints <shipmints@gmail.com> writes:
>>
>>=C2=A0 [...]
>>
>>=C2=A0 >> Can you please summarise the relevant parts of this= discussion?=C2=A0 I see
>>=C2=A0 >> that a patch is being mentioned above, should I rev= iew it?
>>=C2=A0 >>
>>=C2=A0 >
>>=C2=A0 > The latest version of this patch from this discussion i= s attached.=C2=A0 It
>>=C2=A0 > amends both the menu-driven package upgrade and the pac= kage-upgrade command
>>=C2=A0 > to assist the user with avoiding (or permitting) instal= ling a package more
>>=C2=A0 > than once.
>>=C2=A0 >
>>
>>=C2=A0 [...]
>>
>>=C2=A0 >
>>=C2=A0 > -Stephane
>>=C2=A0 > From 9deee448e27f94c21469e59677fde2cbce8f9bcd Mon Sep 1= 7 00:00:00 2001
>>=C2=A0 > From: shipmints <shipmints@gmail.com>
>>=C2=A0 > Date: Wed, 5 Mar 2025 11:33:07 -0500
>>=C2=A0 > Subject: [PATCH] Correct 'package-install' to d= etect installed packages
>>=C2=A0 >=C2=A0 (bug#76568)
>>=C2=A0 >
>>=C2=A0 > * lisp/emacs-lisp/package.el
>>=C2=A0 > (package-install): Check for already installed package = using its symbol
>>=C2=A0 > rather than rely on differing archive directory structu= res.=C2=A0 Return t if
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Why are you mentioning this= here?

That's the root source of duplicate package ins= tallations--packages that exist in multiple archives.=C2=A0 Expanding the l= anguage to be more expansive is useful and as we move ahead with this, I= 9;ll update the text.

>>=C2=A0 > installed, nil otherwise.
>>=C2=A0 > (package-install-button-action): 'describe-package&= #39; only when
>>=C2=A0 > 'package-install' actually installed the packag= e.=C2=A0 Prompt the user to
>>=C2=A0 > install or upgrade an already installed package.
>>=C2=A0 > * test/lisp/emacs-lisp/package-tests.el (package-test-i= nstall-single):
>>=C2=A0 > Add already-installed test using 'package-install&#= 39; with a
>>=C2=A0 > 'package-desc'.
>>=C2=A0 > ---
>>=C2=A0 >=C2=A0 lisp/emacs-lisp/package.el=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 | 54 +++++++++++++++++++++------
>>=C2=A0 >=C2=A0 test/lisp/emacs-lisp/package-tests.el |=C2=A0 4 += +
>>=C2=A0 >=C2=A0 2 files changed, 47 insertions(+), 11 deletions(-= )
>>=C2=A0 >
>>=C2=A0 > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-li= sp/package.el
>>=C2=A0 > index 8d498c216dc..7c7e99168aa 100644
>>=C2=A0 > --- a/lisp/emacs-lisp/package.el
>>=C2=A0 > +++ b/lisp/emacs-lisp/package.el
>>=C2=A0 > @@ -2194,7 +2194,7 @@ package-install-upgrade-built-in<= br> >>=C2=A0 >=C2=A0 =C2=A0 :version "29.1")
>>=C2=A0 >=C2=A0
>>=C2=A0 >=C2=A0 ;;;###autoload
>>=C2=A0 > -(defun package-install (pkg &optional dont-select)=
>>=C2=A0 > +(defun package-install (pkg &optional dont-select = allow-mult-or-reinstall)
>>=C2=A0 >=C2=A0 =C2=A0 "Install the package PKG.
>>=C2=A0 >=C2=A0
>>=C2=A0 >=C2=A0 PKG can be a `package-desc', or a symbol nami= ng one of the available
>>=C2=A0 > @@ -2207,8 +2207,13 @@ package-install
>>=C2=A0 >=C2=A0 non-nil, install the package but do not add it to=
>>=C2=A0 >=C2=A0 `package-selected-packages'.
>>=C2=A0 >=C2=A0
>>=C2=A0 > -If PKG is a `package-desc' and it is already insta= lled, don't try
>>=C2=A0 > -to install it but still mark it as selected.
>>=C2=A0 > +When called from Lisp and optional argument ALLOW-MULT= -OR-REINSTALL is
>>=C2=A0 > +non-nil, install the package even if it is already ins= talled from
>>=C2=A0 > +another source, allowing more than one simultaneous ve= rsion.
>>=C2=A0 > +
>>=C2=A0 > +If PKG is a `package-desc' and it is already insta= lled, and
>>=C2=A0 > +ALLOW-MULT-OR-REINSTALL is nil, don't try to insta= ll it but still mark
>>=C2=A0 > +it as selected.
>>
>>=C2=A0 Why is this yet another optional argument, instead of a user= option?
>>
>> As the maintainer, you pick what suits your taste.

No, what I meant is if there is a reason that we should sometimes allow
installing multiple versions of a package in some cases and not in
others?=C2=A0 Is that a genuine use-case, or do you (as the person
experiencing the issue you are trying to solve) assume that most people
with the same problem would be OK with setting this once via a
user-option.=C2=A0 I am under the impression that that would simplify the change.

I figured there's someone out there that = depends on this for some reason and Emacs tries to provide backward compati= bility.=C2=A0 I prefer the simpler route, if agreed.

(Also, if we go with the optional argument, please rename it to
something cleaner like "allow-multiple".=C2=A0 Perhaps it is just= me, but an
"-or-" in a argument name bugs me.)

Sure.
<= div class=3D"gmail_default" style=3D"font-family:monospace">
>>=C2=A0 >=C2=A0 If t= he command is invoked with a prefix argument, it will allow
>>=C2=A0 >=C2=A0 upgrading of built-in packages, as if `package-in= stall-upgrade-built-in'
>>=C2=A0 > @@ -2243,16 +2248,22 @@ package-install
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(package--active-built-in-p pkg))
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq pkg (or (cadr (assq na= me package-archive-contents)) pkg)))
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 (if-let* ((transaction
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0;; Test for already installed using the pkg symbol, not
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0;; the archive-specific directory structure.
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(if (package-desc-p pkg)
>>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(unless (package-installed-p pkg)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(unless (and (not allow-mult-or-reinstall)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-instal= led-p (package-desc-name pkg)))
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0(package-compute-transaction (list pkg)
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-desc-reqs pkg= )))
>>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(package-compute-transaction () (list (list pkg))))))
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0(unless (and (not allow-mult-or-reinstall)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-installed-p p= kg))
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(package-compute-transaction () (list (list pkg)))))))
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (progn
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package-downl= oad-transaction transaction)
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (package--quic= kstart-maybe-refresh)
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (message=C2=A0= "Package `%s' installed." name))
>>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 (message "`%s' is alread= y installed" name))))
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 (message "`%s' is alread= y installed" name)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 nil)))

This last change appears to be unrelated to the remaining patch?

Last meaning the message, or last meaning the whole of the abov= e?
=
>>=C2=A0 = >=C2=A0 (declare-function package-vc-upgrade "package-vc" (pkg= ))
>>=C2=A0 >=C2=A0
>>=C2=A0 > @@ -2587,7 +2598,7 @@ package-reinstall
>>=C2=A0 >=C2=A0 =C2=A0 (package-delete
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0(if (package-desc-p pkg) pkg (cadr (= assq pkg package-alist)))
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0'force 'nosave)
>>=C2=A0 > -=C2=A0 (package-install pkg 'dont-select))
>>=C2=A0 > +=C2=A0 (package-install pkg 'dont-select 'allo= w-mult-or-reinstall))
>>=C2=A0 >=C2=A0
>>=C2=A0 >=C2=A0 ;;;###autoload
>>=C2=A0 >=C2=A0 (defun package-recompile (pkg)
>>=C2=A0 > @@ -3051,10 +3062,31 @@ package-install-button-action
(OK, one of the things that had me confused is that I misread the diff
and assumed you were patching `package-recompile' ^^)

>>=C2=A0 >=C2=A0 Used for the `action' property of buttons in = the buffer created by
>>=C2=A0 >=C2=A0 `describe-package'."
>>=C2=A0 >=C2=A0 =C2=A0 (let ((pkg-desc (button-get button 'pa= ckage-desc)))
>>=C2=A0 > -=C2=A0 =C2=A0 (when (y-or-n-p (format-message "In= stall package `%s'? "
>>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (= package-desc-full-name pkg-desc)))
>>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 (package-install pkg-desc nil) >>=C2=A0 > -=C2=A0 =C2=A0 =C2=A0 (describe-package (package-desc-n= ame pkg-desc)))))
>>=C2=A0 > +=C2=A0 =C2=A0 (if (package-installed-p (package-desc-n= ame pkg-desc))
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((installed-pkg-desc = (cadr (assq
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(package-desc-name pkg-desc)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0package-alist))))
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (pcase (let ((read-= answer-short t))

I don't think you should shadow the user's preference here.

I need more coffee.=C2=A0 Not following.

>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(read-answer
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (format-message
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0"Replace `%s' with `%s', or Install bo= th (advanced users) "

Without some additional explanation here, I would assume that this
prompt could confuse users.=C2=A0 If we go with this approach, can you look=
into describing why the user would be interested in either replacing or
keeping both versions of a package somewhere?

If we d= ecide to disallow multiple side-by-side installs, this becomes moot.
<= /div>

Also, why not move this prompt into `package-install', that the user would get presented with if they invoke the command interactively?

I'd have to reread this from scratch to see as I can'= t recall.

>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(package-desc-full-name installed-pkg-desc)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(package-desc-full-name pkg-desc))
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 '(("replace" ?r "Replace existing"= ;)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ("install" ?i "Install both")<= br> >>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ("help" ?h "Help")
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ("quit" ?q "Quit to abort"))))=
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ("repla= ce"
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(packa= ge-delete installed-pkg-desc 'force 'dont-unselect)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when = (package-install pkg-desc nil)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(describe-package (package-desc-name pkg-desc))))
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ("insta= ll"
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when = (package-install pkg-desc nil 'allow-mult-or-reinstall)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(describe-package (package-desc-name pkg-desc))))))

I think it would be good to add a message confirming that the "quit&qu= ot; operation.

Alright.
=C2=A0
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex"> >>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 (when (y-or-n-p (format-message &= quot;Install package `%s'? "
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (package-desc-full-name pkg-desc)))
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (package-install pkg= -desc nil)
>>=C2=A0 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (describe-package (= package-desc-name pkg-desc)))))))
>>=C2=A0 >=C2=A0
>>=C2=A0 >=C2=A0 (defun package-delete-button-action (button)
>>=C2=A0 >=C2=A0 =C2=A0 "Run `package-delete' on the pack= age BUTTON points to.
>>=C2=A0 > diff --git a/test/lisp/emacs-lisp/package-tests.el b/te= st/lisp/emacs-lisp/package-tests.el
>>=C2=A0 > index d8e260319bd..36617ed6f6e 100644
>>=C2=A0 > --- a/test/lisp/emacs-lisp/package-tests.el
>>=C2=A0 > +++ b/test/lisp/emacs-lisp/package-tests.el
>>=C2=A0 > @@ -248,6 +248,10 @@ package-test-install-single
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 (should (string-match "= ^[`=E2=80=98']simple-single[=E2=80=99'] is already installed\n?\\&#= 39;"
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (buffer-string))))
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 (should (package-installed-p 's= imple-single))
>>=C2=A0 > +=C2=A0 =C2=A0 ;; Test for `package-install' alread= y installed using a
>>=C2=A0 > +=C2=A0 =C2=A0 ;; package-desc.=C2=A0 `package-install&= #39; returns nil if already
>>=C2=A0 > +=C2=A0 =C2=A0 ;; installed.
>>=C2=A0 > +=C2=A0 =C2=A0 (should-not (package-install simple-sing= le-desc))
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 (let* ((simple-pkg-dir (file-name-a= s-directory
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (expand-file-name
>>=C2=A0 >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"simple-single-= 1.3"
>>
>>=C2=A0 For some reason I find this patch very difficult to follow..= .=C2=A0 Perhaps I
>>=C2=A0 don't understand the issue you are trying to fix, or how= it is related
>>=C2=A0 to your patch.
>>
>> The issue is that package install will install multiple versions o= f the same package (from the same archive)
>> without warning.=C2=A0 This will and does confuse users especially= using the interactive package menu.=C2=A0 The
>> patch works for me.

Thanks for the explanation!=C2=A0 I would rephrase the commit message to express the

=C2=A0 =C2=A0 =C2=A0 =C2=A0 "Warn user when installing multiple versio= ns of the same
=C2=A0 =C2=A0 =C2=A0 =C2=A0 package"

part more prominently.

Okay.

>> The related issue is that multiple versions of the same packages t= hat come from different archives are also
>> installed but this patch does not attempt to deal with that.=C2=A0= I proposed that we segregate archives under the
>> package tree to ease the package infrastructure's ability to d= etect that.

That is a different issue, one that I would like to solve ideally by
convincing package maintainers not to have their packages on multiple
archives, but that is not an issue we can solve here.
=
I su= ppose the=C2=A0"convenience" of MELPA's=C2=A0publish on most = recent commit is attractive to=C2=A0some.

Doesn't this still bite=C2=A0us if people = use both ELPA devel and ELPA production since they're treated as differ= ent archives?=C2=A0 Perhaps we can unify duplicate package detection at lea= st in the core Emacs archives.

-Stephane
--0000000000007df9c706376e4eed-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 14 18:40:11 2025 Received: (at 76568) by debbugs.gnu.org; 14 Jun 2025 22:40:11 +0000 Received: from localhost ([127.0.0.1]:47058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uQZXg-0006kA-IZ for submit@debbugs.gnu.org; Sat, 14 Jun 2025 18:40:10 -0400 Received: from mout01.posteo.de ([185.67.36.65]:34891) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uQZXd-0006iT-4J for 76568@debbugs.gnu.org; Sat, 14 Jun 2025 18:40:03 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id C9D58240027 for <76568@debbugs.gnu.org>; Sun, 15 Jun 2025 00:39:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=1984.ea087b; t=1749940794; bh=zAg9Sp07wkc1xuus/OcqooNtR+tBZKOmAesTViZjEoM=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding:From; b=WBHY9m9zHCPgjIgiUDljHUyuP0g0nrYoz/72N1oxZx3xmiKrucrRqRT3cDZ5IntR0 WlFyMCZfpAxpye5KHDrvBaF6XO4N69YztkjvBs0eWy5unDwGKBDoCq5c7MtT8KkVEF WPi1kGHplqrmlMW31T+5cLTgXtC8VTwvAUrt4GaTHNpFVdESiLC48kuEEWbN0bt7JM ckT/JxY6MHR+qLsBDpKs1ht7+SLI77ES1PPnyFj3iOv/fHjQG9vGIu/O125NP7427v KA6IMEn58h4xGtVbS5aocivq6Rwae81DEN2fKo2CfSBZ0tK2goT5Ft4+IuagsPPSsj 0HVbSTkA9Q9VxfFvFtI0onYhwlfqvi8sGC8FTOEl4OgA582m1lodnLh+984dN3RMYb WWy/L7WqOu9nEzuieNPwQq0xcGuHXU/WQzQommol6rjoJspCqSoI8lxEgTeg/z5pDA jq08x1v6v2OcnTJdNdx+iYQY6nvkAIQKy3wieA131dwzBJ7t4U+ Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4bKWRY6JLjz9rxB; Sun, 15 Jun 2025 00:39:53 +0200 (CEST) From: Philip Kaludercic To: =?utf-8?Q?St=C3=A9phane?= Marks Subject: Re: bug#76568: 'package-install' should not install duplicate packages In-Reply-To: References: <87h61kd0tv.fsf@posteo.net> <87y0uklony.fsf@posteo.net> <861prwj6dz.fsf@gnu.org> <87msajdz5s.fsf@posteo.net> 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 OpenPGP: id=philipk@posteo.net; url="https://keys.openpgp.org/vks/v1/by-email/philipk@posteo.net"; preference=signencrypt Date: Sat, 14 Jun 2025 22:39:53 +0000 Message-ID: <87o6uqdk1y.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Eli Zaretskii , stefankangas@gmail.com, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) St=C3=A9phane Marks writes: > On Sat, Jun 7, 2025 at 11:23=E2=80=AFPM Philip Kaludercic > wrote: > >> Eli Zaretskii writes: >> >> > Ping! Can we make further progress with this issue? >> >> Sorry, understanding this bug report still takes me forever... Just >> composing this message took me an hour. I have added Stefan to the CCs >> to get some more input. >> >> >> From: Ship Mints >> >> Date: Sun, 25 May 2025 11:08:20 -0400 >> >> Cc: 76568@debbugs.gnu.org, Eli Zaretskii , >> >> Stefan Kangas >> >> >> >> On Sun, May 25, 2025 at 11:01=E2=80=AFAM Philip Kaludercic >> wrote: >> >> >> >> Ship Mints writes: >> >> >> >> [...] >> >> >> >> >> Can you please summarise the relevant parts of this discussion? I >> see >> >> >> that a patch is being mentioned above, should I review it? >> >> >> >> >> > >> >> > The latest version of this patch from this discussion is attached. >> It >> >> > amends both the menu-driven package upgrade and the package-upgrade >> command >> >> > to assist the user with avoiding (or permitting) installing a >> package more >> >> > than once. >> >> > >> >> >> >> [...] >> >> >> >> > >> >> > -Stephane >> >> > From 9deee448e27f94c21469e59677fde2cbce8f9bcd Mon Sep 17 00:00:00 >> 2001 >> >> > From: shipmints >> >> > Date: Wed, 5 Mar 2025 11:33:07 -0500 >> >> > Subject: [PATCH] Correct 'package-install' to detect installed >> packages >> >> > (bug#76568) >> >> > >> >> > * lisp/emacs-lisp/package.el >> >> > (package-install): Check for already installed package using its >> symbol >> >> > rather than rely on differing archive directory structures. Return >> t if >> ^ >> Why are you mentioning this here? >> > > That's the root source of duplicate package installations--packages that > exist in multiple archives. Expanding the language to be more expansive = is > useful and as we move ahead with this, I'll update the text. My point why are you documenting a fix that you are not implementing in this patch? >>> > installed, nil otherwise. >> >> > (package-install-button-action): 'describe-package' only when >> >> > 'package-install' actually installed the package. Prompt the user= to >> >> > install or upgrade an already installed package. >> >> > * test/lisp/emacs-lisp/package-tests.el >> (package-test-install-single): >> >> > Add already-installed test using 'package-install' with a >> >> > 'package-desc'. >> >> > --- >> >> > lisp/emacs-lisp/package.el | 54 >> +++++++++++++++++++++------ >> >> > test/lisp/emacs-lisp/package-tests.el | 4 ++ >> >> > 2 files changed, 47 insertions(+), 11 deletions(-) >> >> > >> >> > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.= el >> >> > index 8d498c216dc..7c7e99168aa 100644 >> >> > --- a/lisp/emacs-lisp/package.el >> >> > +++ b/lisp/emacs-lisp/package.el >> >> > @@ -2194,7 +2194,7 @@ package-install-upgrade-built-in >> >> > :version "29.1") >> >> > >> >> > ;;;###autoload >> >> > -(defun package-install (pkg &optional dont-select) >> >> > +(defun package-install (pkg &optional dont-select >> allow-mult-or-reinstall) >> >> > "Install the package PKG. >> >> > >> >> > PKG can be a `package-desc', or a symbol naming one of the availa= ble >> >> > @@ -2207,8 +2207,13 @@ package-install >> >> > non-nil, install the package but do not add it to >> >> > `package-selected-packages'. >> >> > >> >> > -If PKG is a `package-desc' and it is already installed, don't try >> >> > -to install it but still mark it as selected. >> >> > +When called from Lisp and optional argument ALLOW-MULT-OR-REINSTA= LL >> is >> >> > +non-nil, install the package even if it is already installed from >> >> > +another source, allowing more than one simultaneous version. >> >> > + >> >> > +If PKG is a `package-desc' and it is already installed, and >> >> > +ALLOW-MULT-OR-REINSTALL is nil, don't try to install it but still >> mark >> >> > +it as selected. >> >> >> >> Why is this yet another optional argument, instead of a user option? >> >> >> >> As the maintainer, you pick what suits your taste. >> >> No, what I meant is if there is a reason that we should sometimes allow >> installing multiple versions of a package in some cases and not in >> others? Is that a genuine use-case, or do you (as the person >> experiencing the issue you are trying to solve) assume that most people >> with the same problem would be OK with setting this once via a >> user-option. I am under the impression that that would simplify the >> change. >> > > I figured there's someone out there that depends on this for some reason > and Emacs tries to provide backward compatibility. I prefer the simpler > route, if agreed. > > (Also, if we go with the optional argument, please rename it to >> something cleaner like "allow-multiple". Perhaps it is just me, but an >> "-or-" in a argument name bugs me.) >> > > Sure. Thanks. >>> > If the command is invoked with a prefix argument, it will allow >> >> > upgrading of built-in packages, as if >> `package-install-upgrade-built-in' >> >> > @@ -2243,16 +2248,22 @@ package-install >> >> > (package--active-built-in-p pkg)) >> >> > (setq pkg (or (cadr (assq name package-archive-contents)) >> pkg))) >> >> > (if-let* ((transaction >> >> > + ;; Test for already installed using the pkg symbol, >> not >> >> > + ;; the archive-specific directory structure. >> >> > (if (package-desc-p pkg) >> >> > - (unless (package-installed-p pkg) >> >> > + (unless (and (not allow-mult-or-reinstall) >> >> > + (package-installed-p >> (package-desc-name pkg))) >> >> > (package-compute-transaction (list pkg) >> >> > >> (package-desc-reqs pkg))) >> >> > - (package-compute-transaction () (list (list >> pkg)))))) >> >> > + (unless (and (not allow-mult-or-reinstall) >> >> > + (package-installed-p pkg)) >> >> > + (package-compute-transaction () (list (list >> pkg))))))) >> >> > (progn >> >> > (package-download-transaction transaction) >> >> > (package--quickstart-maybe-refresh) >> >> > (message "Package `%s' installed." name)) >> >> > - (message "`%s' is already installed" name)))) >> >> > + (message "`%s' is already installed" name) >> >> > + nil))) >> >> This last change appears to be unrelated to the remaining patch? >> > > Last meaning the message, or last meaning the whole of the above? I meant the addition of returning `nil'. But I have since understood that you needed to add this for the test to work. >>> > (declare-function package-vc-upgrade "package-vc" (pkg)) >> >> > >> >> > @@ -2587,7 +2598,7 @@ package-reinstall >> >> > (package-delete >> >> > (if (package-desc-p pkg) pkg (cadr (assq pkg package-alist))) >> >> > 'force 'nosave) >> >> > - (package-install pkg 'dont-select)) >> >> > + (package-install pkg 'dont-select 'allow-mult-or-reinstall)) >> >> > >> >> > ;;;###autoload >> >> > (defun package-recompile (pkg) >> >> > @@ -3051,10 +3062,31 @@ package-install-button-action >> >> (OK, one of the things that had me confused is that I misread the diff >> and assumed you were patching `package-recompile' ^^) >> >> >> > Used for the `action' property of buttons in the buffer created by >> >> > `describe-package'." >> >> > (let ((pkg-desc (button-get button 'package-desc))) >> >> > - (when (y-or-n-p (format-message "Install package `%s'? " >> >> > - (package-desc-full-name >> pkg-desc))) >> >> > - (package-install pkg-desc nil) >> >> > - (describe-package (package-desc-name pkg-desc))))) >> >> > + (if (package-installed-p (package-desc-name pkg-desc)) >> >> > + (let ((installed-pkg-desc (cadr (assq >> >> > + (package-desc-name >> pkg-desc) >> >> > + package-alist)))) >> >> > + (pcase (let ((read-answer-short t)) >> >> I don't think you should shadow the user's preference here. >> > > I need more coffee. Not following. I don't think you should bind `read-answer-short'. If the user prefers to input short answers, they would adjust the user option. Otherwise, I think it is more consistent to stick to the defaults. >>> > + (read-answer >> >> > + (format-message >> >> > + "Replace `%s' with `%s', or Install both >> (advanced users) " >> >> Without some additional explanation here, I would assume that this >> prompt could confuse users. If we go with this approach, can you look >> into describing why the user would be interested in either replacing or >> keeping both versions of a package somewhere? >> > > If we decide to disallow multiple side-by-side installs, this becomes moo= t. No, I don't think we should do that for backwards compatibility reasons, but it might be worthwhile considering it as something to deprecate at some point... > Also, why not move this prompt into `package-install', that the user >> would get presented with if they invoke the command interactively? >> > > I'd have to reread this from scratch to see as I can't recall. OK, I can take a closer look at the code as well and see if things can be adjusted before pushing to master. >>> > + (package-desc-full-name installed-pkg-desc) >> >> > + (package-desc-full-name pkg-desc)) >> >> > + '(("replace" ?r "Replace existing") >> >> > + ("install" ?i "Install both") >> >> > + ("help" ?h "Help") >> >> > + ("quit" ?q "Quit to abort")))) >> >> > + ("replace" >> >> > + (package-delete installed-pkg-desc 'force >> 'dont-unselect) >> >> > + (when (package-install pkg-desc nil) >> >> > + (describe-package (package-desc-name pkg-desc)))) >> >> > + ("install" >> >> > + (when (package-install pkg-desc nil >> 'allow-mult-or-reinstall) >> >> > + (describe-package (package-desc-name pkg-desc)))))) >> >> I think it would be good to add a message confirming that the "quit" >> operation. >> > > Alright. > > >> >> > + (when (y-or-n-p (format-message "Install package `%s'? " >> >> > + (package-desc-full-name >> pkg-desc))) >> >> > + (when (package-install pkg-desc nil) >> >> > + (describe-package (package-desc-name pkg-desc))))))) >> >> > >> >> > (defun package-delete-button-action (button) >> >> > "Run `package-delete' on the package BUTTON points to. >> >> > diff --git a/test/lisp/emacs-lisp/package-tests.el >> b/test/lisp/emacs-lisp/package-tests.el >> >> > index d8e260319bd..36617ed6f6e 100644 >> >> > --- a/test/lisp/emacs-lisp/package-tests.el >> >> > +++ b/test/lisp/emacs-lisp/package-tests.el >> >> > @@ -248,6 +248,10 @@ package-test-install-single >> >> > (should (string-match "^[`=E2=80=98']simple-single[=E2=80= =99'] is already >> installed\n?\\'" >> >> > (buffer-string)))) >> >> > (should (package-installed-p 'simple-single)) >> >> > + ;; Test for `package-install' already installed using a >> >> > + ;; package-desc. `package-install' returns nil if already >> >> > + ;; installed. >> >> > + (should-not (package-install simple-single-desc)) >> >> > (let* ((simple-pkg-dir (file-name-as-directory >> >> > (expand-file-name >> >> > "simple-single-1.3" >> >> >> >> For some reason I find this patch very difficult to follow... Perha= ps >> I >> >> don't understand the issue you are trying to fix, or how it is relat= ed >> >> to your patch. >> >> >> >> The issue is that package install will install multiple versions of t= he >> same package (from the same archive) >> >> without warning. This will and does confuse users especially using t= he >> interactive package menu. The >> >> patch works for me. >> >> Thanks for the explanation! I would rephrase the commit message to >> express the >> >> "Warn user when installing multiple versions of the same >> package" >> >> part more prominently. >> > > Okay. > >>> The related issue is that multiple versions of the same packages that >> come from different archives are also >> >> installed but this patch does not attempt to deal with that. I >> proposed that we segregate archives under the >> >> package tree to ease the package infrastructure's ability to detect >> that. >> >> That is a different issue, one that I would like to solve ideally by >> convincing package maintainers not to have their packages on multiple >> archives, but that is not an issue we can solve here. >> > > I suppose the "convenience" of MELPA's publish on most recent commit is > attractive to some. > > Doesn't this still bite us if people use both ELPA devel and ELPA > production since they're treated as different archives? Perhaps we can > unify duplicate package detection at least in the core Emacs archives. That is true, though I am also of the opinion that end-users ought not to use ELPA-devel directly. In that case, we can at least rely on sensible version number handling. > -Stephane From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 18 16:46:09 2025 Received: (at 76568) by debbugs.gnu.org; 18 Jun 2025 20:46:09 +0000 Received: from localhost ([127.0.0.1]:56611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uRzfd-0008Pi-3H for submit@debbugs.gnu.org; Wed, 18 Jun 2025 16:46:09 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:49338) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uRzfX-0008OL-Hc for 76568@debbugs.gnu.org; Wed, 18 Jun 2025 16:46:06 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4A8F91000BC; Wed, 18 Jun 2025 16:45:57 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1750279556; bh=4uu52GGekugsZnoa4hkbAgoEkdM/Y3Tqcvv0SppfGp4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=VKa7aCrtRZd4PFdHMLDi3BL+1GVNX1ToLBaDrb00GDuaRF6eT63irgy/z3CYBE2zZ D7esyAhw25B3oC27GWUvs4hWa6Sdt32p2gcyYNsWBV1vLxVUSfKBEPNk7e1EwP7e8v DOHi9YKbgNh3MHP9bkES6H/zgg/KT6zfNW8Am6tT/bDkDrILCHEBLG6oUClncE+OHU iORC95gJ0/gTE5oy9TKgL1GIR1In9NCaxRiutfZOrX0fHvKW2SVHyva3IrdjoMmhcu VfALr4tE8hf34hY9cmT3RuET1g5me2ATuLHmLa9VL0QD2jQwNGqC3VbrVdU20AEe2a INn3XxqY+EP/A== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 39DD1100029; Wed, 18 Jun 2025 16:45:56 -0400 (EDT) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0E7CD120346; Wed, 18 Jun 2025 16:45:56 -0400 (EDT) From: Stefan Monnier To: Philip Kaludercic Subject: Re: bug#76568: 'package-install' should not install duplicate packages In-Reply-To: <87o6uqdk1y.fsf@posteo.net> Message-ID: References: <87h61kd0tv.fsf@posteo.net> <87y0uklony.fsf@posteo.net> <861prwj6dz.fsf@gnu.org> <87msajdz5s.fsf@posteo.net> <87o6uqdk1y.fsf@posteo.net> Date: Wed, 18 Jun 2025 16:45:55 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.239 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Eli Zaretskii , =?windows-1252?Q?St=E9phane?= Marks , stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [ Sorry for getting here so late. ] >> If we decide to disallow multiple side-by-side installs, this becomes moot. > No, I don't think we should do that for backwards compatibility reasons, > but it might be worthwhile considering it as something to deprecate at > some point... It's not just backward compatibility: multiple installed versions of the same package is a feature we want to support (we don't support activating several different versions in the same Emacs session, of course, but you can have several different sessions activating different versions of a package). But, yes, it's a feature that's used very rarely, so we should not let unsuspecting users fall into this situation. I have not yet had time to look very much at the patch, but an optional `allow-multiple` option seems OK to me. It might make sense to determine the value of this `allow-multiple` from within the `interactive` spec: if the package is already installed with another version, prompt the user to decide whether we should delete the other version or not and then pass an appropriate `allow-multiple`. >> Doesn't this still bite us if people use both ELPA devel and ELPA >> production since they're treated as different archives? Perhaps we can >> unify duplicate package detection at least in the core Emacs archives. > That is true, though I am also of the opinion that end-users ought not > to use ELPA-devel directly. In that case, we can at least rely on > sensible version number handling. BTW, IIUC this archive issue is actually unrelated except maybe that it makes the problem easier to reproduce. AFAIK the multiple-install issue comes up when the already-installed version is different from the to-be-installed version. This can happen also with only a single archive. Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 18 17:03:49 2025 Received: (at 76568) by debbugs.gnu.org; 18 Jun 2025 21:03:50 +0000 Received: from localhost ([127.0.0.1]:56817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uRzwj-0001tO-11 for submit@debbugs.gnu.org; Wed, 18 Jun 2025 17:03:49 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:40561) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uRzwf-0001sZ-Te for 76568@debbugs.gnu.org; Wed, 18 Jun 2025 17:03:46 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 58A111000BC; Wed, 18 Jun 2025 17:03:40 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1750280619; bh=L653tla6IPOtjoxOHiNYrtqeg3B9M6WzaZxowNHGtUY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=GxbZYubDUlsD9DsPBQCvk+kjVSudceKijlfUjKp4kUkDHcrAm4PMLN0i/tELWM9/F pS/vhAZcv6h15xXNxHlhbcvxfp5ZIyb8oW5ABVroi5eXHb7lX+pJv9QUXjUzemCRJd GC/WuLU/nLucQds52uQl7ThzFrLP56r3qqSUl4NjWWZ2pmMXucPdSAR81QLx7mXtc/ yaraHa+EGNgf6/rZsbDr9gDLlCgKnQPIcsQElivqxXl9GMwK4DnMtQ9DlNfEpUvw8p 0V5oZ1SEl/AvkA0h9oZ/8OId63xUu6Ab43n1dlNaXFs1wLqBko95bjSYJ+XspX0NAl Ni8RjN9zR3MDA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4A2C9100029; Wed, 18 Jun 2025 17:03:39 -0400 (EDT) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 14FBE1204A3; Wed, 18 Jun 2025 17:03:39 -0400 (EDT) From: Stefan Monnier To: Ship Mints Subject: Re: bug#76568: 'package-install' should not install duplicate packages In-Reply-To: Message-ID: References: <87h61kd0tv.fsf@posteo.net> Date: Wed, 18 Jun 2025 17:03:38 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.235 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76568 Cc: 76568@debbugs.gnu.org, Philip Kaludercic , Eli Zaretskii , Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > @@ -2243,16 +2248,22 @@ package-install > (package--active-built-in-p pkg)) > (setq pkg (or (cadr (assq name package-archive-contents)) pkg))) > (if-let* ((transaction > + ;; Test for already installed using the pkg symbol, not > + ;; the archive-specific directory structure. > (if (package-desc-p pkg) > - (unless (package-installed-p pkg) > + (unless (and (not allow-mult-or-reinstall) > + (package-installed-p (package-desc-name pkg))) > (package-compute-transaction (list pkg) > (package-desc-reqs pkg))) I think that when `allow-multiple` is non-nil we should still check (package-installed-p pkg) to preserve the current behavior. IOW (unless (package-installed-p (if allow-multiple pkg (package-desc-name pkg))) tho it doesn't seem right to "do nothing" when the package is already installed but at another version. Maybe we should do something like (unless (package-installed-p pkg) (when (and (not allow-multiple) (package-installed-p (package-desc-name pkg))) (error "Use package-upgrade")) (package-compute-transaction (list pkg) (package-desc-reqs pkg))) > - (package-compute-transaction () (list (list pkg)))))) > + (unless (and (not allow-mult-or-reinstall) > + (package-installed-p pkg)) > + (package-compute-transaction () (list (list pkg))))))) Hmm... (unless (and (not allow-multiple) (package-installed-p pkg)) = (when (not (and (not allow-multiple) (package-installed-p pkg))) = (when (or allow-multiple (not (package-installed-p pkg))) which seems a bit easier to read. > (progn > (package-download-transaction transaction) > (package--quickstart-maybe-refresh) > (message "Package `%s' installed." name)) > - (message "`%s' is already installed" name)))) > + (message "`%s' is already installed" name) > + nil))) If we care about the return value, we should adjust the docstring accordingly. > @@ -3051,10 +3062,31 @@ package-install-button-action > Used for the `action' property of buttons in the buffer created by > `describe-package'." > (let ((pkg-desc (button-get button 'package-desc))) > - (when (y-or-n-p (format-message "Install package `%s'? " > - (package-desc-full-name pkg-desc))) > - (package-install pkg-desc nil) > - (describe-package (package-desc-name pkg-desc))))) > + (if (package-installed-p (package-desc-name pkg-desc)) > + (let ((installed-pkg-desc (cadr (assq > + (package-desc-name pkg-desc) > + package-alist)))) > + (pcase (let ((read-answer-short t)) > + (read-answer > + (format-message > + "Replace `%s' with `%s', or Install both (advanced users) " > + (package-desc-full-name installed-pkg-desc) > + (package-desc-full-name pkg-desc)) > + '(("replace" ?r "Replace existing") > + ("install" ?i "Install both") > + ("help" ?h "Help") > + ("quit" ?q "Quit to abort")))) > + ("replace" > + (package-delete installed-pkg-desc 'force 'dont-unselect) > + (when (package-install pkg-desc nil) > + (describe-package (package-desc-name pkg-desc)))) > + ("install" > + (when (package-install pkg-desc nil 'allow-mult-or-reinstall) > + (describe-package (package-desc-name pkg-desc)))))) > + (when (y-or-n-p (format-message "Install package `%s'? " > + (package-desc-full-name pkg-desc))) > + (when (package-install pkg-desc nil) > + (describe-package (package-desc-name pkg-desc))))))) +1 (but, like Philip pointed out, please don't override the user's choice of `read-answer-short`). Stefan