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: Thu, 21 Sep 2023 16:31:04 +0000 Message-ID: <87jzsjwks7.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> <87led7opd5.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36330"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Andrey Samsonov , Eli Zaretskii , Eshel Yaron , Stefan Monnier , 65475-done@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 21 18:32:40 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 1qjMbY-0009Fn-23 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Sep 2023 18:32:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qjMan-00040q-Qn; Thu, 21 Sep 2023 12:31:53 -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 1qjMam-0003zg-6l for bug-gnu-emacs@gnu.org; Thu, 21 Sep 2023 12:31:52 -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 1qjMal-0003pm-U7 for bug-gnu-emacs@gnu.org; Thu, 21 Sep 2023 12:31:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qjMav-0001rJ-V6 for bug-gnu-emacs@gnu.org; Thu, 21 Sep 2023 12:32:01 -0400 Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Sep 2023 16:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 65475 X-GNU-PR-Package: emacs Mail-Followup-To: 65475@debbugs.gnu.org, philipk@posteo.net, samsonov.box@gmail.com Original-Received: via spool by 65475-done@debbugs.gnu.org id=D65475.16953138857087 (code D ref 65475); Thu, 21 Sep 2023 16:32:01 +0000 Original-Received: (at 65475-done) by debbugs.gnu.org; 21 Sep 2023 16:31:25 +0000 Original-Received: from localhost ([127.0.0.1]:34712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjMaK-0001qE-PW for submit@debbugs.gnu.org; Thu, 21 Sep 2023 12:31:25 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:49779) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjMaI-0001q1-Je for 65475-done@debbugs.gnu.org; Thu, 21 Sep 2023 12:31:23 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id D9F77240101 for <65475-done@debbugs.gnu.org>; Thu, 21 Sep 2023 18:31:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1695313866; bh=sHdEip95y6v/lFqy2RKaheHiFGybTFCITBflaPZi/uE=; h=From:To:Cc:Subject:Autocrypt:Date:Message-ID:MIME-Version:From; b=pD/OXfZXI01Yzxp79qxuXPhNvZ4ftoxieR0MowFKA1nzAVqnT0I60Mi0/T6qfacVO k6xf4wjabpZcPeWA0U/WDQmC6/d34zWEbFcc8sroD/+WlRMe7Zn0JWW89txU13lRaq /pHoTYcL8ujO4yeT+blA4PaCWe7/K3DLiU3TlFp8+rlDnSfVw0jzaOs9TE4KaYbHPt ssJOeRRW1ax3PVAxOP4A9bnzZnXRebCncv9akEKz1C8Zyq9H5821Rg0g7gvTj9kEWD 90DlDnmXnmpG9JICIMB3GbQAEHHjO1xb2hSWaglnIV2NdTzM0LDflkOzvXdbD0j9+s MSpOMCFfqGUaQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Rs19j3VYXz9s1C; Thu, 21 Sep 2023 18:31:05 +0200 (CEST) In-Reply-To: <87led7opd5.fsf@posteo.net> (Philip Kaludercic's message of "Fri, 15 Sep 2023 07:41:10 +0000") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:271004 Archived-At: Philip Kaludercic writes: > 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: > >>>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)." I have pushed the change, and am closing the bug again. Thanks to everyone for helping.