bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Toward 0.2


From: Ludovic Courtès
Subject: Re: Toward 0.2
Date: Sat, 02 Mar 2013 22:30:53 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Nikita Karetnikov <address@hidden> 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 <address@hidden>
> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]