From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted Date: Fri, 15 Sep 2023 07:41:10 +0000 Message-ID: <87led7opd5.fsf@posteo.net> References: <61352d45-21a6-466b-be7b-7755a6260356@gmail.com> <83a5uemfxy.fsf@gnu.org> <87o7iutg4i.fsf@posteo.net> <4604c3e3-8a6a-41b0-bf4d-9c087f151961@gmail.com> <87h6o8eec3.fsf@posteo.net> <87fs3mxmtp.fsf@posteo.net> <8734ziv1ck.fsf@posteo.net> <87sf7goq8u.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1162"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Andrey Samsonov , Eli Zaretskii , Eshel Yaron , Stefan Monnier , 65475@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 15 09:42:11 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qh3Ss-000Ado-Fr for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Sep 2023 09:42:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qh3Sf-0004fM-D4; Fri, 15 Sep 2023 03:41:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh3Sd-0004eR-Qh for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 03:41:55 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qh3Sd-0000ue-Hy for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 03:41:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qh3Sj-0007HO-Pp for bug-gnu-emacs@gnu.org; Fri, 15 Sep 2023 03:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Sep 2023 07:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65475 X-GNU-PR-Package: emacs Original-Received: via spool by 65475-submit@debbugs.gnu.org id=B65475.169476368827920 (code B ref 65475); Fri, 15 Sep 2023 07:42:01 +0000 Original-Received: (at 65475) by debbugs.gnu.org; 15 Sep 2023 07:41:28 +0000 Original-Received: from localhost ([127.0.0.1]:41959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh3SB-0007GG-Fw for submit@debbugs.gnu.org; Fri, 15 Sep 2023 03:41:28 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:35407) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh3S9-0007G2-89 for 65475@debbugs.gnu.org; Fri, 15 Sep 2023 03:41:26 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 042DA240106 for <65475@debbugs.gnu.org>; Fri, 15 Sep 2023 09:41:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1694763673; bh=LZsEUQ7l75FJqFO6aGx2VRFpBIjB/+Nzrl8lYmcpCqE=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=DAz0UqP9YVwnmys+h7TRSkUIoUD/J0K38gpQVIgdVVKTsjWoIysIFGvSHkIaUZnvY enPyNeCElwDXoG7rU80hWkX+RIoaKiRuBEO+BJYv0hDUgjMQoY1T9FL70w20OCtZHy 1urnkFpcOQ7tWgZCYWhNsmK1urzbdVXJpu9FsfeJMlJfiWY+vsb9vIRrB5XprIp7Ja 8m1dNatj+FjJCJQhg4k7IoJuBWMNs7s8sGv2oxBix9SqGOXkwTu7khPsyntLzcjT2o XDQF4qAKERuLalQgwPIrGZTpGhaiiUzg2ibC/FwxPkUU8aziIdm+vv4CSafRg1gyKy 45UnEeknRFL0A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Rn5j328Dwz9rxV; Fri, 15 Sep 2023 09:41:11 +0200 (CEST) In-Reply-To: (Stefan Kangas's message of "Thu, 14 Sep 2023 07:27:52 -0700") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270506 Archived-At: --=-=-= Content-Type: text/plain Stefan Kangas writes: > Philip Kaludercic writes: > >> How does this look like: > > Thanks, some comments below: > >> From e865604c6a9d06cb986752e28b9ae88d7bc8011e Mon Sep 17 00:00:00 2001 >> From: Philip Kaludercic >> Date: Thu, 14 Sep 2023 15:09:19 +0200 >> Subject: [PATCH] package-tests.el: Add test Bug#65475 >> >> * test/lisp/emacs-lisp/package-tests.el (with-package-test): Bind >> package-selected-packages. >> (package-test-bug65475): Add test. >> --- >> test/lisp/emacs-lisp/package-tests.el | 18 ++++++++++++++++++ >> 1 file changed, 18 insertions(+) >> >> diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el >> index 113b4ec12a8..b55254bc036 100644 >> --- a/test/lisp/emacs-lisp/package-tests.el >> +++ b/test/lisp/emacs-lisp/package-tests.el >> @@ -125,6 +125,7 @@ with-package-test >> abbreviated-home-dir >> package--initialized >> package-alist >> + package-selected-packages >> ,@(if update-news >> '(package-update-news-on-upload t) >> (list (cl-gensym))) >> @@ -307,6 +308,23 @@ package-test-bug58367 >> (package-delete (cadr (assq 'v7-withsub package-alist)))) >> )) >> >> +(ert-deftest package-test-bug65475 () >> + "Ensure deleting a package clears `package-selected-packages'." > ^^^^^^ (1) ^^^^^^^^^ (2) > > 1. Is this word redundant? > 2. Maybe: "the last package"? Makes sense. >> + (with-package-test (:basedir (ert-resource-directory)) >> + (package-initialize) >> + (let* ((pkg-el "simple-single-1.3.el") >> + (source-file (expand-file-name pkg-el (ert-resource-directory)))) >> + (should-not package-alist) >> + (should-not package-selected-packages) >> + (package-install-file source-file) >> + (should package-alist) >> + (should package-selected-packages) >> + (let ((desc (cadr (assq 'simple-single package-alist)))) >> + (should desc) >> + (package-delete desc)) > > I'm not sure that the `should's and `should-not's above help, because > they make the intention of this test case less clear. For example, the > test fails if installing the package fails, but don't we already have a > separate test for that? Do we really need this test to fail in that > case also? > > If we want to check that, as a precondition, `package-alist' and > `package-selected-packages' are empty, perhaps that should be some > `cl-assert's in the `with-package-test' macro? OTOH, we already know > it's nil because of the let in the macro, so wouldn't that just be > verifying that let-binding a variable works correctly? > > It seems like the relevant `should's for this particular test are the > two below: No, I think it should be OK to drop the first two, I just wasn't familiar with the `with-package-test' at first when writing the test. Here is the updated patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-package-tests.el-Add-test-Bug-65475.patch >From 2354b56a8913294088cb3c9b9c3c833f00fdca91 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 14 Sep 2023 15:09:19 +0200 Subject: [PATCH] package-tests.el: Add test Bug#65475 * test/lisp/emacs-lisp/package-tests.el (with-package-test): Bind package-selected-packages. (package-test-bug65475): Add test. --- test/lisp/emacs-lisp/package-tests.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index 113b4ec12a8..e44ad3677d1 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -125,6 +125,7 @@ with-package-test abbreviated-home-dir package--initialized package-alist + package-selected-packages ,@(if update-news '(package-update-news-on-upload t) (list (cl-gensym))) @@ -307,6 +308,21 @@ package-test-bug58367 (package-delete (cadr (assq 'v7-withsub package-alist)))) )) +(ert-deftest package-test-bug65475 () + "Deleting the last package clears `package-selected-packages'." + (with-package-test (:basedir (ert-resource-directory)) + (package-initialize) + (let* ((pkg-el "simple-single-1.3.el") + (source-file (expand-file-name pkg-el (ert-resource-directory)))) + (package-install-file source-file) + (should package-alist) + (should package-selected-packages) + (let ((desc (cadr (assq 'simple-single package-alist)))) + (should desc) + (package-delete desc)) + (should-not package-alist) + (should-not package-selected-packages)))) + (ert-deftest package-test-install-file-EOLs () "Install same file multiple time with `package-install-file' but with a different end of line convention (bug#48137)." -- 2.39.2 --=-=-= Content-Type: text/plain >> + (should-not package-alist) >> + (should-not package-selected-packages)))) >> + >> (ert-deftest package-test-install-file-EOLs () >> "Install same file multiple time with `package-install-file' >> but with a different end of line convention (bug#48137)." >> -- >> 2.39.2 --=-=-=--