all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 73416@debbugs.gnu.org
Cc: "Maxim Cournoyer" <maxim.cournoyer@gmail.com>,
	"Andreas Enge" <andreas@enge.fr>,
	"Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#73416] [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'.
Date: Sun, 22 Sep 2024 15:06:18 +0900	[thread overview]
Message-ID: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> (raw)

* 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.

Fixes: https://issues.guix.gnu.org/73405
Change-Id: Iec5984d4d934c8df88a90ff653947f7d07413ae4
---

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

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





                 reply	other threads:[~2024-09-22  6:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=73416@debbugs.gnu.org \
    --cc=andreas@enge.fr \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.