From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SEdICrns9mFGzwAAgWs5BA (envelope-from ) for ; Sun, 30 Jan 2022 20:53:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id yJ3xArns9mG/PgAAG6o9tA (envelope-from ) for ; Sun, 30 Jan 2022 20:53:29 +0100 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 4E32934EB7 for ; Sun, 30 Jan 2022 20:53:28 +0100 (CET) Received: from localhost ([::1]:43206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEGGN-0000H3-BA for larch@yhetil.org; Sun, 30 Jan 2022 14:53:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEGGB-0000Gf-R2 for guix-devel@gnu.org; Sun, 30 Jan 2022 14:53:15 -0500 Received: from mail-4022.proton.ch ([185.70.40.22]:27777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEGG8-00042Y-2e for guix-devel@gnu.org; Sun, 30 Jan 2022 14:53:15 -0500 Date: Sun, 30 Jan 2022 19:53:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lendvai.name; s=protonmail3; t=1643572382; bh=O74JdCVgEUBalNOEf+hK1jebyC7RhQrce0L/tVmn598=; h=Date:To:From:Reply-To:Subject:Message-ID:From:To:Cc; b=MMRduieb4eorqMc8d5BorCueVXO9U1lowYGtrjLMRd3Nfd3DuNGGG9yhYJqieYfIc 4VwyLcGw5+foa55cPMbCSXxPZ/RkyE7Gy1/+4lU2GHmxFBvQHUZyRLbHbbjhxQ0JX/ NhX8E1VgmQwDCUzM/h+FY5sufNIBTV/o76lrKXSF8Ve1pxfqFeT6flpC7F17D4A3Ap GlZU3TK9U+Q76uSeUna13eUmK1474HzCL3T5toItvdDRdkk9roH1J7GC4xTXtq0geV y2tMsvfkjwPzuaL4AglGSrC+bZFyUbru17+u2dUOgaVTwRyFvWGDbs//Ld1naO5Izv t7WZVMzZ9scbQ== To: guix-devel From: Attila Lendvai Subject: Shepherd config file and GEXP semantics Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="b1_JaYCJW9FLqcFQofFhFHntJ5WosE3DHwsQhNGu76GI" Received-SPF: pass client-ip=185.70.40.22; envelope-from=attila@lendvai.name; helo=mail-4022.proton.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Attila Lendvai Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643572408; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=O74JdCVgEUBalNOEf+hK1jebyC7RhQrce0L/tVmn598=; b=OHgHSxZdKA4/bnC6i6rcpeSjHD0P/Yuuy9tABRh8OF8qT5K/Ovyd/LNCR15f55kyupmH4G HrnP3DrxR1PTFm5ERs8rxh0dANT6f3+otUOcb+b0eZ6HjWd3Pl2njIVJWpVXq5ueArxbeG 7QYMoyIhJ6/7bHeXzmZHQiJWsUjypreByNE+MOTqoIp4rXe64HWmSPSti/NAKFMM6+7hGm Ou6WX947Suyi0m6xDKXLwTJ716K6k9z7mCDRCgE1YwkRjPWTZ1U4eoUJ5R5EwrkfsEXH4c fujDVrRYQlyRgXw/Mn/ahCYLoxF0GIi6PmNPjTIXE1eu/5jg8zRMpJ3AKQ466A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643572408; a=rsa-sha256; cv=none; b=iUZYSFDZqz//ugjgI17MYggHT+dCjSaPo5pG81mKT0mv5ZZ8eJL2y1S9BJvLEM6QHWtSJS Ih7acG9Urs2Dvp8ToMnlToOgF9BuPToqfv+YGpuhyhajvo2trSyYL+sXvD2C+M1wlGkWGz FDwSnIBHjqQlWipGJ6G2Fl2kAcqTxbIxkrqyIUpAyvteiZpAG14eALe1vl2nVV8HQ1n7p1 sFL25J8BKnHBTZWjCvgAOur5XQFYzg2XxS1GIUsV7vOQivWcBMNhQny0K4lAXAOU3cdHVT AgnN9WGFIajXR9dghE5CPPbHeZF6WEHO/zUgxFI/bFEppdcHhYhHOfaU/h+7SA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lendvai.name header.s=protonmail3 header.b=MMRduieb; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.83 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lendvai.name header.s=protonmail3 header.b=MMRduieb; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4E32934EB7 X-Spam-Score: -3.83 X-Migadu-Scanner: scn0.migadu.com X-TUID: rwkAvnxZQsu1 This is a multi-part message in MIME format. --b1_JaYCJW9FLqcFQofFhFHntJ5WosE3DHwsQhNGu76GI Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable dear list, i'm having a hard time with a service's start GEXP. my service is using a u= tility module, but when anything is referenced from its toplevel, i get a v= ariable unbound error. to the best of my knowledge everything is fine with WITH-IMPORTED-MODULES a= nd whatnot. i have digged down into the store to verify the service's gener= ated .scm file. in fact, if i cut down that file to the relevant parts, then i can even run= it using guile -s foo.scm, and it does what i expect. strangely enough, it also works as i expect it when i run the same code not= through a `guix pull` and `guix system reconfigure` on a Guix System, but = rather though: $(./pre-inst-env guix system --no-graphic vm /path/to/swarm.scm) but now, back to why it probably behaves differently in shepherd: it loads = its config file using LOAD-IN-USER-MODULE, which does the following dance: (define (load-in-user-module file) (let ((user-module (make-user-module))) (save-module-excursion (lambda () (set-current-module user-module) (primitive-load file))))) the service's start procedure is captured and stored as a closure, which is= only called *after* the SAVE-MODULE-EXCURSION has been passed. am i right in assuming that: 1) the global value DEFINE'd on the toplevel of my utility module ends up i= n this unnamed USER-MODULE's env, and that 2) when the start closure is called, it looks for the global variables in a= different global current-module (i probably lack the lingo here), which do= esn't have the bindings of my util module, and that's why i get the unbound= variable error at service start? if these assumptions are right, then what is the right way to deal with thi= s? is this something to be fixed in shepherd? as demonstrated by the attach= ed file, there's at least one way to make it work. to verify this, i have copied some bits from shepherd's code, and attached = it in an x.scm file. it exhibits the behavior that an escaping closure does= n't see the variable bindings. but when i eval the closure, then it does wo= rk as expected. you won't be able to run the attached file as-is, but i have added the outp= uts of the two runs at its end. any thoughts? -- =E2=80=A2 attila lendvai =E2=80=A2 PGP: 963F 5D5F 45C7 DFCD 0A39 -- =E2=80=9CA slave is one who waits for someone to come and free him.= =E2=80=9D =09=E2=80=94 Ezra Pound (1885=E2=80=931972) --b1_JaYCJW9FLqcFQofFhFHntJ5WosE3DHwsQhNGu76GI Content-Type: text/x-scheme; name=x.scm Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=x.scm KGRlZmluZSAobWFrZS11c2VyLW1vZHVsZSkKICAobGV0ICgobSAobWFrZS1mcmVzaC11c2VyLW1v ZHVsZSkpKQogICAgOzsgVGhlIHR5cGljYWwgY29uZmlndXJhdGlvbiBmaWxlIHdhbnRzIHRvIGRv ICcobWFrZSA8c2VydmljZT4gLi4uKScsIGFuZAogICAgOzsgJyhyZWdpc3Rlci1zZXJ2aWNlcyAu Li4pJywgc28gcHJvdmlkZSB0aGUgcmVsZXZhbnQgYmluZGluZ3MgYnkgZGVmYXVsdC4KICAgICht b2R1bGUtdXNlISBtIChyZXNvbHZlLWludGVyZmFjZSAnKG9vcCBnb29wcykpKQogICAgKG1vZHVs ZS11c2UhIG0gKHJlc29sdmUtaW50ZXJmYWNlICcoc2hlcGhlcmQgc2VydmljZSkpKQogICAgbSkp CgooZGVmaW5lIChsb2FkLWluLXVzZXItbW9kdWxlKQogIChsZXQgKCh1c2VyLW1vZHVsZSAobWFr ZS11c2VyLW1vZHVsZSkpKQogICAgKHNhdmUtbW9kdWxlLWV4Y3Vyc2lvbgogICAgIChsYW1iZGEg KCkKICAgICAgIChzZXQtY3VycmVudC1tb2R1bGUgdXNlci1tb2R1bGUpCiAgICAgICAodXNlLW1v ZHVsZXMgKG5vbmdudSBzZXJ2aWNlcyBzd2FybS11dGlscykpCgogICAgICAgOzsgdGhpcyB3b3Jr cywgaS5lLiAqbG9nLWRpcmVjdG9yeSogaXMgbm90IHVuYm91bmQgdXBvbiBleGVjdXRpb246CiAg ICAgICA7OyAoZX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