GNU bug report logs - #73416
[PATCH core-updates] build: Set $0 to basename of command in `wrap-program'.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; Keywords: patch; dated Sun, 22 Sep 2024 06:08:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 Sep 2024 06:07:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 02:07:06 2024
Received: from localhost ([127.0.0.1]:40673 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssFkQ-0003ps-9b
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 02:07:06 -0400
Received: from lists.gnu.org ([209.51.188.17]:54716)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1ssFkO-0003pi-DH
 for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 02:07:04 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1ssFk2-0006OP-TT
 for guix-patches@HIDDEN; Sun, 22 Sep 2024 02:06:42 -0400
Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1ssFjz-0007ld-4a
 for guix-patches@HIDDEN; Sun, 22 Sep 2024 02:06:42 -0400
Received: by mail-pl1-x635.google.com with SMTP id
 d9443c01a7336-20551eeba95so29383845ad.2
 for <guix-patches@HIDDEN>; Sat, 21 Sep 2024 23:06:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726985196; x=1727589996; darn=gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=P2Q2HxQsu6jegrtbXoqH9WFTbwjHYLujVby1Pg+Ot3s=;
 b=BzNYTbFzQf1HMue3NRLbYKFw6QlqDIqS0KLZrFKGgf24bG3Yqe4P6eHHH+vmxAUHWL
 vbaHkzQPwk2iH1Tup2WkVClevDTCb/axmUX1u17KX+UtsEaWDSkhbDN/6VcvT3aLRC33
 yfAgdHyLHtwRkMeBBcZe4gB5AZ0ESB6Hk9qvquaO+rDDjeAwykeBf8imUphgu5ELlpOK
 PcHvzanOOFz9Mu/N523di3Euu4avI7GF1JKl3LYkfQK9hs2M8jUDTla8PtvvQerxX8dn
 uYUl0fP1Tk78NTBlQFUiw+9l4oxmtVbo2QtPOLcY67a2kd0LGF+EOd/A+nwRfpZP6SD9
 axzg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726985196; x=1727589996;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=P2Q2HxQsu6jegrtbXoqH9WFTbwjHYLujVby1Pg+Ot3s=;
 b=DDs/uoeA6tXvy5uIm+3SC0LzrR6yBisDY8GfvrIFaOIFYYzozOvXjmSGIWePoVeHgQ
 e5HlN4CdX6/5Bs+GmbzVv8P0TWipfv/YN3mBejID2ipKkUcX0BGFIRXJH5khSgqDINnW
 Ozlxfe9ZFzxKp2hdFhhsw8qwVjzARfeU/K0b0U2Dr+KlN36K3k0B9u7Oa2Nl9W84Ou8Z
 Q3xU7Z0k2Ckx3jlMdxvv1Tvt6NKYvwhsEBrksM65ezBfyBaAPl6p0k33DFH1xX7siT0c
 XibG+CbBXZoapnA9A4MxoroBRCSSZYACi9H9JOWG6Bj+Q9HTJGt1svyIYd0/IpCEuOd7
 A8jQ==
X-Gm-Message-State: AOJu0YxB8lsC63FVuoq70BLdK2dDs0d26Xyvfujv/LaFTzqNzAdXIGuN
 19fxWIl6BSG3TtdkgmR6eWzllpBZhOpKfqScTMHPSlHVz7EP2A0wbmmMyA==
X-Google-Smtp-Source: AGHT+IHpVrITYXH+9kes1KdvxDONy3kvHNtk41Kkm+ipU0ibBljAlJjSBua6+8ni3PeNHSVM68S//A==
X-Received: by 2002:a17:902:fc50:b0:205:7b1f:cf6d with SMTP id
 d9443c01a7336-208d83ce35dmr135561265ad.30.1726985195894; 
 Sat, 21 Sep 2024 23:06:35 -0700 (PDT)
Received: from hurd.lan ([2405:6586:be0:0:c8ff:1707:9b9:af89])
 by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-20794600fddsm116225365ad.82.2024.09.21.23.06.33
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 21 Sep 2024 23:06:34 -0700 (PDT)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH core-updates] build: Set $0 to basename of command in
 `wrap-program'.
Date: Sun, 22 Sep 2024 15:06:18 +0900
Message-ID: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.46.0
MIME-Version: 1.0
X-Debbugs-Cc: Andreas Enge <andreas@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::635;
 envelope-from=maxim.cournoyer@HIDDEN; helo=mail-pl1-x635.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

* 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





Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
New bug report received and forwarded. Copy sent to andreas@HIDDEN, ludo@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to andreas@HIDDEN, ludo@HIDDEN, guix-patches@HIDDEN:
bug#73416; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.