[PATCH core-updates] build: Set $0 to basename of command in `wrap-program'.

  • Open
  • quality assurance status badge
Details
One participant
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Maxim Cournoyer
Severity
normal
M
M
Maxim Cournoyer wrote on 22 Sep 08:06 +0200
(address . guix-patches@gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com
* guix/build/utils.scm (wrap-program): Set the value of the -a option of
`exec' in the wrapper to ${0##*/} instead of $0, to use its base name instead
of the complete file name.

Change-Id: Iec5984d4d934c8df88a90ff653947f7d07413ae4
---

guix/build/utils.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (26 lines)
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 94714bf397..7003d8262f 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -1355,7 +1355,7 @@ (define* (wrap-program prog #:key (sh (which "bash")) #:rest vars)
#!location/of/bin/bash
export PATH=\"/gnu/.../bar/bin\"
export CERT_PATH=\"$CERT_PATH${CERT_PATH:+:}/gnu/.../baz/certs:/qux/certs\"
- exec -a $0 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
@@ -1432,7 +1432,7 @@ (define* (wrap-program prog #:key (sh (which "bash")) #:rest vars)
(call-with-output-file prog-tmp
(lambda (port)
(format port
- "#!~a~%~a~%exec -a \"$0\" \"~a\" \"$@\"~%"
+ "#!~a~%~a~%exec -a \"${0##*/}\" \"~a\" \"$@\"~%"
sh
(string-join (map export-variable vars/filtered) "\n")
(canonicalize-path wrapped-file))))

base-commit: 2c54c2db410ebdda8cd71716315e4ea4d31befbd
--
2.46.0
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 73416@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73416
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch