From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted Date: Thu, 14 Sep 2023 07:27:52 -0700 Message-ID: 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: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14536"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Andrey Samsonov , Eli Zaretskii , Eshel Yaron , Stefan Monnier , 65475@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 14 16:29:12 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 1qgnLE-0003U9-Fd for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Sep 2023 16:29:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qgnL2-0004S8-80; Thu, 14 Sep 2023 10:29:00 -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 1qgnKy-0004Ot-TY for bug-gnu-emacs@gnu.org; Thu, 14 Sep 2023 10:28:57 -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 1qgnKy-0006gO-M2 for bug-gnu-emacs@gnu.org; Thu, 14 Sep 2023 10:28:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qgnL4-0007vl-8b for bug-gnu-emacs@gnu.org; Thu, 14 Sep 2023 10:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Sep 2023 14:29:02 +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.169470168930424 (code B ref 65475); Thu, 14 Sep 2023 14:29:02 +0000 Original-Received: (at 65475) by debbugs.gnu.org; 14 Sep 2023 14:28:09 +0000 Original-Received: from localhost ([127.0.0.1]:40754 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnKC-0007ue-FM for submit@debbugs.gnu.org; Thu, 14 Sep 2023 10:28:08 -0400 Original-Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:51314) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnK9-0007uA-WD for 65475@debbugs.gnu.org; Thu, 14 Sep 2023 10:28:07 -0400 Original-Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2bf66a32f25so15708901fa.2 for <65475@debbugs.gnu.org>; Thu, 14 Sep 2023 07:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694701674; x=1695306474; 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=moEMwETHIqGw23+/lmkPKIX5KzvUCIhvMjhefac8nNM=; b=Ia2GhBYexP4E+aDXSU2kvZMIk/C3SuHkDiqfhHlj6vNGj/RWyidBaAyCw0NvPQESE3 MJ72IHuUwiDQyf28XcIFRplFsNncqwhdndHbg8l7I2VWlV6wFbAE9z7l8qjirxv6o5yQ TGX9LzbpiiQllBgMo82AvmTnFEETlgr+OC6+69gltW6NGwJGIM35bmVNTO50pqlYqzHF 86QZfNKtlG+8cHd7Y4C1CCN5IPjeMReA0pkrpGd4TpEN9jBsUk3eQQBSC3dUfSqLfIVg EPf4DnsZT8NGbcDJfsuxCeRkmcpf1dfRqxkNCX6fGFkzdfqJsfI4tnRaDxYzMpT5C65z gXBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694701674; x=1695306474; 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=moEMwETHIqGw23+/lmkPKIX5KzvUCIhvMjhefac8nNM=; b=m+6NvgTD29WSmnvGWv/X+s0Y4Oog/ezfbxOquYoMhbq+BOCOr2gF3qf5RXsVAHRie2 Isc/W+hjtl/nlE61/yYFhk8vb2CXjpWzUiXPy4ca8/OEFcLbKQ+PkRc5sVFQXgZxSslX ZTgyNa9GeyhjtKbhLOULDh5OmptWbyfA9kLm2Etw1AJqihkGoolUyvpRWUtxptYBXDVy MSILDSwfdu9INvY+/jCxPwoDlDJTMroNnm1xiV+KJBHiREScphh8dR2GQzj3Wjqi+s8q DuC8Apuy3hDXHHoQD0SbBXhQsE9DtxAKvZuzqECLbNzad58A1p2cR2aaY4Ib61rKHfnF XukA== X-Gm-Message-State: AOJu0YxBntJ4R+s9jJz8ziatRUHhGhgFnImumpnW3B/LuHmmmmb/dqe9 mymikIRE59D0Cc3CckEYParRkAw2GCj7XXPUOgU= X-Google-Smtp-Source: AGHT+IHXdivtbml8orsbnuYoyn8NEoLMrdRdwP759GT6X8KrL5j/iLXoQMEyV52+7uY3B6PBvHGxzXoYGXjna7sN71A= X-Received: by 2002:a2e:960e:0:b0:2bf:789e:b5dd with SMTP id v14-20020a2e960e000000b002bf789eb5ddmr4716016ljh.53.1694701673890; Thu, 14 Sep 2023 07:27:53 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 14 Sep 2023 07:27:53 -0700 In-Reply-To: <87sf7goq8u.fsf@posteo.net> 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:270436 Archived-At: 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"? > + (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: > + (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