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 IAt3MGwB5V6uFwAA0tVLHw (envelope-from ) for ; Sat, 13 Jun 2020 16:40:12 +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 EJNdLGwB5V5AewAA1q6Kng (envelope-from ) for ; Sat, 13 Jun 2020 16:40:12 +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 738469404C5 for ; Sat, 13 Jun 2020 16:40:12 +0000 (UTC) Received: from localhost ([::1]:33418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jk9CU-0004X1-Dh for larch@yhetil.org; Sat, 13 Jun 2020 12:40:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jk9CN-0004VW-JN for guix-patches@gnu.org; Sat, 13 Jun 2020 12:40:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jk9CN-000165-AO for guix-patches@gnu.org; Sat, 13 Jun 2020 12:40:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jk9CN-0005tr-6z for guix-patches@gnu.org; Sat, 13 Jun 2020 12:40:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41253] [PATCH v4] guix repl: Add script execution. Resent-From: Konrad Hinsen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 13 Jun 2020 16:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41253 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 41253@debbugs.gnu.org Received: via spool by 41253-submit@debbugs.gnu.org id=B41253.159206639422641 (code B ref 41253); Sat, 13 Jun 2020 16:40:03 +0000 Received: (at 41253) by debbugs.gnu.org; 13 Jun 2020 16:39:54 +0000 Received: from localhost ([127.0.0.1]:42435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk9CE-0005t7-Cv for submit@debbugs.gnu.org; Sat, 13 Jun 2020 12:39:54 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:35591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jk9CB-0005st-Ks for 41253@debbugs.gnu.org; Sat, 13 Jun 2020 12:39:52 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id D32B0411; Sat, 13 Jun 2020 12:39:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 13 Jun 2020 12:39:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.net; h= from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=fm3; bh= HmtEjR8KsE46WhdNm9Z2PmhQnxQyf4/YM6Z/1PMlStQ=; b=p2g+/cBtXDIeBOYf hxV656clsnH7HRjtDmbO/5bxBLzwjGTk0k1e54Thmx4eVkBjI3d5+ZZ+34zOe6Hc MU+iqYH924giFtQEhOOFpb2N8b/kYKxW6MIkoCHtFzlJz7nsnFro/U3+UXgehqQ3 Lx5XJsIGOpnUaPbiUGCE+BoMQzQVnqN4z2oObH4MUmXwc51kkrfk+oxC0nXciuGY AI9EqNoIsd2fNuJbShqqKBp2cdV7o3CHR0qlC1lzO17ZHadEwxnpnz/oZNvcpT0T KHskZjDnw35Aw2BG7cPaBKyFi28w5jXU/06CX6xfB04KFZqjYd5CctFLZPe4fOsw +QO7ww== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=HmtEjR8KsE46WhdNm9Z2PmhQnxQyf4/YM6Z/1PMlS tQ=; b=rPZDooZ1WDTQYaaFndEubOcUoOFkyN0YMYirpPQQ6bFBEe2g0g1FsPb9J rA8ACWsz7wXXyYtxBIt1kYuTAbdArqShDbdeEYgjUeaxESWQZodcnOFHO1UDG8X6 6CONaUFOeQgJyqHMCQCrgxoZiFS32A3Becb7FCWwBOpSYk5tQsY7Q4uYaq7wzMgs juH9uoJIdR6BktEtp7GGupwFSRre6870QPDz2pAn7j+2vLJ+ZvmxMdolf2v1nHEN Qc1hrYZgtuQ+Mt7kLnJQwsWTS9+TcJkgAQxCNx/P1W2rptoCDfEhdJqGcriS8iba be5OW0q2p/oF5/dBV9tvxzmDpqWeg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeifedguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffujghffffkgggtgfesthhqredttddtjeenucfhrhhomhepmfhonhhr rgguucfjihhnshgvnhcuoehkohhnrhgrugdrhhhinhhsvghnsehfrghsthhmrghilhdrnh gvtheqnecuggftrfgrthhtvghrnhepveehleevgeejuddvgfduieefveetffdvteegfeek gfduueejfeegvdehgeekhfejnecukfhppeejjedrvddthedrudegfedrudduheenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehkohhnrhgrugdr hhhinhhsvghnsehfrghsthhmrghilhdrnhgvth X-ME-Proxy: Received: from KHs-MacBook (115.143.205.77.rev.sfr.net [77.205.143.115]) by mail.messagingengine.com (Postfix) with ESMTPA id 798483280063; Sat, 13 Jun 2020 12:39:44 -0400 (EDT) From: Konrad Hinsen In-Reply-To: <87mu585l8y.fsf@gnu.org> References: <20200514162537.29071-1-zimon.toutoune@gmail.com> <87mu585l8y.fsf@gnu.org> Date: Sat, 13 Jun 2020 18:39:42 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.7 (-) 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=fastmail.net header.s=fm3 header.b=p2g+/cBt; dkim=fail (rsa verify failed) header.d=messagingengine.com header.s=fm3 header.b=rPZDooZ1; dmarc=fail reason="SPF not aligned (relaxed)" header.from=fastmail.net (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: 24VPe99TM2Il Hi Ludo, Patch v5 is on its way! A few comments: > Should be: [@var{file} @var{args}@dots{}] > The square brackets show it=E2=80=99s optional. OK. >> +When a @var{file} argument is provided, @var{file} is >> +executed as a Guile scripts: > > =E2=80=9CWhen one or more @var{file} argument is provided, each @var{file= } is > executed as a Guile program:=E2=80=9D No, that's no longer true. Only one script can be run at a time, because guix repl script1.scm script2.scm now means "run script1.scm with script2.scm as its argument". And therefore= ... > (define scripts ;plural, no? This is not a plural. But filter-map is indeed nicer! >> + (define script-file >> + (let ((file (car script)) >> + (directory (getcwd))) >> + (canonicalize-path >> + (cond ((string-prefix? "/" file) file) >> + (else (string-append directory "/" file)))))) > > I think we can just use file names as they arrive, without attempting to > canonicalize them or anything. That's what I thought (and tried) as well, at first. Problems: - It doesn't work when run via pre-inst-env with a non-absolute filename for the script. The script is looked up relative to the directory containing repl.scm. - The script filename is also the first item of (command-line) when called inside the script, and that's useful only it it's an absolute filename. >> +cat > "$tmpfile"<> +#!/usr/bin/env -S guix repl -- > > Rather: > > #!$(type -P env) I didn't know that was possible on a shebang line! > Could you send an updated patch? Done! Cheers, Konrad