From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Toward 0.2 Date: Sat, 02 Mar 2013 22:30:53 +0100 Message-ID: <87ehfx32wi.fsf@gnu.org> References: <877gm7f01v.fsf@gnu.org> <87obfigz7g.fsf@karetnikov.org> <87y5el6hph.fsf@gnu.org> <87fw0rom1n.fsf@karetnikov.org> <87ehgbql5w.fsf@gnu.org> <87hal5ftyu.fsf@karetnikov.org> <874nh4ju7b.fsf@gnu.org> <87hakzwdzu.fsf@karetnikov.org> <87wqtu3n0z.fsf@gnu.org> <87ehg0rwfd.fsf@karetnikov.org> <87bob38ord.fsf@gnu.org> <87sj4f6u39.fsf@karetnikov.org> <87hakv6ndr.fsf@gnu.org> <87mwula74u.fsf@karetnikov.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBu1K-00018Q-Rn for bug-guix@gnu.org; Sat, 02 Mar 2013 16:31:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBu1J-0005hh-Ct for bug-guix@gnu.org; Sat, 02 Mar 2013 16:31:06 -0500 Received: from [2a01:e0b:1:123:ca0a:a9ff:fe03:271e] (port=50555 helo=xanadu.aquilenet.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBu1J-0005g9-6J for bug-guix@gnu.org; Sat, 02 Mar 2013 16:31:05 -0500 In-Reply-To: <87mwula74u.fsf@karetnikov.org> (Nikita Karetnikov's message of "Sun, 03 Mar 2013 00:17:37 +0400") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Nikita Karetnikov Cc: bug-guix@gnu.org Nikita Karetnikov skribis: > Is there a way to compose the following part somehow to prevent a > possible race condition? > > (rename-file prog prog-real) > > (with-output-to-file prog (lambda () > (format #t > "#!~a~%~a~%exec ~a~%" > (which "bash") > (string-join (map export-variable= vars) > "\n") > (canonicalize-path prog-real)))) > (chmod prog #o755))) If you=E2=80=99re really concerned, you could do (pseudocode): cp prog prog-real echo wrapper code > prog.tmp chmod +x prog.tmp rename prog.tmp prog I wouldn=E2=80=99t bother, though, because it will be used in contexts where there=E2=80=99s no risk of =E2=80=98prog=E2=80=99 being used while we=E2=80= =99re fiddling with it (single-threaded, after =E2=80=98make install=E2=80=99). > From 6bd8c169c320ffe9dd13a85a6f63a60b8508bc3c Mon Sep 17 00:00:00 2001 > From: Nikita Karetnikov > Date: Sat, 2 Mar 2013 20:08:39 +0000 > Subject: [PATCH] utils: Add 'wrap-program'. > > * guix/build/utils.scm (wrap-program): New procedure. > --- > guix/build/utils.scm | 40 +++++++++++++++++++++++++++++++++++++++- > 1 files changed, 39 insertions(+), 1 deletions(-) Looks good to me. > +(define* (wrap-program prog #:rest vars) > + "Rename PROG to .PROG-real and make PROG a wrapper." Can you just expound the docstring before pushing? Thanks! Ludo=E2=80=99.