summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Enge <andreas@enge.fr>2015-02-15 17:14:53 +0100
committerAndreas Enge <andreas@enge.fr>2015-02-16 10:13:39 +0100
commitb01f89675d03202851a00c38d4995424bbb1879f (patch)
tree6eea8d77960ee1aa863c7f69e5449e145e41a8a7
parent3e74dcd0bb3d98d53e9f5e546a107af303d33bbc (diff)
downloadguix-b01f89675d03202851a00c38d4995424bbb1879f.tar.gz
utils: Use $0 instead of absolute path to original program in 'wrap-program'.
* guix/build/utils.scm (wrap-program): Create scripts that use $0 (which is
    usually just the base name) instead of the absolute path to the original
    program. Alternative implementation of 2ed11b3.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>

Closes <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19742>.
-rw-r--r--guix/build/utils.scm5
1 files changed, 2 insertions, 3 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index c7fdd1d553..a3446cb617 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -816,7 +816,7 @@ contents:
   #!location/of/bin/bash
   export PATH=\"/gnu/.../bar/bin\"
   export CERT_PATH=\"$CERT_PATH${CERT_PATH:+:}/gnu/.../baz/certs:/qux/certs\"
-  exec -a location/of/foo location/of/.foo-real \"$@\"
+  exec -a $0 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
@@ -870,11 +870,10 @@ the previous wrapper."
     (with-output-to-file prog-tmp
       (lambda ()
         (format #t
-                "#!~a~%~a~%exec -a \"~a\" \"~a\" \"$@\"~%"
+                "#!~a~%~a~%exec -a \"$0\" \"~a\" \"$@\"~%"
                 (which "bash")
                 (string-join (map export-variable vars)
                              "\n")
-                (canonicalize-path prog)
                 (canonicalize-path target))))
 
     (chmod prog-tmp #o755)