unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Nikita Karetnikov <nikita@karetnikov.org>
Cc: bug-guix@gnu.org
Subject: Re: Toward 0.2
Date: Sat, 02 Mar 2013 22:30:53 +0100	[thread overview]
Message-ID: <87ehfx32wi.fsf@gnu.org> (raw)
In-Reply-To: <87mwula74u.fsf@karetnikov.org> (Nikita Karetnikov's message of "Sun, 03 Mar 2013 00:17:37 +0400")

Nikita Karetnikov <nikita@karetnikov.org> 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’re 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’t bother, though, because it will be used in contexts where
there’s no risk of ‘prog’ being used while we’re fiddling with it
(single-threaded, after ‘make install’).

> From 6bd8c169c320ffe9dd13a85a6f63a60b8508bc3c Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <nikita@karetnikov.org>
> 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’.

  reply	other threads:[~2013-03-02 21:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-17 15:10 Toward 0.2 Ludovic Courtès
2013-02-18  1:58 ` Nikita Karetnikov
2013-02-18 10:26   ` Ludovic Courtès
2013-02-20  0:39     ` Nikita Karetnikov
2013-02-20 11:28       ` Ludovic Courtès
2013-02-21 17:36         ` Nikita Karetnikov
2013-02-22 14:31           ` Ludovic Courtès
2013-02-26 10:43             ` Nikita Karetnikov
2013-02-26 16:51               ` Mark H Weaver
2013-02-26 19:14               ` Ludovic Courtès
2013-02-28 20:53                 ` Nikita Karetnikov
2013-03-01  9:15                   ` Ludovic Courtès
2013-03-01 15:01                     ` Nikita Karetnikov
2013-03-01 17:28                       ` Ludovic Courtès
2013-03-02 20:17                         ` Nikita Karetnikov
2013-03-02 21:30                           ` Ludovic Courtès [this message]
2013-03-03 12:52                             ` [PATCH] utils: Add 'wrap-program'. (was: Toward 0.2) Nikita Karetnikov
2013-03-03 21:29                               ` [PATCH] utils: Add 'wrap-program' Ludovic Courtès
2013-03-03 23:11                                 ` Nikita Karetnikov
2013-03-04 10:08                                   ` Ludovic Courtès
2013-02-20  9:00 ` Toward 0.2 Andreas Enge
2013-04-15 21:59 ` Ludovic Courtès
2013-04-29 21:32   ` Ludovic Courtès
2013-05-11 20:41   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ehfx32wi.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=bug-guix@gnu.org \
    --cc=nikita@karetnikov.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).