From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mBiGN1DNbF/1QAAA0tVLHw (envelope-from ) for ; Thu, 24 Sep 2020 16:46:08 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id ED5WM1DNbF9qNwAA1q6Kng (envelope-from ) for ; Thu, 24 Sep 2020 16:46:08 +0000 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 7F0EE94065D for ; Thu, 24 Sep 2020 16:46:08 +0000 (UTC) Received: from localhost ([::1]:40108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLUNj-00063I-AN for larch@yhetil.org; Thu, 24 Sep 2020 12:46:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLTpm-0008Ia-7F for guix-patches@gnu.org; Thu, 24 Sep 2020 12:11:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58130) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLTpl-0004yw-Pj for guix-patches@gnu.org; Thu, 24 Sep 2020 12:11:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kLTpl-0000ar-LI for guix-patches@gnu.org; Thu, 24 Sep 2020 12:11:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41143] [PATCH 1/2] mapped-devices: Allow target to be list of strings Resent-From: Mikhail Tsykalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 24 Sep 2020 16:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41143 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 41143@debbugs.gnu.org Received: via spool by 41143-submit@debbugs.gnu.org id=B41143.16009638072212 (code B ref 41143); Thu, 24 Sep 2020 16:11:01 +0000 Received: (at 41143) by debbugs.gnu.org; 24 Sep 2020 16:10:07 +0000 Received: from localhost ([127.0.0.1]:41443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kLTot-0000Zc-51 for submit@debbugs.gnu.org; Thu, 24 Sep 2020 12:10:07 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:37543) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kLTor-0000Yt-29 for 41143@debbugs.gnu.org; Thu, 24 Sep 2020 12:10:06 -0400 Received: by mail-lf1-f67.google.com with SMTP id z19so4576361lfr.4 for <41143@debbugs.gnu.org>; Thu, 24 Sep 2020 09:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=a5iHukRJJLGvVs2UXoDekRWt++wRLcJjO0uQkKnVQ3w=; b=Cdtm+zYl8gS8b14B70w3vkhuPYnoGyJ2HXnVBXJYuE1hirs2160xofzOogo7hKAhSK Or+NwvsXr5mX+ZVQV6qW90A/apup9zhavvtmjK9ZvU2DALs+aSgTaZDAnLxfTT/GMgvX QP+fkSW3UKu1aQIIBxRUr5UdD+kxL91q6s6P+Z+k4NiSIfwOkFOu2kUTtckw+l9tyb9/ GZNPgtdnB3aoAXBFWcKUV70aGm0ToO8Sy0dwo2gfzlc+ORDCEDAVLEErzWMLtcsaonrD 0fj4VcJYMlZQr1Q6CNFnrDvpGZU4X0zxhOSDCFLl/jiWqTd+qP6wCoVj3l0IPEIJ4HSP HBmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=a5iHukRJJLGvVs2UXoDekRWt++wRLcJjO0uQkKnVQ3w=; b=GhD5ZADGv4iZvEAyCK907Yvnyu7Wg/jfUPSKXNhnkHTBp4qvxQZuuGfgRzQfIwuos6 D6YY8xsDxEPQERaovNYl6ce6DN+fueVzR1WR5oDP64aM6MkgbGxIte+wgFt/Rg5DsomI e89Usbp8k4CjE4bgWSYC8aTGRJVreRo9cU0n8PJPmkziYN7Sqh02+CdHDMZCunIUpw2z pkWq+evSCnnYrjQi5StLjZKM6fLFhar212wn+vT+3yYV+kWqJ8TajuSdi/tBNIYFeDre krWdIMytq54dLvfgrMRVAHB3raGxsJnBLZk21en+91Licyc/aQZ2mj7aC4xawUQaXpHu sRsA== X-Gm-Message-State: AOAM533Y75YscScc6mkXpcu9K9V6/5mu5QqSMMuRbBBLt13Mi9DhMCJl MQallqfbCXC6t34mk4MolBwhhQpgoPWH0Q== X-Google-Smtp-Source: ABdhPJxUFADdVgDg/DOy9XoNDH9G1c1QLMMrKlbbnz5e6LAUSfxNBIhYHNHdsNmlOAPU0Xue2ulbxw== X-Received: by 2002:ac2:4c9c:: with SMTP id d28mr62210lfl.93.1600963798681; Thu, 24 Sep 2020 09:09:58 -0700 (PDT) Received: from [192.168.0.143] ([88.201.200.148]) by smtp.gmail.com with ESMTPSA id j8sm2438084lfr.80.2020.09.24.09.09.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Sep 2020 09:09:58 -0700 (PDT) References: <874ko6n0s5.fsf@gnu.org> From: Mikhail Tsykalov Message-ID: <9ac560cc-8660-f034-c0d8-536b68d20f68@gmail.com> Date: Thu, 24 Sep 2020 19:09:57 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 In-Reply-To: <874ko6n0s5.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Score: -0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.2 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=Cdtm+zYl; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: ApAK5Yf0qfyw Hi Ludovic, On 09.09.2020 23:38, Ludovic Courtès wrote: >> diff --git a/gnu/services/base.scm b/gnu/services/base.scm >> index 0c154d1c4e..3d09e8220c 100644 >> --- a/gnu/services/base.scm >> +++ b/gnu/services/base.scm >> @@ -408,7 +408,10 @@ FILE-SYSTEM." >> (define (mapped-device->shepherd-service-name md) >> "Return the symbol that denotes the shepherd service of MD, a >> ." >> (symbol-append 'device-mapping- >> - (string->symbol (mapped-device-target md)))) >> + (string->symbol (string-join >> + (let ((t (mapped-device-target md))) >> + (if (list? t) t (list t))) >> + "-")))) > To avoid duplicating the (if (list? t) …) everywhere, I propose instead > the following approach: > > 1. Rename ‘target’ to ‘targets’ (plural) and likewise for the > accessor, and agree that it always contains a list; > > 2. Rename ‘mapped-device’ to ‘%mapped-device’ and add a > ‘mapped-device’ backward-compatibility macro that allows for a > ‘target’ (singular) field and automatically turns its value into a > list. See the ‘origin’ macro in (guix packages) for an example of > how to do that (that macro allows users to specify ‘sha256’ instead > of ‘hash’). > > 3. Add a deprecated ‘mapped-device-target’ (singular) that returns the > first element returned by ‘mapped-device-targets’. While this looks like a good idea, doesn't this break code that implements mapped-device and assumes that target is a string. Suddenly passing a string to a mapped-device constructor results in a list passed to open/close. Also, what functions should do if they expect a string but get a list of them? Ignore everything but the first item? Implement mandatory check function? Doesn't this change push complexity out of mapped-device to implementations of it. Basically, this change will break all current implementations of mapped-devices, so I wanted to hear your thoughts on it before continuing. Mikhail