GNU bug report logs - #29951
[PATCH] WIP guix: Add wrap-script.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Severity: important; Reported by: Ricardo Wurmus <rekado@HIDDEN>; Keywords: patch; dated Tue, 2 Jan 2018 20:46:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Added indication that bug 29951 blocks29824 Request was from Ricardo Wurmus <rekado@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Removed blocking bug(s) 1 and 26752 Request was from Ricardo Wurmus <rekado@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Removed blocking bug(s) 29824 Request was from Ricardo Wurmus <rekado@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added indication that bug 29951 blocks26752,31299 Request was from Ricardo Wurmus <rekado@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Removed indication that bug 29951 blocks Request was from Ricardo Wurmus <rekado@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added blocking bug(s) 29824 Request was from Ricardo Wurmus <rekado@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added indication that bug 29951 blocks29824 Request was from Ricardo Wurmus <rekado@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added blocking bug(s) 26752 and 1 Request was from Ricardo Wurmus <rekado@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 4 Feb 2019 07:50:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 04 02:50:31 2019
Received: from localhost ([127.0.0.1]:58027 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gqZ1T-0008KI-K3
	for submit <at> debbugs.gnu.org; Mon, 04 Feb 2019 02:50:31 -0500
Received: from sender-of-o51.zoho.com ([135.84.80.216]:21078)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rekado@HIDDEN>) id 1gqZ1S-0008K7-F7
 for 29951 <at> debbugs.gnu.org; Mon, 04 Feb 2019 02:50:30 -0500
ARC-Seal: i=1; a=rsa-sha256; t=1549266618; cv=none; d=zoho.com; s=zohoarc; 
 b=YzkmkbE7KcuvyYRolC9iTR5pDyvfzQZMzetDN1pIKh7HKwsRvsrg6dDVqiIZHP8Jb38ZRLkn7sfZeFOj3quIHv8SL+/Erw4rw04JdICVIZL4nLRpcfB1dC0U+UGqGqA9hhzTqbqw7LpRz3jy9jj/a5e90nw6FVW6W2x+3ZWV5VU=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
 s=zohoarc; t=1549266618;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results;
 bh=ecF9GUUiJ8Adlg3Yxg9ozjW7shVEpFSB0GopsWkmqR0=; 
 b=Ra+N2jXKlC/FyRhEmy5R6XSVaHv4dvQFr2K69EIrTGf+aGWiKL7tH26mSTrSN363yFe72upsD4GFbJj/t0yRFHMpl7gobK1H+vy/SDqy7HxgroXyciRUct6jT5DXl2QW5JykXDGCyylFCfkRbmIztg6TSLBqyc+85lELgbbDACs=
ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass  header.i=elephly.net;
 spf=pass  smtp.mailfrom=rekado@HIDDEN;
 dmarc=pass header.from=<rekado@HIDDEN> header.from=<rekado@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1549266618; 
 s=zoho; d=elephly.net; i=rekado@HIDDEN;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
 l=744; bh=ecF9GUUiJ8Adlg3Yxg9ozjW7shVEpFSB0GopsWkmqR0=;
 b=FXlrG+EJyJMCro/yjkhJyxBpgQLIL2pKNcQ1oBLFOsnrg45cIFCNaOASZS3nBMby
 f6zgoK77+KwNrfGILa5gQINRUmZKQeVdswPPAgMw7KMkVxIlXWcbhcLDyUlCHKzOd2x
 IIhfeCyES8gwtIjMoFkXuVq/cm0HunIb6L+DNtj4=
Received: from localhost (252.139-78-194.adsl-static.isp.belgacom.be
 [194.78.139.252]) by mx.zohomail.com
 with SMTPS id 1549266617453726.1610218359455;
 Sun, 3 Feb 2019 23:50:17 -0800 (PST)
From: Ricardo Wurmus <rekado@HIDDEN>
To: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=)
Subject: Re: bug#26752: Ansible & others' problems with wrapped
 '.ansible-real' scripts
References: <CAPsKtfJKuf3CchsD0667ajg8bWSyp7YGTv8NU5qLf5kc7qEiHg@HIDDEN>
 <874lx2w926.fsf@HIDDEN>
 <CAPsKtfJ8rZ86RZiayXuZbYfeEUroAubvCsgKxZJDdg17Oijrnw@HIDDEN>
 <8760fnsv3u.fsf@HIDDEN>
Date: Mon, 04 Feb 2019 08:50:14 +0100
In-Reply-To: <8760fnsv3u.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Thu, 22 Jun 2017 21:03:33 +0200")
Message-ID: <87tvhkhu15.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-ZohoMailClient: External
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 29951
Cc: Jelle Licht <jlicht@HIDDEN>, 26752 <at> debbugs.gnu.org, 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

ludo@HIDDEN (Ludovic Court=C3=A8s) writes:
> Jelle Licht <jlicht@HIDDEN> skribis:
>
>> The current ansible package is still brokenin the same way.
>>
>> Is there already an acceptable way of working around this problem?
>> Otherwise I could send my (extremely hacky) workaround that adds a speci=
fic
>> condition in the ansible source code to check for .ansible-real.
>
> For now I think we have to go with the hack.  Make sure to add a comment
> linking to this bug report.

There is a way to get around this.  It=E2=80=99s presented in #29951:

    https://issues.guix.info/issue/29951

Open issues with this include a hard-coded store prefix, but it=E2=80=99s n=
o big
obstacle.  Should we give this a try on core-updates?





Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 2 Aug 2018 09:23:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 02 05:23:10 2018
Received: from localhost ([127.0.0.1]:38251 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fl9p8-0000VV-KP
	for submit <at> debbugs.gnu.org; Thu, 02 Aug 2018 05:23:10 -0400
Received: from sender-of-o51.zoho.com ([135.84.80.216]:21014)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rekado@HIDDEN>) id 1fl9p6-0000VM-OW
 for 29951 <at> debbugs.gnu.org; Thu, 02 Aug 2018 05:23:09 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1533199051; cv=none; d=zoho.com; s=zohoarc; 
 b=Bbo0VeETP4JGJWRe9J31ztjxQC07GvJQqhFWQ8HnrDAFmXeEIQrTGcD0COuekRbKDzqRSC4TSq5xErAREA9WpCE3jJ+c+k6P9PeAb/wIJ0EjGKfKUYsvOmWrxscSoJ4hXwEjl2Yas55bdeRZMI7CbwkP9XkWFfDkwEV21qKg3WY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
 s=zohoarc; t=1533199051;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results;
 bh=AsSVM6MZ9PaQLqTCYt0qgkAr28WcldfcglcGw0xhk6U=; 
 b=BgckEEE/83mVnKsFjmwluy71Q2MTy3PV0gZJcTkM3j/83Gv92rxsobps8O9+YHZ046aNao7J70Fv5C59JAtIYH3Q7rTT52cXgZV9yBnyOPT4U5rtr5TCg5rfUSX5GSOEjC+XiOry9Z8R6QTpQr3tOQcfOqD9+hJEXVMAoZL+77A=
ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass  header.i=elephly.net;
 spf=pass  smtp.mailfrom=rekado@HIDDEN;
 dmarc=pass header.from=<rekado@HIDDEN> header.from=<rekado@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1533199051; 
 s=zoho; d=elephly.net; i=rekado@HIDDEN;
 h=References:From:To:Cc:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
 l=495; bh=AsSVM6MZ9PaQLqTCYt0qgkAr28WcldfcglcGw0xhk6U=;
 b=dQsU5ot0RsVkcbMFKcNJt7s+9Ysd/2aE0GjDyIAYPD51V5IZIsCzCYly7z3sWxDU
 R0QAuqKM743+rBZEnfbu51VpFkAEQm6zb4azVmAN9jupeCHZZrFWgqGh1tHoZ8z6S/O
 LH/vDM3kH+s0domYGzyeXXEc4BGHecR16nGZggg0=
ARC-Seal: i=1; a=rsa-sha256; t=1533199049; cv=none; d=zoho.com; s=zohoarc; 
 b=YJ8PeIjnNyxu/pwaQu9/yQRV3zYOBy/0iz+BYljsU8Z8OiIP8ndo0pFO1onaT/LDYJNv68wR+5vmoAsUisNnJok4TWnowck1j0K5ooE82UtQ4pW3CfhD3ei0+W8E7+TAf8w8T3wBrWQaYLlCpiJnpqvUHfCLS2U6uw4we69QRqc=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
 s=zohoarc; t=1533199049;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results;
 bh=AsSVM6MZ9PaQLqTCYt0qgkAr28WcldfcglcGw0xhk6U=; 
 b=OOGHpxQ2Z5TSKZIwuQGGzmsn8WxtznuNJyN4pU/1xCgCqjPM0CUYmVIFNdrWTNi1pfF0wXTw3ldQHlwOX8Z9KZthsSHXnuR5Dh8NQFpRoXEXMdA8JK/fPnk6TFdldqTn4ih9gYxTqDofU5RXqTRv5UvIMxMYxqi9ABvO5sZ3jsU=
ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass  header.i=elephly.net;
 spf=pass  smtp.mailfrom=rekado@HIDDEN;
 dmarc=pass header.from=<rekado@HIDDEN> header.from=<rekado@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1533199049; 
 s=zoho; d=elephly.net; i=rekado@HIDDEN;
 h=References:From:To:Cc:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
 l=495; bh=AsSVM6MZ9PaQLqTCYt0qgkAr28WcldfcglcGw0xhk6U=;
 b=XoBmlozeBh9FWJ3gDB89mg2CWCVjHvUIil5KA6W8oMfm/8XI1On+7Mylma0XhXBM
 VAQdYbxe5eBTCtWU8Y1WbXjr4yBZ+Yf1UxNGPq6jWKAc/nglRIPs4HUtmWcmJnZibOU
 mtTrgi0U0C+c0BAPDeSWIsOO0sfPEbaNKl8Gllxs=
Received: from localhost (port-92-200-1-34.dynamic.qsc.de [92.200.1.34]) by
 mx.zohomail.com with SMTPS id 1533199049758847.7731787576512;
 Thu, 2 Aug 2018 01:37:29 -0700 (PDT)
References: <20180102204434.2716-1-rekado@HIDDEN>
 <CAPsKtfJDw=ba=8a3CUHnif9PkruQ-B0ui5nTY1C+1gQSXfRiGg@HIDDEN>
User-agent: mu4e 1.0; emacs 26.1
From: Ricardo Wurmus <rekado@HIDDEN>
To: Jelle Licht <jlicht@HIDDEN>
Subject: Re: [bug#29951] [PATCH] WIP guix: Add wrap-script.
In-reply-to: <CAPsKtfJDw=ba=8a3CUHnif9PkruQ-B0ui5nTY1C+1gQSXfRiGg@HIDDEN>
X-URL: https://elephly.net
X-PGP-Key: https://elephly.net/rekado.pubkey
X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
Date: Thu, 02 Aug 2018 10:37:26 +0200
Message-ID: <87o9elp3jt.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-ZohoMailClient: External
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 29951
Cc: h.goebel@HIDDEN, 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Jelle Licht <jlicht@HIDDEN> writes:

> 2018-01-02 21:44 GMT+01:00 Ricardo Wurmus <rekado@HIDDEN>:
>
>> * guix/build/utils.scm (wrap-script): New procedure.
>> ---
[=E2=80=A6]
>>
>> +(define wrap-script
>> +  (let ((interpreter-regex
>> +         (make-regexp
>> +          (string-append "^#! ?(/bin/sh|/gnu/store/[^/]+/bin/("
>>
>
> Won't this be an issue for people using a customized store location?

Yes.  I suppose we could change this to use the actual store prefix.

--
Ricardo





Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 2 Aug 2018 09:22:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 02 05:22:16 2018
Received: from localhost ([127.0.0.1]:38247 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fl9oF-0000Tl-3H
	for submit <at> debbugs.gnu.org; Thu, 02 Aug 2018 05:22:16 -0400
Received: from static.195.114.201.195.clients.your-server.de
 ([195.201.114.195]:33206 helo=conspiracy.of.n0.is)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ng0@HIDDEN>) id 1fl9oC-0000Tc-9w
 for 29951 <at> debbugs.gnu.org; Thu, 02 Aug 2018 05:22:13 -0400
Received: by conspiracy.of.n0.is (OpenSMTPD) with ESMTPSA id 208690f1
 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); 
 Thu, 2 Aug 2018 09:22:10 +0000 (UTC)
Date: Thu, 2 Aug 2018 09:22:55 +0000
From: Nils Gillmann <ng0@HIDDEN>
To: Jelle Licht <jlicht@HIDDEN>
Subject: Re: [bug#29951] [PATCH] WIP guix: Add wrap-script.
Message-ID: <20180802092255.hmdu5p3a5y7wbm37@abyayala>
References: <20180102204434.2716-1-rekado@HIDDEN>
 <CAPsKtfJDw=ba=8a3CUHnif9PkruQ-B0ui5nTY1C+1gQSXfRiGg@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAPsKtfJDw=ba=8a3CUHnif9PkruQ-B0ui5nTY1C+1gQSXfRiGg@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 29951
Cc: Ricardo Wurmus <rekado@HIDDEN>, h.goebel@HIDDEN,
 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Jelle Licht transcribed 4.1K bytes:
> 2018-01-02 21:44 GMT+01:00 Ricardo Wurmus <rekado@HIDDEN>:
> 
> > * guix/build/utils.scm (wrap-script): New procedure.
> > ---
> >  guix/build/utils.scm | 101 ++++++++++++++++++++++++++++++
> > +++++++++++++++++++++
> >  1 file changed, 101 insertions(+)
> >
> > diff --git a/guix/build/utils.scm b/guix/build/utils.scm
> > index 7391307c8..a2efcb31c 100644
> > --- a/guix/build/utils.scm
> > +++ b/guix/build/utils.scm
> > @@ -3,6 +3,7 @@
> >  ;;; Copyright © 2013 Andreas Enge <andreas@HIDDEN>
> >  ;;; Copyright © 2013 Nikita Karetnikov <nikita@HIDDEN>
> >  ;;; Copyright © 2015 Mark H Weaver <mhw@HIDDEN>
> > +;;; Copyright © 2018 Ricardo Wurmus <rekado@HIDDEN>
> >  ;;;
> >  ;;; This file is part of GNU Guix.
> >  ;;;
> > @@ -84,6 +85,7 @@
> >              fold-port-matches
> >              remove-store-references
> >              wrap-program
> > +            wrap-script
> >              invoke
> >
> >              locale-category->string))
> > @@ -1068,6 +1070,105 @@ with definitions for VARS."
> >          (chmod prog-tmp #o755)
> >
> 
> [...]
> 
> >      (rename-file prog-tmp prog))))
> >
> > +(define wrap-script
> > +  (let ((interpreter-regex
> > +         (make-regexp
> > +          (string-append "^#! ?(/bin/sh|/gnu/store/[^/]+/bin/("
> >
> 
> Won't this be an issue for people using a customized store location?

Can't we make this substitutable at configure time?

> [snipped]
> >




Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 2 Aug 2018 08:38:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 02 04:38:02 2018
Received: from localhost ([127.0.0.1]:38236 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fl97S-0007pw-8e
	for submit <at> debbugs.gnu.org; Thu, 02 Aug 2018 04:38:02 -0400
Received: from mail-pf1-f181.google.com ([209.85.210.181]:36963)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cmmarusich@HIDDEN>) id 1fl97P-0007pS-Vt
 for 29951 <at> debbugs.gnu.org; Thu, 02 Aug 2018 04:38:00 -0400
Received: by mail-pf1-f181.google.com with SMTP id a26-v6so896524pfo.4
 for <29951 <at> debbugs.gnu.org>; Thu, 02 Aug 2018 01:37:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=zLeBjRFUf+LZRclCfRrb26AknTHc6cPnCI1aL6unrgw=;
 b=tZPj9RVvS8G/GYEcheETNkXgMk9o8XxgT7ms24znFm7eizRHgXfMADGiD75OsqeCul
 kj0uVf0PIQh7hpQo7E/O+V0bKtAsF3jGV4nPWGhZxLp8Z49bRfS5wujwBMLVCw5RzDYM
 t6ustycKKCKKFswq13bJssKFQRt0iv/ZB89otr65P2/3QUviUJYXx7CczTPUrbuh5hNf
 tXlQdUKb314eNHJyO8DMvEs/vndtjrIsuhR5pSKskV890aCKW3fgFHX/WtM4HBYmy5do
 A32i3lo/q1UGGmfE33l3ly2p0EFb2OlKo96OlKK+PXM533SpUfEh5NLtdJQGyTTrxLLe
 1fGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=zLeBjRFUf+LZRclCfRrb26AknTHc6cPnCI1aL6unrgw=;
 b=Oeu3QSDCFKL5FHW7zH9DMZtqi9tC4786jqjyr/IHhsov1hfirowbkBg2gWLwSR8EAb
 6oPAVBRRIT5CAuEvlng5Myb5j1sp8yP5GaMRAzZko9rNRGG5ihDTQdXJ4AQr8Lk+Lu32
 KHmP22Lvy+FqfTWtRKaf3PFcxWgLyQ6edatxxXz2pdm0aHoxDBmenweWAxOText+2Sd6
 YJm3Ddw53rcmEKR9xACjnNGM0Tun07GEESrQGYZ5RbJC3B02715Ld1ZiP+8dDCbevQ74
 epVzzNUwBEYFqhRiwa8D0ETy+QsASQgSVAiex+pobCyiwSAG7etEh2b51m6aDiD2WrtP
 ZKJA==
X-Gm-Message-State: AOUpUlHC8grAGUry4+3GeSjJX+zq+Y128MWiX/6f32oFxcWucEDJGc5B
 05CT13ivAgwtYtDGjI/Y/1+FwbezkVg=
X-Google-Smtp-Source: AAOMgpdk/94NmqsTdTl7BIF2Le/aDW9nQQ1pmewk9mMIZ4ptPr/Vm3O9+CmVbYaX9ok5z2e55g0S4A==
X-Received: by 2002:a62:5290:: with SMTP id
 g138-v6mr1983084pfb.46.1533199073828; 
 Thu, 02 Aug 2018 01:37:53 -0700 (PDT)
Received: from garuda.local (c-24-18-253-84.hsd1.wa.comcast.net.
 [24.18.253.84])
 by smtp.gmail.com with ESMTPSA id g28-v6sm2241346pfe.41.2018.08.02.01.37.51
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 02 Aug 2018 01:37:52 -0700 (PDT)
From: Chris Marusich <cmmarusich@HIDDEN>
To: Ricardo Wurmus <rekado@HIDDEN>
Subject: Re: [bug#29951] [PATCH] WIP guix: Add wrap-script.
References: <20180102204434.2716-1-rekado@HIDDEN>
 <69141465-bdd7-4855-c5d0-a3750646273b@HIDDEN>
 <87o9m84t2n.fsf@HIDDEN> <87sh3xcmib.fsf@HIDDEN>
 <87600ts04b.fsf@HIDDEN>
Date: Thu, 02 Aug 2018 01:37:51 -0700
In-Reply-To: <87600ts04b.fsf@HIDDEN> (Ricardo Wurmus's message of "Thu,
 02 Aug 2018 09:23:16 +0200")
Message-ID: <87y3dpb1uo.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 29951
Cc: Hartmut Goebel <h.goebel@HIDDEN>, 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi Ricardo,

Thank you for taking the time to explain it!

Ricardo Wurmus <rekado@HIDDEN> writes:

> [...]  This line:
>
> #\-(begin (let =E2=80=A6) =E2=80=A6)
>
> is really just two Scheme values: a single arbitrary character and the
> S-expression that we care about.  We only care about the side-effects of
> evaluating the S-expression.

I understand now.  We're reading the hyphen symbol, and not doing
anything with it.  Got it!

> The advantage of this approach is: we don=E2=80=99t have to rename wrapped
> scripts any more (=E2=80=9C.foo-real=E2=80=9D), which makes for prettier =
usage messages
> (=E2=80=9CUsage: foo -v=E2=80=9D instead of =E2=80=9CUsage: .foo-real -v=
=E2=80=9D) and avoids problems
> when an application checks its own name to determine what actions it
> should take.

Sounds great!

=2D-=20
Chris

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAltiwt8ACgkQ3UCaFdgi
Rp1tRg//evUOIouFt5oLR9joAfp953f/PZv4GovdueN4Hq6BoVFAH52ggSJw9G0O
u0g9IKcrtWqiYa5ao1RqROPLqTqca3i1TgBUY0tsc67AammqCg9ntC4Kuku4Lb+4
B9bczuVOiVSJBQuNMejaefC4Nc1skkkPtZFQqN8nkPvfVXzcYK+4ei0vMUb1U8hz
zR2TNQNI9zSjoym/psfKjqpKAyDBw7ZhbsIqJ6Zltd1qKd7deGthrE8GKySW+ze1
4G4E4HF8pkQ/owtKIHxwhcC84YjekoaanFK2DC06AGJ1mZBtHBs6vkRZay1ldggV
lr/U/+VzeuugB0yLgV33mtL+cjHdUyZmetTHqr7iBxYZDiIcQx70/pAUWUjZqe3I
KobgZfz6HKGke6CLiaVqdOvtQjVfDGfmwgmsFcSfMuT11Gzy/XxcMVPpxdzpomw3
QCMKC+Xy9rtnIyqXo9/lPEBOFUFCs2Ant+b/xC35YvK9aHbSTdGgqXu7baWJMxkm
cC4J60zp4I6ybT5RBwD/HlF6BMIVCrbUW78fh0mCjJKNNIoeL5XA0Zwtequ3a92r
nLhqAZ4PNncqaonu81/iyJKz9a6u+wJBlrFvEa7qv83Xv8/1OZyg0BEi4+D/Opp+
sgxx90H9PAvCk7gANylyRiC9yvcj28BsvwZTZ0hW+D9j2eYWfAs=
=lswz
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 2 Aug 2018 08:18:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 02 04:18:20 2018
Received: from localhost ([127.0.0.1]:38227 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fl8oO-0007Mv-75
	for submit <at> debbugs.gnu.org; Thu, 02 Aug 2018 04:18:20 -0400
Received: from mail1.fsfe.org ([217.69.89.151]:42128)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jlicht@HIDDEN>) id 1fl8oL-0007Mm-Lp
 for 29951 <at> debbugs.gnu.org; Thu, 02 Aug 2018 04:18:18 -0400
Received: by mail-oi0-f52.google.com with SMTP id m11-v6so2482487oic.2
 for <29951 <at> debbugs.gnu.org>; Thu, 02 Aug 2018 01:18:15 -0700 (PDT)
X-Gm-Message-State: AOUpUlEYC5egVlE28EzCDMt+yuy9Bs3pC7SINmMVQoICwpkdno851Rhm
 3TmIQg9ZyEDzqUM7/elEI1hrvM94MYUfqcrDd5Y=
X-Google-Smtp-Source: AAOMgpeMp/D/0WhSn1wtkuaWrPyoSQVATphSpbjeB+i4QF8AMr/fpN1Rh6WX6+GM/5fw2e/mRD5Ugbj19ADaztp9mEg=
X-Received: by 2002:aca:d5cd:: with SMTP id
 m196-v6mr1654487oig.160.1533197893809; 
 Thu, 02 Aug 2018 01:18:13 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:ac9:5ec1:0:0:0:0:0 with HTTP;
 Thu, 2 Aug 2018 01:18:13 -0700 (PDT)
In-Reply-To: <20180102204434.2716-1-rekado@HIDDEN>
References: <20180102204434.2716-1-rekado@HIDDEN>
From: Jelle Licht <jlicht@HIDDEN>
Date: Thu, 2 Aug 2018 10:18:13 +0200
X-Gmail-Original-Message-ID: <CAPsKtfJDw=ba=8a3CUHnif9PkruQ-B0ui5nTY1C+1gQSXfRiGg@HIDDEN>
Message-ID: <CAPsKtfJDw=ba=8a3CUHnif9PkruQ-B0ui5nTY1C+1gQSXfRiGg@HIDDEN>
Subject: Re: [bug#29951] [PATCH] WIP guix: Add wrap-script.
To: Ricardo Wurmus <rekado@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000d4c6a105726f733d"
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 29951
Cc: h.goebel@HIDDEN, 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--000000000000d4c6a105726f733d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

2018-01-02 21:44 GMT+01:00 Ricardo Wurmus <rekado@HIDDEN>:

> * guix/build/utils.scm (wrap-script): New procedure.
> ---
>  guix/build/utils.scm | 101 ++++++++++++++++++++++++++++++
> +++++++++++++++++++++
>  1 file changed, 101 insertions(+)
>
> diff --git a/guix/build/utils.scm b/guix/build/utils.scm
> index 7391307c8..a2efcb31c 100644
> --- a/guix/build/utils.scm
> +++ b/guix/build/utils.scm
> @@ -3,6 +3,7 @@
>  ;;; Copyright =C2=A9 2013 Andreas Enge <andreas@HIDDEN>
>  ;;; Copyright =C2=A9 2013 Nikita Karetnikov <nikita@HIDDEN>
>  ;;; Copyright =C2=A9 2015 Mark H Weaver <mhw@HIDDEN>
> +;;; Copyright =C2=A9 2018 Ricardo Wurmus <rekado@HIDDEN>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -84,6 +85,7 @@
>              fold-port-matches
>              remove-store-references
>              wrap-program
> +            wrap-script
>              invoke
>
>              locale-category->string))
> @@ -1068,6 +1070,105 @@ with definitions for VARS."
>          (chmod prog-tmp #o755)
>

[...]

>      (rename-file prog-tmp prog))))
>
> +(define wrap-script
> +  (let ((interpreter-regex
> +         (make-regexp
> +          (string-append "^#! ?(/bin/sh|/gnu/store/[^/]+/bin/("
>

Won't this be an issue for people using a customized store location?

[snipped]
>

--000000000000d4c6a105726f733d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">2018-01-02 21:44 GMT+01:00 Ricardo Wurmus <span dir=3D"ltr">&lt;<a href=
=3D"mailto:rekado@HIDDEN" target=3D"_blank">rekado@HIDDEN</a>&gt;=
</span>:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex">* guix/build/utils.scm (wrap-scr=
ipt): New procedure.<br>
---<br>
=C2=A0guix/build/utils.scm | 101 ++++++++++++++++++++++++++++++<wbr>+++++++=
++++++++++++++<br>
=C2=A01 file changed, 101 insertions(+)<br>
<br>
diff --git a/guix/build/utils.scm b/guix/build/utils.scm<br>
index 7391307c8..a2efcb31c 100644<br>
--- a/guix/build/utils.scm<br>
+++ b/guix/build/utils.scm<br>
@@ -3,6 +3,7 @@<br>
=C2=A0;;; Copyright =C2=A9 2013 Andreas Enge &lt;<a href=3D"mailto:andreas@=
enge.fr">andreas@HIDDEN</a>&gt;<br>
=C2=A0;;; Copyright =C2=A9 2013 Nikita Karetnikov &lt;<a href=3D"mailto:nik=
ita@HIDDEN">nikita@HIDDEN</a>&gt;<br>
=C2=A0;;; Copyright =C2=A9 2015 Mark H Weaver &lt;<a href=3D"mailto:mhw@net=
ris.org">mhw@HIDDEN</a>&gt;<br>
+;;; Copyright =C2=A9 2018 Ricardo Wurmus &lt;<a href=3D"mailto:rekado@elep=
hly.net">rekado@HIDDEN</a>&gt;<br>
=C2=A0;;;<br>
=C2=A0;;; This file is part of GNU Guix.<br>
=C2=A0;;;<br>
@@ -84,6 +85,7 @@<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0fold-port-matches<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0remove-store-references<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0wrap-program<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 wrap-script<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0invoke<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0locale-category-&gt;string)=
)<br>
@@ -1068,6 +1070,105 @@ with definitions for VARS.&quot;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(chmod prog-tmp #o755)<br>
=C2=A0 =C2=A0 </blockquote><div>[...] <br></div><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex">=C2=A0 =C2=A0 =C2=A0(rename-file prog-tmp prog))))<br>
<br>
+(define wrap-script<br>
+=C2=A0 (let ((interpreter-regex<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(make-regexp<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (string-append &quot;^#! ?(/bin/sh|/gnu=
/store/[^/]+/<wbr>bin/(&quot;<br></blockquote><div>=C2=A0</div><div>Won&#39=
;t this be an issue for people using a customized store location? <br><br><=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo=
rder-left:1px solid rgb(204,204,204);padding-left:1ex">[snipped]<br></block=
quote><div><br></div><div>=C2=A0<br></div></div></div></div>

--000000000000d4c6a105726f733d--




Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 2 Aug 2018 07:23:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 02 03:23:50 2018
Received: from localhost ([127.0.0.1]:38208 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fl7xa-0005va-Pm
	for submit <at> debbugs.gnu.org; Thu, 02 Aug 2018 03:23:47 -0400
Received: from sender-of-o51.zoho.com ([135.84.80.216]:21078)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rekado@HIDDEN>) id 1fl7xX-0005vQ-U3
 for 29951 <at> debbugs.gnu.org; Thu, 02 Aug 2018 03:23:44 -0400
ARC-Seal: i=1; a=rsa-sha256; t=1533194602; cv=none; d=zoho.com; s=zohoarc; 
 b=KD5SPjzI8igyoF2hK1XqodU301+ektoYtwKRIj3LHDLvEDRNLmJVmSsgUA5gVp/p8OZsj3BzQ1+8rW/5Ui4JtmiwIx3742ZODaV06es2yfwAtJ1+R+GXDFUtOQdLmqbYwmG2wvznvEbRqDbNwdb9V95i6jxRoaV49l38PhXfjlM=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
 s=zohoarc; t=1533194602;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results;
 bh=G6iEXbQyBDnHAPcIuN51+/cC+/qrZtNLkkFH2TKWbjg=; 
 b=iDPZMERVLlXblc1NqebyvCeKA6G6XpAZED9X2VpZxg9BsjHz2mxQtqUcLiDR9gugJ8GAaRCLWKQ+mv89oRZKIzOovIVUnBoEMgl4tNspEQC2+S6aef4VO8CneUnZfmv7p/zoiy7VhevcyZGl/uPhQA2IHIjAicEhpLoM48eVK2I=
ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass  header.i=elephly.net;
 spf=pass  smtp.mailfrom=rekado@HIDDEN;
 dmarc=pass header.from=<rekado@HIDDEN> header.from=<rekado@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1533194602; 
 s=zoho; d=elephly.net; i=rekado@HIDDEN;
 h=References:From:To:Cc:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
 l=3044; bh=G6iEXbQyBDnHAPcIuN51+/cC+/qrZtNLkkFH2TKWbjg=;
 b=BqfDRtjQd+esJel+hanEC1nz1UhT3jrAxXKjovqmXkxXNsB4gHYyfLhFJfIII1Er
 anp4SG1GoLpquLVDBanWD3yGSJoWZGwl1QVMT3I+P0RvOzF1ivWV/XkbrskXAtijPWu
 AGjJzfRg+1rJG+5XYonSokvMii0RsmPwMjAS8jt8=
ARC-Seal: i=1; a=rsa-sha256; t=1533194599; cv=none; d=zoho.com; s=zohoarc; 
 b=PIiIKPykxSm8Ac/RyPwrC9oEe7Ygom/QrTEEwJXd3f579c5bJD9/Qo5C4Fm6rWoiMJapVKeAqR9nMK+6p0YV+xD8NEOZR3M4MJhzoZ3p+QG5HFBk6Sy/2u2oMRzqZ66fA1x8UnEGrpWwzC0KWI7U2Tfc9w6LdPgJXRxQHs7dnqg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
 s=zohoarc; t=1533194599;
 h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results;
 bh=G6iEXbQyBDnHAPcIuN51+/cC+/qrZtNLkkFH2TKWbjg=; 
 b=bShYN+zANw4L/pq6IwRQEMaxLljVdqI02D1bfYpCFm4vXZ/b0ck06THUADxyq9TXDO17VwRXiFROuOy5tcqhZYhoRIM6J4xSOe9LhwD2cHpxfZWsqHeh9JrrTrMchUfeLe2hggf664FnDdu+/o2hidYVsWtL3XuIYN7ntURjk0E=
ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass  header.i=elephly.net;
 spf=pass  smtp.mailfrom=rekado@HIDDEN;
 dmarc=pass header.from=<rekado@HIDDEN> header.from=<rekado@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1533194599; 
 s=zoho; d=elephly.net; i=rekado@HIDDEN;
 h=References:From:To:Cc:Subject:In-reply-to:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
 l=3044; bh=G6iEXbQyBDnHAPcIuN51+/cC+/qrZtNLkkFH2TKWbjg=;
 b=N67Q33nejxNIK/P5TkXctrdpMF9rt8XCnglx/5fqBgU8H0WvIRu/TX2SvmUfulVf
 QUPbg9GvGDMoD6HZTZKgCkDzyUzedofjLHnOuN0XQcXjZS4Bj8r/MkYaNeuA+NaaaB5
 vFJiE7lAhoJquYfPt6FYUK73RA+XuF6vwOLMn3E4=
Received: from localhost (port-92-200-1-34.dynamic.qsc.de [92.200.1.34]) by
 mx.zohomail.com with SMTPS id 1533194599676782.0032143253128;
 Thu, 2 Aug 2018 00:23:19 -0700 (PDT)
References: <20180102204434.2716-1-rekado@HIDDEN>
 <69141465-bdd7-4855-c5d0-a3750646273b@HIDDEN>
 <87o9m84t2n.fsf@HIDDEN> <87sh3xcmib.fsf@HIDDEN>
User-agent: mu4e 1.0; emacs 26.1
From: Ricardo Wurmus <rekado@HIDDEN>
To: Chris Marusich <cmmarusich@HIDDEN>
Subject: Re: [bug#29951] [PATCH] WIP guix: Add wrap-script.
In-reply-to: <87sh3xcmib.fsf@HIDDEN>
X-URL: https://elephly.net
X-PGP-Key: https://elephly.net/rekado.pubkey
X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
Date: Thu, 02 Aug 2018 09:23:16 +0200
Message-ID: <87600ts04b.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-ZohoMailClient: External
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 29951
Cc: Hartmut Goebel <h.goebel@HIDDEN>, 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Hi Chris,

> Ricardo Wurmus <rekado@HIDDEN> writes:
>
>> This is the result in =E2=80=9C/tmp/test-python=E2=80=9D:
>>
>> #!/home/rekado/.guix-profile/bin/guile --no-auto-compile
>> #!#; Guix wrapper
>> #\-(begin (let ((current (getenv "PYTHONPATH"))) (setenv "PYTHONPATH" (i=
f current (string-append "/foo/bar:whatever" ":" current) "/foo/bar:whateve=
r"))) (let ((current (getenv "FOOBAR"))) (setenv "FOOBAR" (if current (stri=
ng-append current ":" "/to/me") "/to/me"))))
>> #\-(apply execl "/gnu/store/iyy9w0hcxv4dg9q92d4g023vvz50r5bq-python-3.5.=
3/bin/python3.5" (car (command-line)) (command-line))
>> #!/gnu/store/iyy9w0hcxv4dg9q92d4g023vvz50r5bq-python-3.5.3/bin/python3.5
>> import sys
>> from lib2to3.main import main
>>
>> sys.exit(main("lib2to3.fixes"))
>
> I understand that the part beginning with #! and ending with !# are a
> block comment in scheme, so they will be ignored by Guile, and that
> "Guix wrapper" shows up after a ;, so it will also be considered a
> comment by Guile, but I don't understand why the lines following that
> need to begin with #\-.  I also don't understand why Guile doesn't
> complain about it.  Why do the lines begin with #\-?

#\- is Guile syntax for the character =E2=80=9C-=E2=80=9D.  To ensure that =
the target
language ignores these lines they must start with =E2=80=9C#=E2=80=9D.  In =
Guile,
however, we cannot just use =E2=80=9C#=E2=80=9D on its own.  The =E2=80=9C#=
=E2=80=9D in Guile is the
start of a reader macro.  We don=E2=80=99t really want a reader macro at the
beginning of each line, though =E2=80=93 we just want to move on and get to=
 the
expression.

So we use =E2=80=9C#\-=E2=80=9D, which evaluates to the character =E2=80=9C=
-=E2=80=9D.  It is valid in
Scheme to write code that evaluates to something and then ignore that
value.  Here=E2=80=99s an example:

   10
   23
   #\a
   #\b
   5
   (display "hello")

Guile would evaluate the numbers and characters one after the other, and
none of them would have any effect on the final expression that displays
=E2=80=9Chello=E2=80=9D.

In the wrapper we do the same kind of thing.  This line:

#\-(begin (let =E2=80=A6) =E2=80=A6)

is really just two Scheme values: a single arbitrary character and the
S-expression that we care about.  We only care about the side-effects of
evaluating the S-expression.

A language that uses =E2=80=9C#=E2=80=9D to mark comments, on the other han=
d, would
simply ignore the whole line.  The result is that we can use Guile to
set environment variables and then hand over execution to the target
language interpreter, which would run in the new environment.

The advantage of this approach is: we don=E2=80=99t have to rename wrapped
scripts any more (=E2=80=9C.foo-real=E2=80=9D), which makes for prettier us=
age messages
(=E2=80=9CUsage: foo -v=E2=80=9D instead of =E2=80=9CUsage: .foo-real -v=E2=
=80=9D) and avoids problems
when an application checks its own name to determine what actions it
should take.

--
Ricardo





Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 2 Aug 2018 06:26:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 02 02:26:42 2018
Received: from localhost ([127.0.0.1]:38144 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fl74M-0004Ui-NP
	for submit <at> debbugs.gnu.org; Thu, 02 Aug 2018 02:26:42 -0400
Received: from mail-pl0-f48.google.com ([209.85.160.48]:37874)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <cmmarusich@HIDDEN>) id 1fl74K-0004UT-Vc
 for 29951 <at> debbugs.gnu.org; Thu, 02 Aug 2018 02:26:41 -0400
Received: by mail-pl0-f48.google.com with SMTP id d5-v6so551956pll.4
 for <29951 <at> debbugs.gnu.org>; Wed, 01 Aug 2018 23:26:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=6UxHOUb/xt70cuLL/EY0r8qk0fKDSCO06R7NxXtdruQ=;
 b=o6SQmt1fUeo0j9xa8/3+He/ra4pYKz3MFQIPLsJhajmSYstM1FsH99vWRQL5AyEz28
 7mvl9TrwYZNx5OhILXsUnMPjqt3vIh8Ftgz4Qe+pPqx36ybGo58xJLZfVug5IgX1YyKp
 luN6VgKMWfkhzB/0JW84c3N8GnkDnxpXAI8ia7ZXIDNJydXBVxTH8jGiFrv7JZiWFpez
 UvnvaWrWFQFMbfOgTzKvG2p+Hba9POfwGKCGun3tNpJOrf0fH9xthd34HNMD/PDqZwrb
 mfGJgky1h8TBvuoyMwZc7SD4ZfEiK21HEDe750TzEmdmonOFSf3Dr/9hsRlE4pI+yCrf
 urJw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=6UxHOUb/xt70cuLL/EY0r8qk0fKDSCO06R7NxXtdruQ=;
 b=XUYJcv/ORwZsAQz0P6Rj73gABUF1JIdy7N2UDvl7qgzOqzrvnGBDlQiFiBT6x4BEJ9
 XzvYmpT3wX6fqGCYdxW7meirWX2oF15PX1t8VZq7c+Lzf4jOZj8QhXXaZyXQNFduk6Kx
 EIRXI1+rZk60WBvzz5nrdZ/7rLThq+xRWzJU+kAwrzelS1OUxo4PbDWpxgROJzIQ+CFD
 w6oSW5HGQjguNnQV27mpnPhydtmBy5LDpBAgMXgfq4oG1eK3GyXMft8EwuxZwcSgwdtl
 WIy6KcpciEQRlYiSMjgcmqayb+G1hh++tF4OyiyyJdKbeacJ222G6foIoEB21xCyVzww
 MrFw==
X-Gm-Message-State: AOUpUlGfb4axugHsp8yaRBWYe69OXhyA6HCEfyZAGJ4ZwN0v4Uw4FVsX
 r+0GZH/rUd8iTpDT1oMR48fJapUY
X-Google-Smtp-Source: AAOMgpdvil6iDSbe40Yvoefg6HgYCYr35xAVqNyYoswOtxQ0ndQS/J0GdIzGV1g6yPt0DpzrgJ6/UA==
X-Received: by 2002:a17:902:e18d:: with SMTP id
 cd13-v6mr1173513plb.305.1533191194193; 
 Wed, 01 Aug 2018 23:26:34 -0700 (PDT)
Received: from garuda.local (c-24-18-253-84.hsd1.wa.comcast.net.
 [24.18.253.84])
 by smtp.gmail.com with ESMTPSA id c142-v6sm1210401pfb.62.2018.08.01.23.26.32
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 01 Aug 2018 23:26:32 -0700 (PDT)
From: Chris Marusich <cmmarusich@HIDDEN>
To: Ricardo Wurmus <rekado@HIDDEN>
Subject: Re: [bug#29951] [PATCH] WIP guix: Add wrap-script.
References: <20180102204434.2716-1-rekado@HIDDEN>
 <69141465-bdd7-4855-c5d0-a3750646273b@HIDDEN>
 <87o9m84t2n.fsf@HIDDEN>
Date: Wed, 01 Aug 2018 23:26:20 -0700
In-Reply-To: <87o9m84t2n.fsf@HIDDEN> (Ricardo Wurmus's message of "Fri,
 05 Jan 2018 09:19:00 +0100")
Message-ID: <87sh3xcmib.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 29951
Cc: Hartmut Goebel <h.goebel@HIDDEN>, 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Ricardo Wurmus <rekado@HIDDEN> writes:

> This is the result in =E2=80=9C/tmp/test-python=E2=80=9D:
>
> #!/home/rekado/.guix-profile/bin/guile --no-auto-compile
> #!#; Guix wrapper
> #\-(begin (let ((current (getenv "PYTHONPATH"))) (setenv "PYTHONPATH" (if=
 current (string-append "/foo/bar:whatever" ":" current) "/foo/bar:whatever=
"))) (let ((current (getenv "FOOBAR"))) (setenv "FOOBAR" (if current (strin=
g-append current ":" "/to/me") "/to/me"))))
> #\-(apply execl "/gnu/store/iyy9w0hcxv4dg9q92d4g023vvz50r5bq-python-3.5.3=
/bin/python3.5" (car (command-line)) (command-line))
> #!/gnu/store/iyy9w0hcxv4dg9q92d4g023vvz50r5bq-python-3.5.3/bin/python3.5
> import sys
> from lib2to3.main import main
>
> sys.exit(main("lib2to3.fixes"))

I understand that the part beginning with #! and ending with !# are a
block comment in scheme, so they will be ignored by Guile, and that
"Guix wrapper" shows up after a ;, so it will also be considered a
comment by Guile, but I don't understand why the lines following that
need to begin with #\-.  I also don't understand why Guile doesn't
complain about it.  Why do the lines begin with #\-?

=2D-=20
Chris

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAltipAwACgkQ3UCaFdgi
Rp2ruxAArb+xtJfkF5amVlQQCwGGkwgJOrZWSNL7KSkXISrDWNWQ6+JEIQJWYnj8
SBVArYEGwW9uk1Psw6UxEJ9grAwMpTCPbjTMSuNb5YdVczqVakTsD0zAskqpdGtr
m7Ig+SF6t8sqCwfDF9yY1pM+quYlU49kwj/KnEaMakJczM1CvD8CHhV9YA9QvBfe
ERCAYzam2xItlUHOWG7lTtpSCv7KCvFxYMEtiVDTKLeW3Gv3EM1vzBtLRmjqIJLS
lvH4/MJy9VttiPfx+zm+Dlt6dfXscZj78e5sm9U8PtbfAhHAYmhmSRmTo3Gm4gGr
CCgeMhEXaETHVkpDi4A7D5mD/3oj7ar749o8OWN5an2+VlL21k7Yy4+qoatO1Z6v
M0l0bwDsrUKCYXB4bI/gdCkccs19gn7Hub/pP6LozXyyIcYkacTvrhO24QHOrQsz
AwI1bPlj916jVyXWxAuvg3WGqiuO0XwCi3orxWRGsycMvEkJrrFfsvrvm3Xvni+H
sMSu6KmDKirEH+QZCuROWXP2Bz229L9yHebODLRXzeiYtRJsciOglLEIvAg9h2s/
GsVrfkt17J77UDlo+V7bfIlTpzJBrFFe0tONW+Lch+PPCoVymJnjgPNY9lpJCddC
a34wwxtNxI/2dJYGKjbHH0HWvyd8M2AWMAPC8d/fqDVj1UTBDEs=
=eN44
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.
Severity set to 'important' from 'normal' Request was from ludo@HIDDEN (Ludovic Courtès) to control <at> debbugs.gnu.org. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 12 Jan 2018 22:52:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 12 17:52:20 2018
Received: from localhost ([127.0.0.1]:54278 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ea8BP-0006eG-Qy
	for submit <at> debbugs.gnu.org; Fri, 12 Jan 2018 17:52:20 -0500
Received: from hera.aquilenet.fr ([185.233.100.1]:44964)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1ea8BO-0006e8-4C
 for 29951 <at> debbugs.gnu.org; Fri, 12 Jan 2018 17:52:18 -0500
Received: from localhost (localhost [127.0.0.1])
 by hera.aquilenet.fr (Postfix) with ESMTP id 1809B10A22;
 Fri, 12 Jan 2018 23:52:17 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at aquilenet.fr
Received: from hera.aquilenet.fr ([127.0.0.1])
 by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id KDjc6FMHiQ5Z; Fri, 12 Jan 2018 23:52:16 +0100 (CET)
Received: from ribbon (unknown [IPv6:2a01:e0a:1d:7270:af76:b9b:ca24:c465])
 by hera.aquilenet.fr (Postfix) with ESMTPSA id A40A610880;
 Fri, 12 Jan 2018 23:52:15 +0100 (CET)
From: ludo@HIDDEN (Ludovic =?utf-8?Q?Court=C3=A8s?=)
To: Ricardo Wurmus <rekado@HIDDEN>
Subject: Re: [bug#29951] [PATCH] WIP guix: Add wrap-script.
References: <20180102204434.2716-1-rekado@HIDDEN>
Date: Fri, 12 Jan 2018 23:52:14 +0100
In-Reply-To: <20180102204434.2716-1-rekado@HIDDEN> (Ricardo Wurmus's
 message of "Tue, 2 Jan 2018 21:44:34 +0100")
Message-ID: <87373ar8pt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 29951
Cc: h.goebel@HIDDEN, 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

Hi!

Ricardo Wurmus <rekado@HIDDEN> skribis:

> * guix/build/utils.scm (wrap-script): New procedure.

[...]

> +(define wrap-script
> +  (let ((interpreter-regex
> +         (make-regexp
> +          (string-append "^#! ?(/bin/sh|/gnu/store/[^/]+/bin/("
> +                         (string-join '("python[^ ]*"
> +                                        "Rscript"
> +                                        "perl"
> +                                        "ruby"
> +                                        "bash"
> +                                        "sh") "|")
> +                         ") ?.*)")))
> +        (coding-line-regex
> +         (make-regexp
> +          ".*#.*coding[=3D:][[:space:]]*([-[a-zA-Z_0-9].]+)")))
> +    (lambda* (prog #:rest vars)
> +      "Wrap the script PROG such that VARS are set first.  The format of=
 VARS
> +is the same as in the WRAP-PROGRAM procedure.  This procedure differs fr=
om
> +WRAP-PROGRAM in that it does not create a separate shell script.  Instea=
d,
> +PROG is modified directly by prepending a Guile script, which is interpr=
eted
> +as a comment in the script's language.
> +
> +Special encoding comments as supported by Python are recreated on the se=
cond
> +line.
> +
> +Note that this procedure can only be used once per file as Guile scripts=
 are
> +not supported."

Nice!

> +      (let-values (((interpreter coding-line)
> +                    (call-with-ascii-input-file prog
> +                      (lambda (p)
> +                        (values (false-if-exception
> +                                 (and=3D> (regexp-exec interpreter-regex=
 (read-line p))
> +                                        (lambda (m) (match:substring m 1=
))))
> +                                (false-if-exception
> +                                 (and=3D> (regexp-exec coding-line-regex=
 (read-line p))
> +                                        (lambda (m) (match:substring m 0=
)))))))))

=E2=80=98false-if-exception=E2=80=99 is problematic because it can hide err=
ors.  Could
you narrow that down to the exception type of interest?  Or is there a
risk of random decoding errors and the likes when passed a binary file?

> +        (when interpreter

Should it return #t on success and #f on failure?  Or just thrown an
exception on failure?

> +                                 (which "guile")

Let=E2=80=99s add #:guile defaulting to (which "guile").

I wonder if =E2=80=98wrap-program=E2=80=99 could automatically call =E2=80=
=98wrap-script=E2=80=99 when
appropriate so that users don=E2=80=99t have to choose by themselves.  WDYT?

Thanks!

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 5 Jan 2018 10:06:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 05 05:06:40 2018
Received: from localhost ([127.0.0.1]:36360 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eXOtc-0001zM-6O
	for submit <at> debbugs.gnu.org; Fri, 05 Jan 2018 05:06:40 -0500
Received: from mail-out.m-online.net ([212.18.0.10]:47853)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <h.goebel@HIDDEN>) id 1eXOta-0001zE-Jc
 for 29951 <at> debbugs.gnu.org; Fri, 05 Jan 2018 05:06:39 -0500
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
 by mail-out.m-online.net (Postfix) with ESMTP id 3zCgLP33R6z1qtGF;
 Fri,  5 Jan 2018 11:06:37 +0100 (CET)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.70])
 by mail.m-online.net (Postfix) with ESMTP id 3zCgLP21tLz1qsvp;
 Fri,  5 Jan 2018 11:06:37 +0100 (CET)
X-Virus-Scanned: amavisd-new at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.182])
 by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new,
 port 10024)
 with ESMTP id doRVi3L7z0f1; Fri,  5 Jan 2018 11:06:36 +0100 (CET)
Received: from hermia.goebel-consult.de
 (ppp-83-171-156-105.dynamic.mnet-online.de [83.171.156.105])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.mnet-online.de (Postfix) with ESMTPS;
 Fri,  5 Jan 2018 11:06:36 +0100 (CET)
Received: from [192.168.110.2] (lenashee.goebel-consult.de [192.168.110.2])
 by hermia.goebel-consult.de (Postfix) with ESMTP id 497856002B;
 Fri,  5 Jan 2018 11:06:36 +0100 (CET)
Subject: Re: [PATCH] WIP guix: Add wrap-script.
To: Ricardo Wurmus <rekado@HIDDEN>
References: <20180102204434.2716-1-rekado@HIDDEN>
 <69141465-bdd7-4855-c5d0-a3750646273b@HIDDEN>
 <87o9m84t2n.fsf@HIDDEN>
From: Hartmut Goebel <h.goebel@HIDDEN>
Organization: crazy-compilers.com
Message-ID: <0b4f18c5-ff7d-f03f-e6c7-1866e28099e3@HIDDEN>
Date: Fri, 5 Jan 2018 11:06:35 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.5.2
MIME-Version: 1.0
In-Reply-To: <87o9m84t2n.fsf@HIDDEN>
Content-Type: multipart/alternative;
 boundary="------------37E86838AE7EDC0F9EB64E90"
Content-Language: en-US
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 29951
Cc: 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

This is a multi-part message in MIME format.
--------------37E86838AE7EDC0F9EB64E90
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Am 05.01.2018 um 09:19 schrieb Ricardo Wurmus:

Thanks for your reply.

>> Does this take care of proper quoting the string-values?
> What string values do you refer to?  We first generate an S-expression
> (where we don’t need to take care of escaping things anyway) and then
> format it as a string (with “format” and the “~s” format string), and
> then we print that S-expression-as-a-string into a file.

I mean the values of the environment variables to be set, whcih might
contain double-quotes or backslashes.

But I understand that these values are calculated within guile anyway
and ~s takes care of proper quoting. So this is fine. Thanks for
elaborating.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@HIDDEN               |
| www.crazy-compilers.com | compilers which you thought are impossible |


--------------37E86838AE7EDC0F9EB64E90
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Am 05.01.2018 um 09:19 schrieb Ricardo
      Wurmus:<br>
      <br>
      Thanks for your reply.<br>
      <br>
    </div>
    <blockquote type="cite" cite="mid:87o9m84t2n.fsf@HIDDEN">
      <blockquote type="cite" style="color: #000000;">
        <pre wrap="">Does this take care of proper quoting the string-values?
</pre>
      </blockquote>
      <pre wrap="">What string values do you refer to?  We first generate an S-expression
(where we don’t need to take care of escaping things anyway) and then
format it as a string (with “format” and the “~s” format string), and
then we print that S-expression-as-a-string into a file.</pre>
    </blockquote>
    <p>I mean the values of the environment variables to be set, whcih
      might contain double-quotes or backslashes.</p>
    <p>But I understand that these values are calculated within guile
      anyway and ~s takes care of proper quoting. So this is fine.
      Thanks for elaborating.<br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | <a class="moz-txt-link-abbreviated" href="mailto:h.goebel@HIDDEN">h.goebel@HIDDEN</a>               |
| <a class="moz-txt-link-abbreviated" href="http://www.crazy-compilers.com">www.crazy-compilers.com</a> | compilers which you thought are impossible |
</pre>
  </body>
</html>

--------------37E86838AE7EDC0F9EB64E90--




Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at 29951 <at> debbugs.gnu.org:


Received: (at 29951) by debbugs.gnu.org; 5 Jan 2018 08:19:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 05 03:19:29 2018
Received: from localhost ([127.0.0.1]:36314 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eXNDt-0007gi-Ko
	for submit <at> debbugs.gnu.org; Fri, 05 Jan 2018 03:19:29 -0500
Received: from sender-of-o51.zoho.com ([135.84.80.216]:21099)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rekado@HIDDEN>) id 1eXNDr-0007gX-KH
 for 29951 <at> debbugs.gnu.org; Fri, 05 Jan 2018 03:19:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1515140343; 
 s=zoho; d=elephly.net; i=rekado@HIDDEN;
 h=References:From:To:Cc:Subject:In-reply-to:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID;
 l=3864; bh=f5/D8RMsnJBqHbEL0yVntI1DoG9wqFchd5ueDwOa+C4=;
 b=X9gmhJiXFhFluqhUWHoIKZorsinwz14nTp8VU8PV81mk//hl3clAqXl8gjaahjtP
 bB/4M7vAYZaxFmVt5FVDCJXsxBELOpkmRWHSBwqUuuLJHv2qAP0YtesQe/Fi8Prd4oz
 82/Dh6B/m40ID1C/8IlnBRJy6mFuuIPKBsVoSZYs=
Received: from localhost (port-92-200-114-22.dynamic.qsc.de [92.200.114.22])
 by mx.zohomail.com with SMTPS id 1515140343614140.34013010982653;
 Fri, 5 Jan 2018 00:19:03 -0800 (PST)
References: <20180102204434.2716-1-rekado@HIDDEN>
 <69141465-bdd7-4855-c5d0-a3750646273b@HIDDEN>
User-agent: mu4e 1.0-alpha3; emacs 25.3.1
From: Ricardo Wurmus <rekado@HIDDEN>
To: Hartmut Goebel <h.goebel@HIDDEN>
Subject: Re: [PATCH] WIP guix: Add wrap-script.
In-reply-to: <69141465-bdd7-4855-c5d0-a3750646273b@HIDDEN>
X-URL: https://elephly.net
X-PGP-Key: https://elephly.net/rekado.pubkey
X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
Date: Fri, 05 Jan 2018 09:19:00 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Message-ID: <87o9m84t2n.fsf@HIDDEN>
X-ZohoMailClient: External
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 29951
Cc: 29951 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)


Hi Hartmut,

>> +                                (false-if-exception
>> +                                 (and=3D> (regexp-exec coding-line-rege=
x (read-line p))
>> +                                        (lambda (m) (match:substring m =
0)))))))))
>
> When using emacs, this line can also contain other local variable
> definitions. What about keeping the whole line?

The purpose here was just to retain the coding comment, because it is
interpreted by Python itself to set the file encoding.  Other values are
not used by Python to make any such decisions.

Since these modified files are only generated in a build phase to modify
the *execution* environment (and the unchanged files are available via
=E2=80=9Cguix build -S=E2=80=9D), I think that it is reasonable to assume t=
hat users
won=E2=80=99t be interested in editing these files directly, so hints to th=
e
editor don=E2=80=99t need to be preserved.

I find it a little cleaner to keep this coding-line preservation as
restricted as possible, but maybe you are right and it would be safer to
just copy the whole line when the coding regex matches.

>> +        (when interpreter
>> +          (let* ((header (format #f "\
>> +#!~a --no-auto-compile
>> +#!#; ~a
>> +#\\-~s
>> +#\\-~s
>> +"
>> +                                 (which "guile")
>> +                                 (or coding-line "Guix wrapper")
>> +                                 (cons 'begin (map update-env vars))
>> +                                 `(apply execl ,interpreter
>> +                                         (car (command-line))
>> +                                         (command-line))))
>
> Does this take care of proper quoting the string-values?

What string values do you refer to?  We first generate an S-expression
(where we don=E2=80=99t need to take care of escaping things anyway) and th=
en
format it as a string (with =E2=80=9Cformat=E2=80=9D and the =E2=80=9C~s=E2=
=80=9D format string), and
then we print that S-expression-as-a-string into a file.

I ran this on an actual Python file in the store.  This is the original
file, which I copied to =E2=80=9C/tmp/test-python=E2=80=9D:

--8<---------------cut here---------------start------------->8---
#!/gnu/store/iyy9w0hcxv4dg9q92d4g023vvz50r5bq-python-3.5.3/bin/python3.5
import sys
from lib2to3.main import main

sys.exit(main("lib2to3.fixes"))
--8<---------------cut here---------------end--------------->8---

This is the code in the REPL:

--8<---------------cut here---------------start------------->8---
,use (guix build utils)
scheme@(guile-user)> (wrap-script "/tmp/test-python"
                                  '("PYTHONPATH" ":" prefix ("/foo/bar:what=
ever"))
                                  '("FOOBAR" ":" suffix ("/to/me")))
scheme@(guile-user)>
--8<---------------cut here---------------end--------------->8---

This is the result in =E2=80=9C/tmp/test-python=E2=80=9D:

--8<---------------cut here---------------start------------->8---
#!/home/rekado/.guix-profile/bin/guile --no-auto-compile
#!#; Guix wrapper
#\-(begin (let ((current (getenv "PYTHONPATH"))) (setenv "PYTHONPATH" (if c=
urrent (string-append "/foo/bar:whatever" ":" current) "/foo/bar:whatever")=
)) (let ((current (getenv "FOOBAR"))) (setenv "FOOBAR" (if current (string-=
append current ":" "/to/me") "/to/me"))))
#\-(apply execl "/gnu/store/iyy9w0hcxv4dg9q92d4g023vvz50r5bq-python-3.5.3/b=
in/python3.5" (car (command-line)) (command-line))
#!/gnu/store/iyy9w0hcxv4dg9q92d4g023vvz50r5bq-python-3.5.3/bin/python3.5
import sys
from lib2to3.main import main

sys.exit(main("lib2to3.fixes"))
--8<---------------cut here---------------end--------------->8---

>
>> +                (call-with-ascii-input-file prog
>
> Does this work if the file contains non-ascii characters, e.g. \xf0
> (assuming "ascii" means 0-127 only)?

=E2=80=9Ccall-with-ascii-input-file=E2=80=9D opens the file as a binary, so=
 it reads the
file as a series of bytes.  This seems fine when reading only the
shebang (which is ASCII only) and when trying to match the coding regex
on the second line.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net






Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Jan 2018 13:59:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 03 08:59:44 2018
Received: from localhost ([127.0.0.1]:33883 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eWja3-0007SO-QU
	for submit <at> debbugs.gnu.org; Wed, 03 Jan 2018 08:59:44 -0500
Received: from eggs.gnu.org ([208.118.235.92]:59692)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <h.goebel@HIDDEN>) id 1eWja2-0007SC-6y
 for submit <at> debbugs.gnu.org; Wed, 03 Jan 2018 08:59:42 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <h.goebel@HIDDEN>) id 1eWjZw-0001tb-0K
 for submit <at> debbugs.gnu.org; Wed, 03 Jan 2018 08:59:36 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:51044)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <h.goebel@HIDDEN>)
 id 1eWjZv-0001tV-Sf
 for submit <at> debbugs.gnu.org; Wed, 03 Jan 2018 08:59:35 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50661)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <h.goebel@HIDDEN>) id 1eWjZu-0002AZ-Rh
 for guix-patches@HIDDEN; Wed, 03 Jan 2018 08:59:35 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <h.goebel@HIDDEN>) id 1eWjZr-0001rB-QM
 for guix-patches@HIDDEN; Wed, 03 Jan 2018 08:59:34 -0500
Received: from mail-out.m-online.net ([212.18.0.9]:56446)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <h.goebel@HIDDEN>)
 id 1eWjZr-0001qO-JZ
 for guix-patches@HIDDEN; Wed, 03 Jan 2018 08:59:31 -0500
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
 by mail-out.m-online.net (Postfix) with ESMTP id 3zBXc10SnVz1qrjS;
 Wed,  3 Jan 2018 14:59:28 +0100 (CET)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.70])
 by mail.m-online.net (Postfix) with ESMTP id 3zBXc05v2Vz26T2W;
 Wed,  3 Jan 2018 14:59:28 +0100 (CET)
X-Virus-Scanned: amavisd-new at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.182])
 by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new,
 port 10024)
 with ESMTP id TvadCGkKtVLA; Wed,  3 Jan 2018 14:59:28 +0100 (CET)
Received: from hermia.goebel-consult.de
 (ppp-212-114-230-52.dynamic.mnet-online.de [212.114.230.52])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mail.mnet-online.de (Postfix) with ESMTPS;
 Wed,  3 Jan 2018 14:59:28 +0100 (CET)
Received: from [192.168.110.2] (lenashee.goebel-consult.de [192.168.110.2])
 by hermia.goebel-consult.de (Postfix) with ESMTP id 8C9F8602E0;
 Wed,  3 Jan 2018 14:59:27 +0100 (CET)
Subject: Re: [PATCH] WIP guix: Add wrap-script.
To: Ricardo Wurmus <rekado@HIDDEN>, guix-patches@HIDDEN
References: <20180102204434.2716-1-rekado@HIDDEN>
From: Hartmut Goebel <h.goebel@HIDDEN>
Organization: crazy-compilers.com
Message-ID: <69141465-bdd7-4855-c5d0-a3750646273b@HIDDEN>
Date: Wed, 3 Jan 2018 14:59:27 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.5.2
MIME-Version: 1.0
In-Reply-To: <20180102204434.2716-1-rekado@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

This code is over-changeling my scheme knowledge :-) Thus just a few
comments:


> +                                (false-if-exception
> +                                 (and=> (regexp-exec coding-line-regex (read-line p))
> +                                        (lambda (m) (match:substring m 0)))))))))

When using emacs, this line can also contain other local variable
definitions. What about keeping the whole line?

> +        (when interpreter
> +          (let* ((header (format #f "\
> +#!~a --no-auto-compile
> +#!#; ~a
> +#\\-~s
> +#\\-~s
> +"
> +                                 (which "guile")
> +                                 (or coding-line "Guix wrapper")
> +                                 (cons 'begin (map update-env vars))
> +                                 `(apply execl ,interpreter
> +                                         (car (command-line))
> +                                         (command-line))))

Does this take care of proper quoting the string-values?

> +                (call-with-ascii-input-file prog

Does this work if the file contains non-ascii characters, e.g. \xf0
(assuming "ascii" means 0-127 only)?


-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@HIDDEN               |
| www.crazy-compilers.com | compilers which you thought are impossible |





Information forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Jan 2018 20:45:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 02 15:45:08 2018
Received: from localhost ([127.0.0.1]:33515 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eWTQl-00078p-G6
	for submit <at> debbugs.gnu.org; Tue, 02 Jan 2018 15:45:08 -0500
Received: from eggs.gnu.org ([208.118.235.92]:51186)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rekado@HIDDEN>) id 1eWTQj-000784-4K
 for submit <at> debbugs.gnu.org; Tue, 02 Jan 2018 15:45:01 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rekado@HIDDEN>) id 1eWTQc-0005FN-RE
 for submit <at> debbugs.gnu.org; Tue, 02 Jan 2018 15:44:55 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,T_DKIM_INVALID
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:56643)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <rekado@HIDDEN>) id 1eWTQc-0005FF-NW
 for submit <at> debbugs.gnu.org; Tue, 02 Jan 2018 15:44:54 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42110)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <rekado@HIDDEN>) id 1eWTQZ-0001FO-FZ
 for guix-patches@HIDDEN; Tue, 02 Jan 2018 15:44:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <rekado@HIDDEN>) id 1eWTQV-0005C7-Cl
 for guix-patches@HIDDEN; Tue, 02 Jan 2018 15:44:51 -0500
Received: from sender-of-o51.zoho.com ([135.84.80.216]:21088)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <rekado@HIDDEN>) id 1eWTQV-0005Bl-4D
 for guix-patches@HIDDEN; Tue, 02 Jan 2018 15:44:47 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1514925879; 
 s=zoho; d=elephly.net; i=rekado@HIDDEN;
 h=From:To:Cc:Subject:Date:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID;
 l=3895; bh=C58YzEZHqqwJSFrk+d/9KKnYxnbCpcUNkAI/Ful/EJU=;
 b=LOBB+d6dUtOUIDqYwrKgZpYfVneWjsd0pxwYb/PoRu9/qp26+3/yQjrNd+X1g9Qm
 gq3kiJ4OpyxOsrkzaVaipCiue8uOmPO6ntf/qQ9QYzxLMhb7UXxA+86ZHAAkHET3Pj5
 puo2gBP5q1l/WzjXXh7Ld9D0dVnW4VZrspEvOcC4=
Received: from localhost (port-92-200-194-49.dynamic.qsc.de [92.200.194.49])
 by mx.zohomail.com with SMTPS id 1514925879695415.46803452792415;
 Tue, 2 Jan 2018 12:44:39 -0800 (PST)
From: Ricardo Wurmus <rekado@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] WIP guix: Add wrap-script.
Date: Tue,  2 Jan 2018 21:44:34 +0100
X-Mailer: git-send-email 2.15.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Message-ID: <20180102204434.2716-1-rekado@HIDDEN>
X-ZohoMailClient: External
X-ZohoMail: Z_26063301 SPT_1 Z_26062608 SPT_0
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
Cc: Ricardo Wurmus <rekado@HIDDEN>, h.goebel@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

* guix/build/utils.scm (wrap-script): New procedure.
---
 guix/build/utils.scm | 101 +++++++++++++++++++++++++++++++++++++++++++++++=
++++
 1 file changed, 101 insertions(+)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 7391307c8..a2efcb31c 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -3,6 +3,7 @@
 ;;; Copyright =C2=A9 2013 Andreas Enge <andreas@HIDDEN>
 ;;; Copyright =C2=A9 2013 Nikita Karetnikov <nikita@HIDDEN>
 ;;; Copyright =C2=A9 2015 Mark H Weaver <mhw@HIDDEN>
+;;; Copyright =C2=A9 2018 Ricardo Wurmus <rekado@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -84,6 +85,7 @@
             fold-port-matches
             remove-store-references
             wrap-program
+            wrap-script
             invoke
=20
             locale-category->string))
@@ -1068,6 +1070,105 @@ with definitions for VARS."
         (chmod prog-tmp #o755)
         (rename-file prog-tmp prog))))
=20
+(define wrap-script
+  (let ((interpreter-regex
+         (make-regexp
+          (string-append "^#! ?(/bin/sh|/gnu/store/[^/]+/bin/("
+                         (string-join '("python[^ ]*"
+                                        "Rscript"
+                                        "perl"
+                                        "ruby"
+                                        "bash"
+                                        "sh") "|")
+                         ") ?.*)")))
+        (coding-line-regex
+         (make-regexp
+          ".*#.*coding[=3D:][[:space:]]*([-[a-zA-Z_0-9].]+)")))
+    (lambda* (prog #:rest vars)
+      "Wrap the script PROG such that VARS are set first.  The format of V=
ARS
+is the same as in the WRAP-PROGRAM procedure.  This procedure differs from
+WRAP-PROGRAM in that it does not create a separate shell script.  Instead,
+PROG is modified directly by prepending a Guile script, which is interpret=
ed
+as a comment in the script's language.
+
+Special encoding comments as supported by Python are recreated on the seco=
nd
+line.
+
+Note that this procedure can only be used once per file as Guile scripts a=
re
+not supported."
+      (define update-env
+        (match-lambda
+          ((var sep '=3D rest)
+           `(setenv ,var ,(string-join rest sep)))
+          ((var sep 'prefix rest)
+           `(let ((current (getenv ,var)))
+              (setenv ,var (if current
+                               (string-append ,(string-join rest sep)
+                                              ,sep current)
+                               ,(string-join rest sep)))))
+          ((var sep 'suffix rest)
+           `(let ((current (getenv ,var)))
+              (setenv ,var (if current
+                               (string-append current ,sep
+                                              ,(string-join rest sep))
+                               ,(string-join rest sep)))))
+          ((var '=3D rest)
+           `(setenv ,var ,(string-join rest ":")))
+          ((var 'prefix rest)
+           `(let ((current (getenv ,var)))
+              (setenv ,var (if current
+                               (string-append ,(string-join rest ":")
+                                              ":" current)
+                               ,(string-join rest ":")))))
+          ((var 'suffix rest)
+           `(let ((current (getenv ,var)))
+              (setenv ,var (if current
+                               (string-append current ":"
+                                              ,(string-join rest ":"))
+                               ,(string-join rest ":")))))))
+      (let-values (((interpreter coding-line)
+                    (call-with-ascii-input-file prog
+                      (lambda (p)
+                        (values (false-if-exception
+                                 (and=3D> (regexp-exec interpreter-regex (=
read-line p))
+                                        (lambda (m) (match:substring m 1))=
))
+                                (false-if-exception
+                                 (and=3D> (regexp-exec coding-line-regex (=
read-line p))
+                                        (lambda (m) (match:substring m 0))=
)))))))
+        (when interpreter
+          (let* ((header (format #f "\
+#!~a --no-auto-compile
+#!#; ~a
+#\\-~s
+#\\-~s
+"
+                                 (which "guile")
+                                 (or coding-line "Guix wrapper")
+                                 (cons 'begin (map update-env vars))
+                                 `(apply execl ,interpreter
+                                         (car (command-line))
+                                         (command-line))))
+                 (template (string-append prog ".XXXXXX"))
+                 (out      (mkstemp! template))
+                 (st       (stat prog))
+                 (mode     (stat:mode st)))
+            (with-throw-handler #t
+              (lambda ()
+                (call-with-ascii-input-file prog
+                  (lambda (p)
+                    (format out header)
+                    (dump-port p out)
+                    (close out)
+                    (chmod template mode)
+                    (rename-file template prog)
+                    (set-file-time prog st))))
+              (lambda (key . args)
+                (format (current-error-port)
+                        "wrap-script: ~a: error: ~a ~s~%"
+                        prog key args)
+                (false-if-exception (delete-file template))
+                #f))))))))
+
 =0C
 ;;;
 ;;; Locales.
--=20
2.15.0







Acknowledgement sent to Ricardo Wurmus <rekado@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#29951; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 4 Feb 2019 10:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.