From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id gId3OlP3W2QOPgAASxT56A (envelope-from ) for ; Wed, 10 May 2023 21:58:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 0ANvOlP3W2SGFQAA9RJhRA (envelope-from ) for ; Wed, 10 May 2023 21:58:11 +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 89C1888C2 for ; Wed, 10 May 2023 21:58:11 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwpwp-0003Ls-VF; Wed, 10 May 2023 15:58:03 -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 1pwpwp-0003Lk-2s for bug-guix@gnu.org; Wed, 10 May 2023 15:58: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 1pwpwo-0003vN-RE for bug-guix@gnu.org; Wed, 10 May 2023 15:58:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pwpwo-0000k9-Fa for bug-guix@gnu.org; Wed, 10 May 2023 15:58:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#60657: Rethinking how service extensions work Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 10 May 2023 19:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60657 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Bruno Victal , Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 60657@debbugs.gnu.org Received: via spool by 60657-submit@debbugs.gnu.org id=B60657.16837486672833 (code B ref 60657); Wed, 10 May 2023 19:58:02 +0000 Received: (at 60657) by debbugs.gnu.org; 10 May 2023 19:57:47 +0000 Received: from localhost ([127.0.0.1]:49077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwpwY-0000jd-Vr for submit@debbugs.gnu.org; Wed, 10 May 2023 15:57:47 -0400 Received: from mail-ej1-f66.google.com ([209.85.218.66]:49624) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pwpwW-0000jP-Bg for 60657@debbugs.gnu.org; Wed, 10 May 2023 15:57:45 -0400 Received: by mail-ej1-f66.google.com with SMTP id a640c23a62f3a-956ff2399b1so1446067466b.3 for <60657@debbugs.gnu.org>; Wed, 10 May 2023 12:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683748658; x=1686340658; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=oJWoWM+Hj1vuU+PkQccLaCDKoQ2Ih7KwkUx1NyAFRvA=; b=ZWgQYRYx3R8g+c9iszOq9EkEgp96z18csSLQKWd73kzGg7qA0fnhiqVuLf50TEMNIi ohgJrZxi2Bf2mwHvIWb3+EpMnA14ylsZZyGtRW1KB6zHFaYqO/Q7bwVkAEezUWucp2ZN jRbljcIja3+P4Vs4vYbPKF0eYQ6g690Ie/NmxqZILLuJXFl5rA2rGWDI43+gFGYJH7j+ /6ZdHiS72/TlJkstzbatazSgdr7fYZLyTCrLevOjP/BLieWd5eTAdY8oVdj5kk5RiKdT ZX5PQ/c/cTtJ2LmI9FJy++asof87jLeIszRPhDJ3q3mc1fwZ4FWFAN1cNZLZVFx2ncZJ 0IsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683748658; x=1686340658; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=oJWoWM+Hj1vuU+PkQccLaCDKoQ2Ih7KwkUx1NyAFRvA=; b=fOA1YGE2L5qnO+ypqPBOO687Tc0BTDpTHRpS+XnHuaBOW2Wsy2kOA8L5wkN3mgV/pQ hHikTOoUFofOxsoz/+NKu/1oVIIpO0OSRQhXhDlCJbA4LbK0veiIq/3DsUMiJ24kYVlU lFDe2wnrP5hmk9Jd4sOHXlNXLJBMnq9RFYbFDrRG4o0tRJdUegcZ8d6Y+dOgjiQFrLRP MF0Ot1qpXEJWVFB6227gTvJM+8yHMC5V3gkf3Resf6ChT1UWdWzOK8nEOWQ3ARndTX0N T/otNHLpbYUaobdrTKATn9t6Ue0vxicU3+9qeN2OJfROQkvpjW4n5aKNZ7sV6zrnc0BQ H6Ww== X-Gm-Message-State: AC+VfDxnqLoVZT3FgzZ5WU2ngCdgDPUgbjEFviJuqth9S6/Ya6TDapK7 xOvC3b7QUAeW/wle6Hif8xumW6BhzazqIA== X-Google-Smtp-Source: ACHHUZ7D2PhfUatIlMAMWbLRmDFE3jbw3eIPZc7U35Ew3kHaTCBQonfGbITCABNponeTi79GohmlkA== X-Received: by 2002:a17:907:8a04:b0:95f:de3c:6c98 with SMTP id sc4-20020a1709078a0400b0095fde3c6c98mr18213255ejc.58.1683748658339; Wed, 10 May 2023 12:57:38 -0700 (PDT) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id ib8-20020a1709072c6800b0094f67ea6598sm3055871ejc.193.2023.05.10.12.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 12:57:38 -0700 (PDT) Message-ID: <5502762865d23b85dd133821904008344b3c6602.camel@gmail.com> From: Liliana Marie Prikler Date: Wed, 10 May 2023 21:57:37 +0200 In-Reply-To: References: <87pm9xy6xh.fsf@gnu.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 MIME-Version: 1.0 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-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1683748691; a=rsa-sha256; cv=none; b=e5ncJr06+w25V6f01KS1mT0qQjJ+yfM7XMLjLMXTdxRLNqe8g/LbG5jdyYD3vDGamKeGzY Wy8fI0ampYyx10+L+Sehf07Wvc+G5uaWX08j0qezukZG5fGcCj09G9R6IeG0AYxpzy80eX mFm60IE2Fb4MmJ23nObJKBLbY2tssXXXVRtE3TpOQ6Vxf5ZLub7gcQyBaQbpjpOLINhpJx WNrhiatJJoio2jov8IFOKCz0JuNewZrfDRnj3d7H3UQN82suhTPkSNcVyIkCFwnuXjmzqO Lo5awyT/HMm2QMi1XvgLIq7CWo3tr8KcIsosrrg2QnMbKrwcIJOAUuGqdJVIOQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=ZWgQYRYx; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683748691; 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: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=oJWoWM+Hj1vuU+PkQccLaCDKoQ2Ih7KwkUx1NyAFRvA=; b=DepDyfeanu05L5zIWjoTq2xdlujayDudY2bLOneODm+Jyk36fPDPO10XPnEcmW10fexJU8 /m0MvB8RTGpyt2YmAmdpOninuDx502oMQ9SEMFD4zaH9RX8kn6Y0W2jg3uvHK9MI/w9exq 6eAzcpsgWgVZidebDNAyCuYMlH9l1PB4vUHuMSDgdd6V83O0zx8mNjWgR7s+qNOyNjDv0Y C/JxfofiawFZmKmLs8DoonHUOe+BKcLOyUQW1xxUS5q6emYhLXrAUWWVJHA3um3cVMVZVX 3XDruBpAZKPhhJuesfadAexTa5nogJOLGvC4izUEcdkeBStAOfRakFgGRXI/vA== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=ZWgQYRYx; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Spam-Score: 5.82 X-Spam-Score: 5.82 X-Migadu-Queue-Id: 89C1888C2 X-TUID: 6xza1DXCHInw Am Dienstag, dem 09.05.2023 um 20:12 +0100 schrieb Bruno Victal: > Hi Ludo=E2=80=99, >=20 > On 2023-02-25 17:46, Ludovic Court=C3=A8s wrote: > > Bruno Victal skribis: > > > In [1], the issue arises from using activation-service-type to > > > create files/directories for services > > > when these should be either (1) shepherd one-shot services or > > > moved into the 'start' procedure of the service. > > > 'activation-service-type' should only be used for doing things > > > "listed on its label", that is, performing > > > actions at boot-time or after a system reconfigure. > >=20 > > Right. > >=20 > > As we once discussed on IRC, the conclusion to me is that some of > > the > > code currently implemented as activation snippets should rather be > > implemented either as part of the =E2=80=98start=E2=80=99 method of the > > corresponding > > Shepherd service, or as a one-shot Shepherd service that the main > > service would depend on. >=20 > I think moving them into the =E2=80=98start=E2=80=99 method is the best c= ourse of > action. > I'm considering the following changes: > * Adding (gnu build activation) to %default-imported-modules + > %default-modules in (gnu services shepherd). > =C2=A0 I expect that mkdir-p/perms is going to be used frequently enough, > using the number of activation-service > =C2=A0 extensions in use as a rough estimate. > * Refactor the activation extensions into the =E2=80=98start=E2=80=99 met= hod, where > it makes sense to do so. >=20 >=20 > There's one issue I'm somewhat concerned about, consider the > following snippet: >=20 > --8<---------------cut here---------------start------------->8--- >=20 > (define log-directory "/var/log") > (define username "notroot") >=20 > (start > =C2=A0#~(lambda _ > =C2=A0=C2=A0=C2=A0 (mkdir-p/perms #$log-directory (getpw #$username) #o75= 0) > =C2=A0=C2=A0=C2=A0 ...)) >=20 > --8<---------------cut here---------------end--------------->8--- >=20 > This is somewhat pitfall prone since you most likely don't want to > chown /var/log to a non-root user. > I'm unsure what's the best course to take here, would a simple file- > exist? check before mkdir-p/perms be sufficient? I think this question highlights perfectly why one-shot services (or perhaps an as-of yet unknown type of services) are the way to go: With clearly named services for the creation of directories, you don't need to worry about creating some file with the wrong permissions as the owner is already predetermined. You also don't need mkdir-p; you simply depend on the mkdir-#$(dirname my-directory) service. Cheers