From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id gL0nMVpdjGT8TgEASxT56A (envelope-from ) for ; Fri, 16 Jun 2023 15:02:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id OLIWMVpdjGTregEA9RJhRA (envelope-from ) for ; Fri, 16 Jun 2023 15:02:18 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5F95D3FC84 for ; Fri, 16 Jun 2023 15:02:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qA95Y-0005Nv-Tk; Fri, 16 Jun 2023 09:02:04 -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 1qA95X-0005Nl-70 for bug-guix@gnu.org; Fri, 16 Jun 2023 09:02:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qA95W-0006Gk-Qx for bug-guix@gnu.org; Fri, 16 Jun 2023 09:02:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qA95W-0008S1-AR for bug-guix@gnu.org; Fri, 16 Jun 2023 09:02:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#64106: `modify-services` no longer affects multiple instances of the same service Resent-From: "David Wilson" Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 16 Jun 2023 13:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64106 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 64106@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168692047232419 (code B ref -1); Fri, 16 Jun 2023 13:02:02 +0000 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" 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1686920538; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=WC4TCAtZQKATVADUSi+kDboxzJ7y7As7K3Tie7wNuhY=; b=gIXVn9Ad3wN6jBb2m2IfkX+wVrzQrx3c3s8rmJ2WNF+IOR1X9igXbCxV0wq20BtaRtanJ+ CajOSyCY1CMF7/il4eEG2DD5exHBaFmGK2e+Ha5QH4S9aFwGp3JgJGVF/zkJKZ2MaxH0Ij 1jz2sZk634m2x5KWh6ssaO2NqNh+afsRqUukppmTBghd479/zu9rgPJJDBOrZGS6ov1GMZ XIN/tmtuxl41pw5awIeHcm0ALgceHUzB8nb7Lsw9nPD+/dFqP5lfrmf6dH5URhD0gCnfQU 54V1I5X6J7uNveMboS5QISquZN5cgTkbsrM8n+b9EQsr8eJsDJNHBoXUUmdKJA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=daviwil.com header.s=fm3 header.b=B0WHZW9q; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=b9N0C1vX; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1686920538; a=rsa-sha256; cv=none; b=ElK5EHyrI+DIsQ6bD3+zZoBD8UeeSH8yOPnQpweK29fMUHhctgQ+58rGZovx84rQzp+nKv bgS2JTVNzLHHPvmPQ+MPEC6oZ888/ciVKXkunjTPaygQx13TB0UMq1HAYkPRzePaTV6ixn p/eLHNWCm04Id44oET2SDucB52m4MDAH5BrDOPl1oSWgUZUzpxgku59Gx8100zAzuTGC0Y NWfGxtKh6UIeZ/jzNe/8OrdMlFc1Z9FbhBEWEwsKAvBD5meyqsxs+/kQO33ONzse75jP+N pEZfc4KoqUTHDHBaQT+4IGWBjYBkPqjwlf7KvU8RvbHJ2ZBR1id1QCaWZ0nsqA== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -0.52 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=daviwil.com header.s=fm3 header.b=B0WHZW9q; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm2 header.b=b9N0C1vX; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 5F95D3FC84 X-Spam-Score: -0.52 X-TUID: cFkizqMISSBV 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