[bug#73416] Revert "utils: Set $0 to basename of command in `wrap-program'."

Message ID 277e280c274d75de7b06b8b31b65b383b486f46b.1754850565.git.~@wolfsden.cz
State New
Headers
Series [bug#73416] Revert "utils: Set $0 to basename of command in `wrap-program'." |

Commit Message

Tomas Volf Aug. 10, 2025, 6:29 p.m. UTC
This reverts commit df94888eca214c496b5cdf57795e03b96866c3af.
---
I think just reverting the original commit should be fine?  CC-ing both Maxim
and Andreas.

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

--
2.50.1
  

Comments

Maxim Cournoyer Aug. 11, 2025, 7:43 a.m. UTC | #1
Hi Tomas,

Tomas Volf <~@wolfsden.cz> writes:

> This reverts commit df94888eca214c496b5cdf57795e03b96866c3af.
> ---
> I think just reverting the original commit should be fine?  CC-ing both Maxim
> and Andreas.

I think so. Already covered by
https://codeberg.org/guix/guix/pulls/1877, so closing here.
  

Patch

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 7003d8262f..94714bf397 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))))