summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-12-14 11:54:12 +0100
committerLudovic Courtès <ludo@gnu.org>2014-12-14 11:54:12 +0100
commit2ed11b3a3e05549ed6ef8a604464f424c0eeae1c (patch)
tree6ec326d39b9ec1b05574b419638bf36f02e8e17a /guix
parentc809ec94d11f1c7e23cccb988dfb1412aff72636 (diff)
utils: Change 'wrap-program' to preserve the original argv[0].
Suggested by Mark H Weaver <mhw@netris.org> in <http://bugs.gnu.org/19138>. * guix/build/utils.scm (wrap-program): Change wrapper to use "exec -a PROG" instead of just "exec".
Diffstat (limited to 'guix')
-rw-r--r--guix/build/utils.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index be91fb467b..9b1e098c6b 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -762,7 +762,7 @@ contents:
#!location/of/bin/bash
export PATH=\"/gnu/.../bar/bin\"
export CERT_PATH=\"$CERT_PATH${CERT_PATH:+:}/gnu/.../baz/certs:/qux/certs\"
- exec location/of/.foo-real
+ exec -a location/of/foo location/of/.foo-real \"$@\"
This is useful for scripts that expect particular programs to be in $PATH, for
programs that expect particular shared libraries to be in $LD_LIBRARY_PATH, or
@@ -786,6 +786,7 @@ the previous wrapper."
(copy-file prog prog-real)
prog-real)
(wrapper-file-name number)))
+
(let* ((number (next-wrapper-number))
(target (wrapper-target number))
(wrapper (wrapper-file-name (1+ number)))
@@ -815,10 +816,11 @@ the previous wrapper."
(with-output-to-file prog-tmp
(lambda ()
(format #t
- "#!~a~%~a~%exec \"~a\" \"$@\"~%"
+ "#!~a~%~a~%exec -a \"~a\" \"~a\" \"$@\"~%"
(which "bash")
(string-join (map export-variable vars)
"\n")
+ (canonicalize-path prog)
(canonicalize-path target))))
(chmod prog-tmp #o755)