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 ANHOBZ+pU2ScSAEASxT56A (envelope-from ) for ; Thu, 04 May 2023 14:48:31 +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 wBKqBZ+pU2TknAAA9RJhRA (envelope-from ) for ; Thu, 04 May 2023 14:48:31 +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 7DB3C3A0F7 for ; Thu, 4 May 2023 14:48:30 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puYNT-0005s3-Cs; Thu, 04 May 2023 08:48:07 -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 1puYNO-0005rY-PI for guix-patches@gnu.org; Thu, 04 May 2023 08:48: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 1puYNO-0002ec-Gx for guix-patches@gnu.org; Thu, 04 May 2023 08:48:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1puYNO-0002Vz-Cj for guix-patches@gnu.org; Thu, 04 May 2023 08:48:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63263] [PATCH] gexp: Stop generating unreadable builder scripts. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 04 May 2023 12:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63263 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 63263@debbugs.gnu.org Received: via spool by 63263-submit@debbugs.gnu.org id=B63263.16832044579510 (code B ref 63263); Thu, 04 May 2023 12:48:02 +0000 Received: (at 63263) by debbugs.gnu.org; 4 May 2023 12:47:37 +0000 Received: from localhost ([127.0.0.1]:48781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1puYMy-0002TJ-Bj for submit@debbugs.gnu.org; Thu, 04 May 2023 08:47:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49010) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1puYMu-0002Sz-C4 for 63263@debbugs.gnu.org; Thu, 04 May 2023 08:47:35 -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 1puYMo-0000wB-R1; Thu, 04 May 2023 08:47:26 -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=u93X+qk8Qajat/oNLJHNhrOPpbyfB8/fKC3e0EjhEJ0=; b=G8S0AJXZj3u5OXVm6vkR Fp3Iexm/D+vmbnHi9lqHvkb7EcU6sNLS2L7lxvaGv/3mruqTOrKSXFDPh40OG17cPzf0YT0kRY1IY U6i9FGNB+Jw+D/a9lZlwz12afUlD0DNvt51gIJ9XYj/t0PGwVPrYo7f51G+MfUuFkGuLEohxtFH5e 7oirfQ8n8GLWVBEpyIe9qSgv7E1X8BvwDKREZ9fC8Pe/eF1mmSoMkfAXVgcSh5tpbRtDxOsPj/Y+y KZDeXDtc+CcqqYC94lIF0dEu6LwpJIQ81mkQpezq6IkT/UR4mK0pbnF8jjKHOaq4LOQKPoWH+Z9ux GdeUnB841bAA+A==; 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 1puYMo-0004vq-D3; Thu, 04 May 2023 08:47:26 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20230504112448.22462-1-mail@cbaines.net> Date: Thu, 04 May 2023 14:47:23 +0200 In-Reply-To: <20230504112448.22462-1-mail@cbaines.net> (Christopher Baines's message of "Thu, 4 May 2023 12:24:48 +0100") Message-ID: <87zg6kqn50.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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-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=1683204511; a=rsa-sha256; cv=none; b=l50iMszUiUxa51nxNOFk5e/DRel6QtSuxtQw8PAj9u9sSWDnawiKwkSLvEyZVMJRTjdMrb gRxuyAL+lpGPm5PEGyKlQ7RtJdCQogC66l9WhVNU6/xJFm3GlzWocbMDDC5NQbVeK0pOtv FKFBA6B29y+AgiDnTVCFzeHhoqwC63wBVO8b+A5nGEhgByJCgPe/R0PsF83kxsFGx0+/WV 5dLRRRYiz6RmNezUePqq/Zg5V52pY8FsOW1U97jUV9QtOGG6uwtF3VDSRnlC5lrwXYQ3TD I3QqB7TRdM3pNZ/od21yt7+ON6a9ivM5VfOBuI1Y8UTvCnIjdI+IEVIa843rBQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=G8S0AJXZ; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1683204511; 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=u93X+qk8Qajat/oNLJHNhrOPpbyfB8/fKC3e0EjhEJ0=; b=Rbk3uBOWvBzF5jaXjyn1UAk9V6fC0VfjRgYK6U+XAxJKY98j+BoC34pnP50kbYdB4j4Vlq RBt536vL+zV0BAPPzZGhWOxIVlmfmUvfD/FcBFFfiGfx6mYbvEOg6WgGlVoho6VsTTFBiV T3TYatxOZXFeG6DCCQAbzHuymEJKJCRqqOI5cSdCcsUMM397Ibe6vhKsDy1/+Nz6qTSnDz 3qHgT9TsPSkjzZi/nVWgmzS4YRXDc6eHLiuZ+liO/zuwKfa5kZiCa7fcPGCChl+GInn/Rg IEndY5ZTyPGby/VlM4DbjUlNvRi6Ml8zhXV/gtXj20ANAfa46F7asXiIaYrBLQ== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=G8S0AJXZ; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.61 X-Spam-Score: -2.61 X-Migadu-Queue-Id: 7DB3C3A0F7 X-TUID: k0X4pC+th4UA Hi, Christopher Baines skribis: > In Guile, it's possible to produce output from write that can't be read, = and > this applies to the code staged through g-expressions for derivations. T= his > commit detects this early when the derivation is being created, rather th= an > leaving the error to happen when the derivation is built. > > This is important as it means that tools like guix lint will indicate that > there's a problem, hopefully reducing the number of broken derivations in > Guix. > > * guix/gexp.scm (gexp->derivation): Check that the builder script can be = read. Calling =E2=80=98read=E2=80=99 on every generated sexp is definitely not so= mething we should do, performance-wise. Commit 24ab804ce11fe12ff49cd144a3d9c4bfcf55b41c addressed that to some extent. It works in examples like this: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,lower (computed-file "foo" #~(list #$(current-module)= )) While executing meta-command: ERROR: 1. &gexp-input-error: # --8<---------------cut here---------------end--------------->8--- =E2=80=A6 where =E2=80=98current-module=E2=80=99 returns a non-serializable= object. I think the problem you=E2=80=99re trying to address that we frequently encounter is old-style packages that end up splicing gexps inside sexps, as in: (package ;; =E2=80=A6 (arguments `(#:phases (modify-phases whatever ,#~doh!)))) Is that right? The problem here is that =E2=80=98sexp->gexp=E2=80=99, which was added prec= isely as an optimization for build systems=C2=B9, does not check the sexp it=E2=80=99s = given. Example: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,lower (computed-file "foo" (sexp->gexp `(list a b c ,= (current-module)))) $19 =3D # 7f26baf56be0> scheme@(guile-user)> (sexp->gexp `(list a b c ,(current-module))) $20 =3D #) 7f26bbf2= f090> --8<---------------cut here---------------end--------------->8--- Oops! It would be tempting to change =E2=80=98sexp->gexp=E2=80=99 to traverse the= sexp in search of non-serializable things=E2=80=A6 but that=E2=80=99d defeat the wh= ole point of =E2=80=98sexp->gexp=E2=80=99. How about a linter instead, with the understanding that use of sexps in packages is vanishing? Perhaps coupled with a =E2=80=98guix style=E2=80=99= automatic rewriter. Thanks, Ludo=E2=80=99. =C2=B9 Packages would get long lists/trees in their =E2=80=98arguments=E2= =80=99 field. Traversing them in search of lowerable objects is costly, and =E2=80=98sexp->gexp=E2=80=99 was introduced precisely do we don=E2=80=99t= have to traverse the sexp. (Gexps are designed so that no such traversal is necessary at run time.)