Revert "utils: Set $0 to basename of command in `wrap-program'."

This reverts commit df94888eca.  This was
working around a problem in cling, which should be addressed in cling -- the
wrapper should be as transparent as possible.

Fixes: #1674
Change-Id: Ib4e5d62c5eb65c92ece8a99a10979a1f0173d49c
This commit is contained in:
Maxim Cournoyer 2025-08-08 14:05:40 +09:00
parent aeb3e89699
commit bb81a40b22
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -1355,7 +1355,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 \"${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 @@ with definitions for VARS. If it is not, SH will be used as interpreter."
(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))))