From unknown Fri Aug 15 16:17:59 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#64106 <64106@debbugs.gnu.org> To: bug#64106 <64106@debbugs.gnu.org> Subject: Status: `modify-services` no longer affects multiple instances of the same service Reply-To: bug#64106 <64106@debbugs.gnu.org> Date: Fri, 15 Aug 2025 23:17:59 +0000 retitle 64106 `modify-services` no longer affects multiple instances of the= same service reassign 64106 guix submitter 64106 "David Wilson" severity 64106 important thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 16 09:01:12 2023 Received: (at submit) by debbugs.gnu.org; 16 Jun 2023 13:01:12 +0000 Received: from localhost ([127.0.0.1]:48773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qA94h-0008Qp-Rl for submit@debbugs.gnu.org; Fri, 16 Jun 2023 09:01:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:52556) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qA94f-0008Qg-Lc for submit@debbugs.gnu.org; Fri, 16 Jun 2023 09:01:10 -0400 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 1qA94U-0004Xf-8M for bug-guix@gnu.org; Fri, 16 Jun 2023 09:01:04 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qA94P-0005mj-TN; Fri, 16 Jun 2023 09:00:57 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id BC4605C013C; Fri, 16 Jun 2023 08:51:58 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute1.internal (MEProxy); Fri, 16 Jun 2023 08:51:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daviwil.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm3; t=1686919918; x=1687006318; bh=WC4TCAtZQKATVADUSi+kDboxz J7y7As7K3Tie7wNuhY=; b=B0WHZW9qEbYPHrPl0ey5uhLKQ5L80Jb8fFN9MwQKn RkDzQEwqrm9gS/0jxYHSyt3Qvq2a+PwzxoLcKAUkDFOVMp9wv+cuOYk2lb07/ldV pXVfc+twwI75xvgNqtXZE4w71Hn8GWATDGKsTmtTOYdJYklUiV9xAhUVU2I/kDQr zepIWQck0XI8zxVPCq/xofliZfVhG9zhYTomJHZANdQ/3sj0pjcwLkdQJb2UVL8R OBwIH2SGyZ20eYoAXvsPeikL+pojuzuu84ghInOPhywHP6pMhbVg/tDj1ceTzy4z I4EHxDj0jiG4GinbwjP8yR/u4jPZHe05mw/WBAaxdoyOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1686919918; x=1687006318; bh=WC4TCAtZQKATVADUSi+kDboxzJ7y7As7K3T ie7wNuhY=; b=b9N0C1vXzGF/LyOQyPaCpDg9thX0Vz/HyOpMadgHN0M1y0WoV6n Xjc6Ui9XezduP8LrpAhAcPQaUaDV0+Vn0QdeFGmDLf/undNAMWqIyYD/2suTlEaI ayKxytpkjOaWAiX3QtRE7J9FewN2uIPSiCFNkBOMwaIGNsaUukLGtL2AbwOigByy nOIf7qfyLZ9J9wpHd/2BVOgZgWe47B12hh4hV7EWIYHjybhKe4g3JqIBYozqQnjs ld2MlzKAYKUzRqD1NU/fJ04WcBASnzEQS4KRER2e0Pem91LexVaycZ0iz2lFBub5 Ezf0u266lFMPWOk3bZLcTyW//05LY91bTdw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedvgedgheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkfffhvfevufgtsehttdertderredtnecuhfhrohhmpedfffgrvhhi ugcuhghilhhsohhnfdcuoegurghvihgusegurghvihifihhlrdgtohhmqeenucggtffrrg htthgvrhhnpeelkeefgfekgeevfeefjeetgffggeegffdtuddugeetledvieefiedtieel heelgfenucffohhmrghinhepghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpegurghvihgusegurghvihifihhlrdgtohhm X-ME-Proxy: Feedback-ID: iba684179:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 4904531A0063; Fri, 16 Jun 2023 08:51:58 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-496-g8c46984af0-fm-20230615.001-g8c46984a Mime-Version: 1.0 Message-Id: Date: Fri, 16 Jun 2023 15:52:30 +0300 From: "David Wilson" To: bug-guix@gnu.org Subject: `modify-services` no longer affects multiple instances of the same service Content-Type: text/plain Received-SPF: none client-ip=66.111.4.26; envelope-from=david@daviwil.com; helo=out2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?Q?Ludovic_Court=C3=A8s?= 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 (---) Hi Guix! Recently there was a change to the behavior of `modify-services` that adds logic to check for any unused clauses so that an exception can be raised to alert the user of this case. https://git.savannah.gnu.org/cgit/guix.git/commit/?id=181951207339508789b28ba7cb914f983319920f It seems that the new logic has a bug that prevents a used clause from being executed on more than one instance of a compatible service in a single execution of `modify-services`. Here's a new test case for `gnu/tests/services.scm` that exhibits the issue: ``` (test-equal "modify-services: delete multiple services of the same type" '(1 3) (let* ((t1 (service-type (name 't1) (extensions '()) (description ""))) (t2 (service-type (name 't2) (extensions '()) (description ""))) (t3 (service-type (name 't3) (extensions '()) (description ""))) (services (list (service t1 1) (service t2 2) (service t2 2) (service t3 3)))) (map service-value (modify-services services (delete t2))))) ``` Here's the output of the test: ``` test-name: modify-services: delete multiple services of the same type location: /home/daviwil/Projects/Code/guix/tests/services.scm:325 source: + (test-equal + "modify-services: delete multiple services of the same type" + '(1 3) + (let* ((t1 (service-type + (name 't1) + (extensions '()) + (description ""))) + (t2 (service-type + (name 't2) + (extensions '()) + (description ""))) + (t3 (service-type + (name 't3) + (extensions '()) + (description ""))) + (services + (list (service t1 1) + (service t2 2) + (service t2 2) + (service t3 3)))) + (map service-value + (modify-services services (delete t2))))) expected-value: (1 3) actual-value: (1 2 3) result: FAIL ``` The problem occurs because of this `fold2` logic in `apply-clauses` of gnu/services.scm`: ``` (fold2 (lambda (clause service remainder) (if service (match clause ((kind proc properties) (if (eq? kind (service-kind service)) (values (proc service) remainder) (values service (cons clause remainder))))) (values #f (cons clause remainder)))) head '() clauses))) ``` In the #t case of checking the service kind, `(values (proc service remainder)` is returned, meaning the successful clause is not being added back to the list of clauses as `fold2` continues. Any subsequent items of the service list will no longer be tested against the removed clause. I believe this function's logic needs to be updated to keep a list of successful clauses to be diffed against the full clause list at the end of `apply-clauses` so that the unapplied clause list can be determined without having to remove successful clauses in-flight. If anyone has any pointers on the best way to approach this, I'll be happy to submit a patch! David From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 17 11:51:25 2023 Received: (at 64106) by debbugs.gnu.org; 17 Jun 2023 15:51:25 +0000 Received: from localhost ([127.0.0.1]:52449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAYCy-0003rG-OG for submit@debbugs.gnu.org; Sat, 17 Jun 2023 11:51:24 -0400 Received: from jpoiret.xyz ([206.189.101.64]:50256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAYCw-0003r3-AD; Sat, 17 Jun 2023 11:51:23 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 21D4018519E; Sat, 17 Jun 2023 15:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1687017079; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2X9y4AjShctMzNnob7JJfL5Kb/k/A1oulqrn0YRZkUU=; b=OejHPN3G4kYrp3DRPnS5p+XwCwMWuOXWKQQVUIFANInkDCPh/eUkOqdtD7DVUh9u5iZQgH GQ5PKhaVWvMUT2I/MrnaKk+VVHrsot120MVblL9cEQQ2f+JksrbPcGNSy5Wyypiy3snjqp 8uvYJYn4dqt/mVDQ4Sj4cxOXztlgCQzuLXf2j+qzB9BQQlyAkbOfgkwMjS7TFPXbShYdVc nMJFNb117IYR7Px3hYj4HUKtvrfJGJfE517dPcXNsAPj6lLskNTIh96Hz8gIYA1N5l2U0X BHfO45qxkxSkmp50aQZhEbrOg1WUwf+vHiQUUmiALwVecAhlDQYziKkOaS2alQ== From: Josselin Poiret To: David Wilson , 64106@debbugs.gnu.org Subject: Re: bug#64106: `modify-services` no longer affects multiple instances of the same service In-Reply-To: References: Date: Sat, 17 Jun 2023 17:51:13 +0200 Message-ID: <878rci5bpq.fsf@jpoiret.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spamd-Bar: / Authentication-Results: jpoiret.xyz; auth=pass smtp.auth=jpoiret@jpoiret.xyz smtp.mailfrom=dev@jpoiret.xyz X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64106 Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , control@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: 0.0 (/) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable merge 64106 63921 thankyou Hi David, "David Wilson" writes: > Hi Guix! > > Recently there was a change to the behavior of `modify-services` that add= s logic to check for any unused clauses so that an exception can be raised = to alert the user of this case. > > https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D18195120733950878= 9b28ba7cb914f983319920f > > It seems that the new logic has a bug that prevents a used clause from be= ing executed on more than one instance of a compatible service in a single = execution of `modify-services`. Here's a new test case for `gnu/tests/serv= ices.scm` that exhibits the issue: This was intended, but was probably not a good idea. I'll look into how we could revert this while keeping the main idea of the change. Best, =2D-=20 Josselin Poiret --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHEBAEBCgAuFiEEOSSM2EHGPMM23K8vUF5AuRYXGooFAmSN1nEQHGRldkBqcG9p cmV0Lnh5egAKCRBQXkC5FhcaimTNC/4jcMiK50ZYhTPxk0MEjWFGlbshJxz/BQly u25PwmvOhbAI7JWlJJihr/C01wknQIOd770iWQc0qoUoDkghjNfR6+L9vLZJ/Luk TpTmJaxZjujS1rgixgM9+qzYVujjn3VC/AwAu+oDDsonwFCZTT08VTGyxWe0vpkx LxEKd0tqliaI5o0bvk3q/2ktZE7vmkXnLfsGKe5TxNtc2les7Xbycwnbp/JbTH3G 16rD6xugDqpGvKZ9nmhaXFk24UAAEDwDS10UJ5YOf+N33m+tXrelJiNejmY+t/Zo 2bqtF5Y4rJzKJEwHxSGcD2mkDlCfwR+sYqLHYi4hZLGu0cgAe+1F2fDHNm5ilaSk L9+UkKerFwKvR+wyTOCNE73oCnIBca0GHUKj1bdPXzogilDCbe50DpG78HhW/0D5 y6D0Om11aipHFOnLmNWitNJgxgHBCocpFQx5F8e80eSFT/mj3pAKFAJ+cCdmwAjr qtt/XhoREOup75TRGJL7d25huNuGRFk= =LHlO -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 19 03:33:26 2023 Received: (at control) by debbugs.gnu.org; 19 Jun 2023 07:33:26 +0000 Received: from localhost ([127.0.0.1]:55443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qB9OA-0006Qs-Ei for submit@debbugs.gnu.org; Mon, 19 Jun 2023 03:33:26 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:6012) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qB9O7-0006Qb-T9 for control@debbugs.gnu.org; Mon, 19 Jun 2023 03:33:24 -0400 Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=ludo@gnu.org; dmarc=fail (p=none dis=none) d=gnu.org X-IronPort-AV: E=Sophos;i="6.00,254,1681164000"; d="scan'208";a="59079608" Received: from unknown (HELO ribbon) ([193.50.110.184]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 09:33:17 +0200 Date: Mon, 19 Jun 2023 09:33:17 +0200 Message-Id: <87jzvzdhz6.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #64106 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 1.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: -0.0 (/) severity 64106 important quit From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 19 03:34:39 2023 Received: (at 64106) by debbugs.gnu.org; 19 Jun 2023 07:34:39 +0000 Received: from localhost ([127.0.0.1]:55448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qB9PK-0006Sr-Ox for submit@debbugs.gnu.org; Mon, 19 Jun 2023 03:34:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57314) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qB9PI-0006Sd-4O for 64106@debbugs.gnu.org; Mon, 19 Jun 2023 03:34:37 -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 1qB9PC-0002iC-NC; Mon, 19 Jun 2023 03:34:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=/d0dK4E90iGsQPOXDkPro0XsZfUisBrIpXR/kviCe0U=; b=JjZJwzS/xgeY9tRGaQI7 NYCCDUZjaX7IqbLOni5Ed/YWshKiu6wJmpSitOnZ6i3nU+xUPYEgfr5sLuPp32h3qb8PnThaAYOgc /Bn5VJ0nypRuRnVEFDdK8s7CatfV9QaMGAGs5DU2kk6yB9DcIk7KXLfquu1f5kyEtCHVFMP/DxWu+ oOJZiy9/0z8I46NtCoXpulgkG1W9cWHaC7sNtxVkTl7IONhf8IMrgg2aBJt1hfuX7ksNZr178Bay4 ooM4C4/0um3LE2e8oPPefl3H5A05I4TJy9g7km0qsdmno4soWU6fLkiefgIa/0KQlRTVvWu2jlx+G bxBV28R/hvx9kg==; Received: from [193.50.110.184] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qB9PC-0002nl-AT; Mon, 19 Jun 2023 03:34:30 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Josselin Poiret Subject: Re: bug#64106: `modify-services` no longer affects multiple instances of the same service References: <878rci5bpq.fsf@jpoiret.xyz> Date: Mon, 19 Jun 2023 09:34:28 +0200 In-Reply-To: <878rci5bpq.fsf@jpoiret.xyz> (Josselin Poiret's message of "Sat, 17 Jun 2023 17:51:13 +0200") Message-ID: <87fs6ndhx7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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: 64106 Cc: 64106@debbugs.gnu.org, David Wilson 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 (---) Hi, Josselin Poiret skribis: > "David Wilson" writes: > >> Hi Guix! >> >> Recently there was a change to the behavior of `modify-services` that ad= ds logic to check for any unused clauses so that an exception can be raised= to alert the user of this case. >> >> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=3D1819512073395087= 89b28ba7cb914f983319920f >> >> It seems that the new logic has a bug that prevents a used clause from b= eing executed on more than one instance of a compatible service in a single= execution of `modify-services`. Here's a new test case for `gnu/tests/ser= vices.scm` that exhibits the issue: > > This was intended, but was probably not a good idea. It wasn=E2=80=99t really intended, more a side effect of the implementation= , and I agree it should be fixed. Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 21 14:10:14 2023 Received: (at 64106) by debbugs.gnu.org; 21 Jun 2023 18:10:14 +0000 Received: from localhost ([127.0.0.1]:34190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qC2HW-0006vY-1g for submit@debbugs.gnu.org; Wed, 21 Jun 2023 14:10:14 -0400 Received: from coleridge.kublai.com ([166.84.7.167]:59340 helo=mail.spork.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qC2HU-0006vR-6W for 64106@debbugs.gnu.org; Wed, 21 Jun 2023 14:10:13 -0400 Received: from psyduck (ool-18b8e9e7.dyn.optonline.net [24.184.233.231]) by mail.spork.org (Postfix) with ESMTPSA id 8F8B5F361; Wed, 21 Jun 2023 14:10:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=spork.org; s=dkim; t=1687371011; bh=bZWn/DZwcfMXaecTvdzR/7IWM+A5e848k7iWM2YFJMI=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=pNKeaYJ0nerz/B0d9WNKg0vOzLHPPSzZfds8fCoaw6or4ENCuWfOMIcjQEa4T2rU0 O/L0NG1YXPsvIxH9j9JUGLncPGr/AJMaw4hqTj9fI9v5NmAOhbHtWRkqVFa4wjNuaa vmBxoEAiQqPFF5UoxGEjdl0yFwPsXl1SiKISbDX0= From: Brian Cully To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#64106: `modify-services` no longer affects multiple instances of the same service In-Reply-To: <87fs6ndhx7.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Mon, 19 Jun 2023 09:34:28 +0200") References: <878rci5bpq.fsf@jpoiret.xyz> <87fs6ndhx7.fsf@gnu.org> Date: Wed, 21 Jun 2023 14:10:06 -0400 Message-ID: <87r0q4d6v5.fsf@psyduck.jhoto.kublai.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64106 Cc: Josselin Poiret , David Wilson , 64106@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 (-) Ludovic Court=C3=A8s writes: > It wasn=E2=80=99t really intended, more a side effect of the implementati= on, and > I agree it should be fixed. There have been a number of complaints about the behavior change, and I think the patch should probably be reverted. My only intention was to raise an error for the cases where a service was used in =E2=80=98modify-services=E2=80=99 that wasn't defined, as that's something = people would probably want to know about and fix, but the sequelae to that change have changed the primary behavior of =E2=80=98modify-services=E2=80=99 in a= disruptive way (and without a corresponding news item). I've taken a number of stabs at tweaking the current code to satisfy both my desire to raise an error for mis-configurations as well as match every instance of a service, but I can't find a way to do it that also preserves service ordering. However, if =E2=80=98modify-services=E2=80=99 can be changed to do two pass= es, the first as a sanity check which verifies service references and raises errors, and the second to do the actual modification, that should work well. I'm not concerned with efficiency particularly. Unless there are many thousands of services I sincerely doubt anyone would notice the extra pass, even on a Raspberry Pi. WDYT? -bjc From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 26 15:23:02 2023 Received: (at 64106) by debbugs.gnu.org; 26 Jun 2023 19:23:02 +0000 Received: from localhost ([127.0.0.1]:47093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDrni-0004CE-Bc for submit@debbugs.gnu.org; Mon, 26 Jun 2023 15:23:02 -0400 Received: from sail-ipv4.us-core.com ([208.82.101.137]:54032) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDrne-0004C4-SM for 64106@debbugs.gnu.org; Mon, 26 Jun 2023 15:23:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=TuWjO8u/VNkrUHT F6zFgm9EW1zti7qmtPsaulD4OidY=; h=date:subject:cc:to:from; d=lease-up.com; b=eFo0NJgrmaxMvdQ0RA9BHoVanMGZjmb6valmyqCOhVF5tHmgBppD IlcfZtOtVAGaOsa/i+1xrE6acuuS2/Vx7glMXThnK6odXsES8w1OoxOOXZDNuG6nojr2Mt DZe5WxmBbdeVmAXyWj2PP2dbQwlCQ+V0FNooPQYW1OU3aX/EQ= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 886f089f (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Mon, 26 Jun 2023 19:22:57 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 220081ca; Mon, 26 Jun 2023 19:22:56 +0000 (UTC) From: Felix Lechner To: 64106@debbugs.gnu.org Subject: [PATCH] In modify-services, delete multiple services with one stanza. (Closes: #63921, #64106) Date: Mon, 26 Jun 2023 12:22:17 -0700 Message-Id: <85c8a4ded1532e8fe480d17a91d9a2e93554df11.1687807313.git.felix.lechner@lease-up.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 64106 Cc: Josselin Poiret , Bruno Victal , Brian Cully , =?UTF-8?q?Ludovic=20Court=C3=A8s?= , pelzflorian , Jelle Licht , David Wilson , Felix Lechner 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.8 (/) With this commit, modify-services will delete all instances of the services that match the indicated service-type. At the same time, it will also raise errors for misconfigurations. The patch was motivated by Brian Cully's statements about the difficult tradeoff here. [1] Using the changes respectfully submitted there, modify-services will extract the "delete" clauses from the clause-alist via code inspired by SRFI-1's lset-difference. It applies those deletions first, before then passing the remaining clauses (and the remaining services) on to apply-clauses. It is possible that apply-clauses can also be simplified since the "delete" case is now gone, but I remain unsure about how to do that. This commit was lightly tested on a production machine. The author owes a deep debt of gratitude to Zipheir from the IRC channel Libera:#scheme for their expert help in understanding the problem and in coming up with an elegant solution. Similarly, Bruno Victal (aka mirai) provided major encouragment with his participation in the same conversation. Thank you to both of you! [1] https://issues.guix.gnu.org/64106#4 * gnu/services.scm: In modify-services, delete multiple services with one stanza. (Closes: #63921, #64106) --- gnu/services.scm | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/gnu/services.scm b/gnu/services.scm index 109e050a23..f3772ad6b9 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -46,6 +46,7 @@ (define-module (gnu services) #:use-module (gnu packages hurd) #:use-module (gnu system setuid) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-8) #:use-module (srfi srfi-9) #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-26) @@ -305,8 +306,7 @@ (define-syntax clause-alist is the source location information." ((_ (delete kind) rest ...) (cons (list kind - (lambda (service) - #f) + #f (current-source-location)) (clause-alist rest ...))) ((_ (kind param => exp ...) rest ...) @@ -320,6 +320,16 @@ (define-syntax clause-alist ((_) '()))) +(define (clause-kind clause) + (match clause + ((kind _ _) + kind))) + +(define (clause-proc clause) + (match clause + ((_ proc _) + proc))) + (define (apply-clauses clauses services) "Apply CLAUSES, an alist as returned by 'clause-alist', to SERVICES, a list of services. Use each clause at most once; raise an error if a clause was not @@ -393,7 +403,29 @@ (define-syntax modify-services all the MINGETTY-SERVICE-TYPE instances, and it deletes instances of the UDEV-SERVICE-TYPE." ((_ services clauses ...) - (apply-clauses (clause-alist clauses ...) services)))) + (receive (others deletes) (partition clause-proc (clause-alist clauses ...)) + (let ((reduced-services (remove (lambda (service) + (find (lambda (clause) + (eq? (clause-kind clause) + (service-kind service))) + deletes)) + services)) + (deletes-not-found (remove (lambda (clause) + (find (lambda (service) + (eq? (clause-kind clause) + (service-kind service))) + services)) + deletes))) + (for-each (lambda (clause) + (raise (make-compound-condition + (condition + (&error-location + (location (current-source-location)))) + (formatted-message + (G_ "modify-services: cannot delete '~a'; not present in service list") + (service-type-name (clause-kind clause)))))) + deletes-not-found) + (apply-clauses others reduced-services)))))) ;;; base-commit: 269cfe341f242c2b5f37774cb9b1e17d9aa68e2c -- 2.40.1 From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 07 10:11:53 2023 Received: (at 64106) by debbugs.gnu.org; 7 Jul 2023 14:11:54 +0000 Received: from localhost ([127.0.0.1]:43553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHmBd-0005sr-Kp for submit@debbugs.gnu.org; Fri, 07 Jul 2023 10:11:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qHmBb-0005se-4R for 64106@debbugs.gnu.org; Fri, 07 Jul 2023 10:11:52 -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 1qHmBV-0003NZ-Lo; Fri, 07 Jul 2023 10:11:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=Mcn8ZkyzVzL76qs/zD/RvPnOuyArK+ZFc7gyJrwjOOo=; b=o3vs1+WEiTYkYqOS6ZK1 0YfODHIG+FaIDO40W4/1XHotZXuNaMss/HZmBBUhVpifT9Kf2eV3ONbhmtm2r0M1OTGzMiuPVGFsA 78ZM2CB65wZtwBabFu803cs1+Bw0Pp2atYo5E4uhjjTsI/B7mItQRpl8rAxgfv0kGxQpMPNsemCfQ aWOKy1ncerc6ojHu2iLq3zvfcbZbP56tiWSW6DwSVOwMryk1cOylwVNTZV2v1qlRqD0Smch8t/U1g 3hr9L1spWOWBPmlGTj8rasKj3eIT3tEPusUNBJm5KrQz2tUMOrz/kbwnI35oPBlZJaKUUedTxdDgt e0o/bUAUaUmkNw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHmBV-0000w5-9G; Fri, 07 Jul 2023 10:11:45 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Brian Cully Subject: Re: bug#64106: `modify-services` no longer affects multiple instances of the same service References: <878rci5bpq.fsf@jpoiret.xyz> <87fs6ndhx7.fsf@gnu.org> <87r0q4d6v5.fsf@psyduck.jhoto.kublai.com> Date: Fri, 07 Jul 2023 16:11:43 +0200 In-Reply-To: <87r0q4d6v5.fsf@psyduck.jhoto.kublai.com> (Brian Cully's message of "Wed, 21 Jun 2023 14:10:06 -0400") Message-ID: <878rbrke00.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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: 64106 Cc: Josselin Poiret , David Wilson , 64106@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 (---) Hi, Brian Cully skribis: > However, if =E2=80=98modify-services=E2=80=99 can be changed to do two pa= sses, the first > as a sanity check which verifies service references and raises errors, > and the second to do the actual modification, that should work well. I'm > not concerned with efficiency particularly. Unless there are many > thousands of services I sincerely doubt anyone would notice the extra > pass, even on a Raspberry Pi. Yeah I think we=E2=80=99ll have to do two passes, or to revert the whole th= ing. The former sounds preferable for me. Could you work on a patch? Thanks in advance! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 17 13:03:06 2023 Received: (at 64106) by debbugs.gnu.org; 17 Jul 2023 17:03:06 +0000 Received: from localhost ([127.0.0.1]:50837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLRco-0002iu-1y for submit@debbugs.gnu.org; Mon, 17 Jul 2023 13:03:06 -0400 Received: from coleridge.kublai.com ([166.84.7.167]:51893 helo=mail.spork.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLRcj-0002iP-3J for 64106@debbugs.gnu.org; Mon, 17 Jul 2023 13:03:04 -0400 Received: from psyduck.jhoto.kublai.com (ool-18b8e9e7.dyn.optonline.net [24.184.233.231]) by mail.spork.org (Postfix) with ESMTPSA id 8CCAE3689; Mon, 17 Jul 2023 13:02:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=spork.org; s=dkim; t=1689613350; bh=wznLu54wUL2Qn+9jlfQ+V7taIEXgJpNCPGXJiXPIqZ8=; h=From:To:Cc:Subject:Date; b=U+kg1F1Daaju3aynLPJKJ6BSlFAClc+F0SgzeSa2aTC8dmsqDZsR7V8UVkaquF8qx G6gjFx5+zWQBKm2KbDJxzhARtBwf8wM1/GeVM9wSJgWX+G0MNtBXXm0b06JFUAe+5V oN3H40kMInNwDcyzMugPkJCNP1DQHibPNQWtJ5as= From: Brian Cully To: 64106@debbugs.gnu.org Subject: [PATCH] gnu: services: Revert to deleting and updating all matching services Date: Mon, 17 Jul 2023 13:02:19 -0400 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64106 Cc: Brian Cully 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 (-) This patch reverts the behavior introduced in 181951207339508789b28ba7cb914f983319920f which caused ‘modify-services’ clauses to only match a single instance of a service. We will now match all service instances when doing a deletion or update, while still raising an exception when trying to match against a service that does not exist in the services list, or which was deleted explicitly by a ‘delete’ clause (or an update clause that returns ‘#f’ for the service). Fixes: #64106 * gnu/services.scm (%modify-services): New procedure. (modify-services): Use it. (apply-clauses): Add DELETED-SERVICES argument, change to modify one service at a time. * tests/services.scm ("modify-services: delete then modify"), ("modify-services: modify then delete"), ("modify-services: delete multiple services of the same type"), ("modify-services: modify multiple services of the same type"): New tests. --- gnu/services.scm | 95 +++++++++++++++++++++++++++------------------- tests/services.scm | 68 +++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 39 deletions(-) diff --git a/gnu/services.scm b/gnu/services.scm index 109e050a23..4c5b9b16df 100644 --- a/gnu/services.scm +++ b/gnu/services.scm @@ -320,45 +320,62 @@ (define-syntax clause-alist ((_) '()))) -(define (apply-clauses clauses services) - "Apply CLAUSES, an alist as returned by 'clause-alist', to SERVICES, a list -of services. Use each clause at most once; raise an error if a clause was not -used." - (let loop ((services services) - (clauses clauses) - (result '())) - (match services - (() - (match clauses - (() ;all clauses fired, good - (reverse result)) - (((kind _ properties) _ ...) ;one or more clauses didn't match - (raise (make-compound-condition - (condition - (&error-location - (location (source-properties->location properties)))) - (formatted-message - (G_ "modify-services: service '~a' not found in service list") - (service-type-name kind))))))) - ((head . tail) - (let ((service clauses - (fold2 (lambda (clause service remainder) - (if service - (match clause - ((kind proc properties) - (if (eq? kind (service-kind service)) - (values (proc service) remainder) - (values service - (cons clause remainder))))) - (values #f (cons clause remainder)))) - head +(define (apply-clauses clauses service deleted-services) + (define (raise-if-deleted kind properties) + (match (find (lambda (deleted) + (match deleted + ((deleted-kind _) + (eq? kind deleted-kind)))) + deleted-services) + ((_ deleted-properties) + (raise (make-compound-condition + (condition + (&error-location + (location (source-properties->location properties)))) + (formatted-message + (G_ "modify-services: service '~a' was deleted here: ~a") + (service-type-name kind) + (source-properties->location deleted-properties))))) + (_ #t))) + + (match clauses + (((kind proc properties) . rest) + (begin + (raise-if-deleted kind properties) + (if (eq? (and service (service-kind service)) + kind) + (let ((new-service (proc service))) + (apply-clauses rest new-service + (if new-service + deleted-services + (cons (list kind properties) + deleted-services)))) + (apply-clauses rest service deleted-services)))) + (() + service))) + +(define (%modify-services services clauses) + (define (raise-if-not-found clause) + (match clause + ((kind _ properties) + (when (not (find (lambda (service) + (eq? kind (service-kind service))) + services)) + (raise (make-compound-condition + (condition + (&error-location + (location (source-properties->location properties)))) + (formatted-message + (G_ "modify-services: service '~a' not found in service list") + (service-type-name kind)))))))) + + (for-each raise-if-not-found clauses) + (reverse (filter-map identity + (fold (lambda (service services) + (cons (apply-clauses clauses service '()) + services)) '() - clauses))) - (loop tail - (reverse clauses) - (if service - (cons service result) - result))))))) + services)))) (define-syntax modify-services (syntax-rules () @@ -393,7 +410,7 @@ (define-syntax modify-services all the MINGETTY-SERVICE-TYPE instances, and it deletes instances of the UDEV-SERVICE-TYPE." ((_ services clauses ...) - (apply-clauses (clause-alist clauses ...) services)))) + (%modify-services services (clause-alist clauses ...))))) ;;; diff --git a/tests/services.scm b/tests/services.scm index 20ff4d317e..98b584f6c0 100644 --- a/tests/services.scm +++ b/tests/services.scm @@ -370,4 +370,72 @@ (define-module (test-services) (modify-services services (t2 value => 22))))) +(test-error "modify-services: delete then modify" + #t + (let* ((t1 (service-type (name 't1) + (extensions '()) + (description ""))) + (t2 (service-type (name 't2) + (extensions '()) + (description ""))) + (t3 (service-type (name 't3) + (extensions '()) + (description ""))) + (services (list (service t1 1) (service t2 2) (service t3 3)))) + (map service-value + (modify-services services + (delete t2) + (t2 value => 22))))) + +(test-equal "modify-services: modify then delete" + '(2 3) + (let* ((t1 (service-type (name 't1) + (extensions '()) + (description ""))) + (t2 (service-type (name 't2) + (extensions '()) + (description ""))) + (t3 (service-type (name 't3) + (extensions '()) + (description ""))) + (services (list (service t1 1) (service t2 2) (service t3 3)))) + (map service-value + (modify-services services + (t1 value => 11) + (delete t1))))) + +(test-equal "modify-services: delete multiple services of the same type" + '(1 3) + (let* ((t1 (service-type (name 't1) + (extensions '()) + (description ""))) + (t2 (service-type (name 't2) + (extensions '()) + (description ""))) + (t3 (service-type (name 't3) + (extensions '()) + (description ""))) + (services (list (service t1 1) (service t2 2) + (service t2 2) (service t3 3)))) + (map service-value + (modify-services services + (delete t2))))) + +(test-equal "modify-services: modify multiple services of the same type" + '(1 12 13 4) + (let* ((t1 (service-type (name 't1) + (extensions '()) + (description ""))) + (t2 (service-type (name 't2) + (extensions '()) + (description ""))) + (t3 (service-type (name 't3) + (extensions '()) + (description ""))) + (services (list (service t1 1) (service t2 2) + (service t2 3) (service t3 4)))) + (map service-value + (modify-services services + (t2 value => (+ value 10)))))) + (test-end) base-commit: 29a7bd209c7a37bbc0c46a18de6d81bf0569041b -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 18 08:29:18 2023 Received: (at 64106) by debbugs.gnu.org; 18 Jul 2023 12:29:18 +0000 Received: from localhost ([127.0.0.1]:51994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLjpO-0002YQ-0m for submit@debbugs.gnu.org; Tue, 18 Jul 2023 08:29:18 -0400 Received: from coleridge.kublai.com ([166.84.7.167]:56533 helo=mail.spork.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qLjpM-0002YE-24 for 64106@debbugs.gnu.org; Tue, 18 Jul 2023 08:29:16 -0400 Received: from psyduck (ool-18b8e9e7.dyn.optonline.net [24.184.233.231]) by mail.spork.org (Postfix) with ESMTPSA id 4AD91367A; Tue, 18 Jul 2023 08:28:35 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=spork.org; s=dkim; t=1689683325; bh=c74knQb4peH8Caz3rxhc3fFSjJuaM9/Y70TreJvA2co=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=j6RlQGJxSKnYNfi5JIcodc9oqFwwI+oSSJgh32V0d85CX8SsQI8cr4u4eUff2Mem5 wMjaA0MdIiIrzVCYI20vtFeUjC1JE5B1ymMVqLgLbo5zWdnEcS0W6iVINo5xsEy+p/ /aG8gh0GcQa9JtEqI3y8TgSf3KQx+RS2FLOi0jLU= From: Brian Cully To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#64106: `modify-services` no longer affects multiple instances of the same service In-Reply-To: <878rbrke00.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Fri, 07 Jul 2023 16:11:43 +0200") References: <878rci5bpq.fsf@jpoiret.xyz> <87fs6ndhx7.fsf@gnu.org> <87r0q4d6v5.fsf@psyduck.jhoto.kublai.com> <878rbrke00.fsf@gnu.org> Date: Tue, 18 Jul 2023 08:28:35 -0400 Message-ID: <878rbd1k0c.fsf@psyduck.jhoto.kublai.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64106 Cc: Josselin Poiret , David Wilson , 64106@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 (-) I sent a patch to this ticket yesterday, before remembering this morning that y'all probably weren't auto-Cc'd on it by debbugs. Please have a look over it, especially the tests, in case I missed some functionality or misinterpreted some requirements. This will probably be deserving of a news item, since it will cause multiple deletes on the same service type to fail, and that's what at least some people are doing due to the previous patch. One option would be to convert the =E2=80=98raise=E2=80=99 incantations to = warnings, at least for a while to give people a chance to update without their configs breaking, but I don't know a good way to do that. -bjc From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 09 13:49:10 2023 Received: (at control) by debbugs.gnu.org; 9 Aug 2023 17:49:10 +0000 Received: from localhost ([127.0.0.1]:40465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qTnJ0-00019Z-5F for submit@debbugs.gnu.org; Wed, 09 Aug 2023 13:49:10 -0400 Received: from tobias.gr ([80.241.217.52]:56850) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qTnIx-00019Q-Le for control@debbugs.gnu.org; Wed, 09 Aug 2023 13:49:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=8Qolz8ZZc7nJk 7Q86zvng7ZWXs49zsv6aaJ/ncalzXY=; h=to:from:date; d=tobias.gr; b=ftQPkt 9bSGXtY2ndbQSsQabGKiB6WpxOTyulREM8jAlZFXkMA2rqv66HwDehekfP5mjER832UPUz 0ip7j8rN9dV/NOd5DFrLx9k1jwvNUth6xPZubL5MxihflkHoRI3iJuK4GvYjES3e8poEA4 yUgjfpcafFlCT/JmKF0i441i1RHcpzu1c8Q8KIpsLKl8GwVBLw5VkHQrDNI0fRGjNtXc10 P70/quBwhR4Xww0D7nFYRRzWkzGrrSdasHIa87cfMXA7awgjUkoc1B/BDaX7a4BR5l9aQ1 jiGmeiCJZwLjGXdndaHWN6rckWk1ydrdCAaGvDb3ae1ztVE8zb+tVRjw== Received: by submission.tobias.gr (OpenSMTPD) with ESMTP id 64d7ef51 for ; Wed, 9 Aug 2023 17:49:04 +0000 (UTC) MIME-Version: 1.0 Date: Wed, 09 Aug 2023 19:49:04 +0200 From: Tobias Geerinckx-Rice To: control@debbugs.gnu.org Message-ID: <7381c9980c40714ebb8255e7ac7f0931@tobias.gr> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: severity 65184 important merge 64106 65184 thanks sigh Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject -0.0 T_SCC_BODY_TEXT_LINE No description available. 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 (+) severity 65184 important merge 64106 65184 thanks sigh From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 31 23:50:12 2023 Received: (at 64106-done) by debbugs.gnu.org; 1 Sep 2023 03:50:13 +0000 Received: from localhost ([127.0.0.1]:59596 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbvAh-0007un-TI for submit@debbugs.gnu.org; Thu, 31 Aug 2023 23:50:12 -0400 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]:46425) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbvAe-0007uR-TX; Thu, 31 Aug 2023 23:50:09 -0400 Received: by mail-qv1-xf2d.google.com with SMTP id 6a1803df08f44-64f3ad95ec0so8903426d6.1; Thu, 31 Aug 2023 20:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693540194; x=1694144994; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=eGy18eGgRKfNdbnU+Sv5c5Wvy3ZDwF1aF2rz5wTXkC0=; b=fwnp04B0vDItz1kJjt3gZfXLuiVjfrbG31b0I3KO7gQ+t2K0wg7ou/pvmpOIZPkv+H /9jMDIzu3pBbgeMNjdT8yseln/WZJXNzcJ9wH/JizeBo7U7h/RPwJeKWilOgrRNEdudl JIOYerIqoQ5TbwkQQt2pCgNlMsFYad5tIe7JldqcOa43DUfq0cZffjfgRMikwzTUfFua cV0hFuzBRSBcdMQuZVWuNelqdIRLxmxMkfw33AIjbna8a8WULUjmKzFmAfXq50xmIOkI z29deDLY5+sXH8HW6vI4adfMXM2b3v27NFUy6qawlm9J5kQP+vDNswLW5v6/th2xW6Y/ j+VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693540194; x=1694144994; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=eGy18eGgRKfNdbnU+Sv5c5Wvy3ZDwF1aF2rz5wTXkC0=; b=Y+QyCKSJlNf4JQSzOkewi5jRf7sn4G7aJ582YLHCyOnppaGQoQBhcJG+u1w6WMnwdp NXcmv8Lx7FLEmVZqM36QKGmC2AMxI6JzAzkzFQ85JnkLK7eM8JPZS9rcv+wGgbe7DKfu KOFu1FV8+BACqQtYTQ0UNvWnQbkPXwF3DvwKwl3ZUP6KuqIr+DFKgfP9YD88Q9tEZxhu U6D7XnQrIcMPC1WH4jvG2AdXPo/MUULObzDZ5L7EyR2GOHIxAG+U6kTijywBj2s8BfLl JHevPXgO0dcaeATptZlIEdVyUr3OgzIPp1VpcVxc+PoCl1QJEwE8KAtqTxfow1z3/0Rz Nrjw== X-Gm-Message-State: AOJu0Yw33QBKVoeJHeE+Vtb1Asbz969PiADsi+R+xjtanHDj0QRtnuRh t9DDTXjv2iCXlaXtkUJfHhCxSLmnim3RJQ== X-Google-Smtp-Source: AGHT+IFNQbPNUCAyOIRToryhPig0r6vVIdHjU5/CBQLOdmdShAP7XLHpuzVvJ+X0hA/QLiKIdbPlng== X-Received: by 2002:a0c:e009:0:b0:64d:f3c7:50aa with SMTP id j9-20020a0ce009000000b0064df3c750aamr1026424qvk.22.1693540194362; Thu, 31 Aug 2023 20:49:54 -0700 (PDT) Received: from hurd (dsl-10-128-23.b2b2c.ca. [72.10.128.23]) by smtp.gmail.com with ESMTPSA id j9-20020a0ce009000000b0064aa51f9978sm1115512qvk.115.2023.08.31.20.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 20:49:53 -0700 (PDT) From: Maxim Cournoyer To: Brian Cully Subject: Re: bug#65184: (modify-services =?utf-8?Q?=E2=80=A6?= (delete =?utf-8?Q?=E2=80=A6=29=29?= should delete all matching service types References: Date: Thu, 31 Aug 2023 23:49:52 -0400 In-Reply-To: (Brian Cully's message of "Mon, 17 Jul 2023 13:02:19 -0400") Message-ID: <87msy65z8f.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64106-done Cc: ludo@gnu.org, me@tobias.gr, david@daviwil.com, felix.lechner@lease-up.com, 65184-done@debbugs.gnu.org, 64106-done@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 (-) Hi Brian! Brian Cully writes: > This patch reverts the behavior introduced in > 181951207339508789b28ba7cb914f983319920f which caused =E2=80=98modify-ser= vices=E2=80=99 > clauses to only match a single instance of a service. > > We will now match all service instances when doing a deletion or update, = while > still raising an exception when trying to match against a service that do= es > not exist in the services list, or which was deleted explicitly by a =E2= =80=98delete=E2=80=99 > clause (or an update clause that returns =E2=80=98#f=E2=80=99 for the ser= vice). > > Fixes: #64106 > > * gnu/services.scm (%modify-services): New procedure. > (modify-services): Use it. > (apply-clauses): Add DELETED-SERVICES argument, change to modify one serv= ice > at a time. > * tests/services.scm > ("modify-services: delete then modify"), > ("modify-services: modify then delete"), > ("modify-services: delete multiple services of the same type"), > ("modify-services: modify multiple services of the same type"): New tests. [...] I've applied the following cosmetic changes: --8<---------------cut here---------------start------------->8--- 1 file changed, 20 insertions(+), 18 deletions(-) gnu/services.scm | 38 ++++++++++++++++++++------------------ modified gnu/services.scm @@ -325,11 +325,13 @@ (define-syntax clause-alist '()))) =20 (define (apply-clauses clauses service deleted-services) + "Apply CLAUSES, an alist as returned by 'clause-alist', to SERVICE. An +exception is raised if a clause attempts to modify a service +present in DELETED-SERVICES." (define (raise-if-deleted kind properties) - (match (find (lambda (deleted) - (match deleted - ((deleted-kind _) - (eq? kind deleted-kind)))) + (match (find (match-lambda + ((deleted-kind _) + (eq? kind deleted-kind))) deleted-services) ((_ deleted-properties) (raise (make-compound-condition @@ -344,27 +346,27 @@ (define (apply-clauses clauses service deleted-servic= es) =20 (match clauses (((kind proc properties) . rest) - (begin - (raise-if-deleted kind properties) - (if (eq? (and service (service-kind service)) - kind) - (let ((new-service (proc service))) - (apply-clauses rest new-service - (if new-service - deleted-services - (cons (list kind properties) - deleted-services)))) - (apply-clauses rest service deleted-services)))) + (raise-if-deleted kind properties) + (if (eq? (and service (service-kind service)) kind) + (let ((new-service (proc service))) + (apply-clauses rest new-service + (if new-service + deleted-services + (cons (list kind properties) + deleted-services)))) + (apply-clauses rest service deleted-services))) (() service))) =20 (define (%modify-services services clauses) + "Apply CLAUSES, an alist as returned by 'clause-alist', to SERVICES. An +exception is raised if a clause attempts to modify a missing service." (define (raise-if-not-found clause) (match clause ((kind _ properties) - (when (not (find (lambda (service) - (eq? kind (service-kind service))) - services)) + (unless (find (lambda (service) + (eq? kind (service-kind service))) + services) (raise (make-compound-condition (condition (&error-location --8<---------------cut here---------------end--------------->8--- and installed it. Thanks for contributing to Guix! --=20 Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 01 00:01:02 2023 Received: (at 64106) by debbugs.gnu.org; 1 Sep 2023 04:01:02 +0000 Received: from localhost ([127.0.0.1]:59609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbvLB-0008Cm-Qq for submit@debbugs.gnu.org; Fri, 01 Sep 2023 00:01:02 -0400 Received: from sail-ipv4.us-core.com ([208.82.101.137]:37404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qbvL9-0008CL-HN; Fri, 01 Sep 2023 00:01:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=SG6JJ/BhME9Tm9I 6AYFptapp6tIG06J1Eo6rQHeLrwQ=; h=cc:to:subject:date:from:in-reply-to: references; d=lease-up.com; b=IGsw0+JWowOcRAivlEL8kcwSyZnVuTsq/7M1BSBM d6kUUUI/87Ik3AKbj06T3Sw51WD4Ihd1+vu+vbHtTiEHqb1Tt9uwhkJ8YOkSWmxzfI/asj JzcvAENxoZm9ZqK4W2hBqpRHWDZbCrUoTy9RZGwyGjJuoLE8/XIs7O7zGb5Bw= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 5b582eb1 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Fri, 1 Sep 2023 04:00:48 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-500b6456c7eso2879834e87.2; Thu, 31 Aug 2023 21:00:47 -0700 (PDT) X-Gm-Message-State: AOJu0YzqRFNfwMPgXVSh+LVAFqjoh0cQ0wmjjEignU+zWleYSOuK1Hyi ++eEaqGEy9acDWYbQhEk7vJZ+IYJMCPaTt2e+yc= X-Google-Smtp-Source: AGHT+IFx3NuXjXUFVAToPxAm63YncSkvbeI/1St4FtErLW9FChpErEtDHFZBTgHMS5IaEWfKpuPjaUhzNjfJt20ZXTc= X-Received: by 2002:a05:6512:4017:b0:4fd:fecf:5d57 with SMTP id br23-20020a056512401700b004fdfecf5d57mr803833lfb.39.1693540845946; Thu, 31 Aug 2023 21:00:45 -0700 (PDT) MIME-Version: 1.0 References: <87msy65z8f.fsf_-_@gmail.com> In-Reply-To: <87msy65z8f.fsf_-_@gmail.com> From: Felix Lechner Date: Thu, 31 Aug 2023 21:00:09 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: =?UTF-8?Q?Re=3A_bug=2365184=3A_=28modify=2Dservices_=E2=80=A6_=28delete_=E2=80=A6=29=29_sh?= =?UTF-8?Q?ould_delete_all_matching_service_types?= To: Maxim Cournoyer Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64106 Cc: Josselin Poiret , Brian Cully , ludo@gnu.org, me@tobias.gr, "pelzflorian \(Florian Pelz\)" , 65184@debbugs.gnu.org, Jelle Licht , david@daviwil.com, 64106@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 (-) Hi Maxim, On Thu, Aug 31, 2023 at 8:49=E2=80=AFPM Maxim Cournoyer wrote: > > > Fixes: #64106 Thanks for taking action. Can Bug#63921 also be closed? Kind regards Felix From unknown Fri Aug 15 16:17:59 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 29 Sep 2023 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator