From unknown Sun Aug 10 16:47:13 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#73416 <73416@debbugs.gnu.org> To: bug#73416 <73416@debbugs.gnu.org> Subject: Status: [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'. Reply-To: bug#73416 <73416@debbugs.gnu.org> Date: Sun, 10 Aug 2025 23:47:13 +0000 retitle 73416 [PATCH core-updates] build: Set $0 to basename of command in = `wrap-program'. reassign 73416 guix-patches submitter 73416 Maxim Cournoyer severity 73416 normal tag 73416 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 22 02:07:06 2024 Received: (at submit) by debbugs.gnu.org; 22 Sep 2024 06:07:06 +0000 Received: from localhost ([127.0.0.1]:40673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ssFkQ-0003ps-9b for submit@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 ) id 1ssFkO-0003pi-DH for submit@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 ) id 1ssFk2-0006OP-TT for guix-patches@gnu.org; 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 ) id 1ssFjz-0007ld-4a for guix-patches@gnu.org; Sun, 22 Sep 2024 02:06:42 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-20551eeba95so29383845ad.2 for ; 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 To: guix-patches@gnu.org 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@gmail.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Debbugs-Cc: Andreas Enge , Ludovic Courtès Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=maxim.cournoyer@gmail.com; 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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 22 18:35:46 2025 Received: (at 73416-done) by debbugs.gnu.org; 22 Mar 2025 22:35:46 +0000 Received: from localhost ([127.0.0.1]:46127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tw7RS-0004I5-4n for submit@debbugs.gnu.org; Sat, 22 Mar 2025 18:35:46 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:48278) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tw7RK-0004Ge-7E; Sat, 22 Mar 2025 18:35:38 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 34888D73; Sat, 22 Mar 2025 23:35:31 +0100 (CET) Authentication-Results: hera.aquilenet.fr; none X-Virus-Scanned: Debian amavis at hera.aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavis, port 10024) with ESMTP id FmM2WQsno7ns; Sat, 22 Mar 2025 23:35:30 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 2933FC8E; Sat, 22 Mar 2025 23:35:29 +0100 (CET) From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxim Cournoyer Subject: Re: bug#73416: [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'. In-Reply-To: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Sun, 22 Sep 2024 15:06:18 +0900") References: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> Date: Sat, 22 Mar 2025 23:35:28 +0100 Message-ID: <87tt7k4rtb.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 34888D73 X-Spamd-Result: default: False [-1.60 / 15.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM(-3.00)[-1.000]; FORGED_RECIPIENTS(2.00)[m:andreas@enge.fr,s:andreas.enge@aquilenet.fr]; SUSPICIOUS_RECIPS(1.50)[]; SUBJECT_HAS_CURRENCY(1.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; RCPT_COUNT_THREE(0.00)[4]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TAGGED_RCPT(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[] X-Rspamd-Action: no action X-Spamd-Bar: - X-Rspamd-Server: hera X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 73416-done Cc: 73416-done@debbugs.gnu.org, Andreas Enge , 73405-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Maxim Cournoyer skribis: > * 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 ins= tead > of the complete file name. > > Fixes: https://issues.guix.gnu.org/73405 > Change-Id: Iec5984d4d934c8df88a90ff653947f7d07413ae4 Applied to =E2=80=98core-packages-team=E2=80=99, thanks! Ludo=E2=80=99. From unknown Sun Aug 10 16:47:13 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 20 Apr 2025 11:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 19 22:01:29 2025 Received: (at control) by debbugs.gnu.org; 20 Jul 2025 02:01:29 +0000 Received: from localhost ([127.0.0.1]:46639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1udJMm-0004Hv-UJ for submit@debbugs.gnu.org; Sat, 19 Jul 2025 22:01:29 -0400 Received: from out-182.mta1.migadu.com ([2001:41d0:203:375::b6]:35395) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1udJMj-0004HU-JD for control@debbugs.gnu.org; Sat, 19 Jul 2025 22:01:26 -0400 Date: Sat, 19 Jul 2025 21:01:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpfr.net; s=key1; t=1752976877; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=LdJU1l1Avtbb0Jg7WaB1gNq6DFqp7QaCsumZ9j/R574=; b=Y4Bi9CRiQHvgr4m4T/0dHKyyUYP1517VS53rZveoHyabigYz+1f49LFP6EuL7tFN1gV464 QqOjuGCjeiidxXwBAR0Io3iuMHEoMyI6Zh+sfOJNO4T7akCK0xJIF9eey135LHhyH1nNdc GJmMp0R8rHO0neWtZS2wXJcqiypLlhyb2kjwoqLwVh/QPtOHC9hR39V0et8z1xINOe6UZ3 ZP6j+j6zum8dv6utjwXZRSS9R3lVy1B21n+vVPos80joTbadtrnmtFP4xDoK05tUqXuHna a+NnV2nHjXwnZeHWI4JY3NT+CBE36IfccukzFsFfEpe/2sdFtQtsfu4ftAxI+A== Message-ID: <5d21a41fc94d85188128cb65cd9f1e91@hpfr.net> To: control@debbugs.gnu.org X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Liam Hupfer Subject: control message for bug #73416 X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) unarchive 73416 quit From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 19 22:54:58 2025 Received: (at 73416) by debbugs.gnu.org; 20 Jul 2025 02:54:58 +0000 Received: from localhost ([127.0.0.1]:46911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1udKCX-0002Z2-ST for submit@debbugs.gnu.org; Sat, 19 Jul 2025 22:54:58 -0400 Received: from out-188.mta1.migadu.com ([95.215.58.188]:51743) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1udKCV-0002Yj-Af for 73416@debbugs.gnu.org; Sat, 19 Jul 2025 22:54:56 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpfr.net; s=key1; t=1752980088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vClUf46QgRTpJGXN4iCyJooz2al+Uuw7og1+JyJubvY=; b=jJPvNaTBwrODVt1TFxKRCb1lQlp5cwglyfUK9RZ45nm/tUsKkMuVDc+uZ5Ote9LOxW3je5 NYAedm76ugAI35znHMRDCSpymrKmd8x7J+loey9ZrgV5Kj4qYLydAjg5q30LJTtG3M2Vod 5oOvyIW4HovPqLwaWsTFVG9AakGOP+CTT7NJMshqvlcdcAi1Xpy+t2K5WwaFSyfem/pGDe FIDbriQ35ukIWlFG1H3MpN8t3HrT1ckZrmxxOsoxmr1S2+tGqAU6I5ZJ06yefsQ/JUt3sA Eb515mgA3hdYX9fPLowcE8yLuUDVyl8mMSHHA/5qBejcPIq7B7Lbrup1x83OFg== From: Liam Hupfer To: Maxim Cournoyer , 73416@debbugs.gnu.org Subject: Re: [bug#73416] [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'. In-Reply-To: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> References: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> Date: Sat, 19 Jul 2025 21:54:43 -0500 Message-ID: <87qzybo9l8.fsf@hpfr.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 73416 Cc: Andreas Enge , Ludovic =?utf-8?Q?Court=C3=A8s?= , Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Maxim Cournoyer writes: > * guix/build/utils.scm (wrap-program): Set the value of the -a option of > `exec=E2=80=99 in the wrapper to ${0##*/} instead of $0, to use its base = name instead > of the complete file name. > > Fixes: > Change-Id: Iec5984d4d934c8df88a90ff653947f7d07413ae4 I have a hacky extra wrap-program around Emacs (in a separate package so I don=E2=80=99t have to rebuild Emacs), and this change (now on master afte= r the recent core-packages-team merge) seems to have broken it: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 $ emacs =E2=94=82 Error using execdir /gnu/store/0jz32qbcibz6y5xzm6jwzh0x8kviy9gz-e= macs-pgtk-gtk-wrapper-30.1-1.a05be41/bin/: =E2=94=82 emacs: /gnu/store/0jz32qbcibz6y5xzm6jwzh0x8kviy9gz-emacs-pgtk-gtk= -wrapper-30.1-1.a05be41/bin/../native-lisp/30.1.90-f736b5c5/preloaded/windo= w.eln: cannot open shared object file: No such file or directory =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 It appears Emacs does some dubious things in =E2=80=98find_emacs_executable= =E2=80=99; namely, if you execute Emacs without a slash in =E2=80=98argv[0]=E2=80=99, = it =E2=80=9Cresolves=E2=80=9D the path by just searching PATH for =E2=80=98argv[0]=E2=80=99. This heurist= ic is used to find the native-lisp directory, and it breaks when a wrapper like this is not in the same directory as the Emacs executable. I am not really advocating for reverting this. I don=E2=80=99t think Emacs should assume =E2=80=98argv[0]=E2=80=99 is correlated to the executable fil= e name. I just want to write this down in proximity to the change that exposed it. I will probably report to Emacs since the C is relatively new. =E2=80=94Liam --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 21 01:24:40 2025 Received: (at 73416) by debbugs.gnu.org; 21 Jul 2025 05:24:40 +0000 Received: from localhost ([127.0.0.1]:54483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1udj0y-0005sj-7F for submit@debbugs.gnu.org; Mon, 21 Jul 2025 01:24:40 -0400 Received: from out-182.mta1.migadu.com ([2001:41d0:203:375::b6]:38862) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1udj0w-0005sL-27 for 73416@debbugs.gnu.org; Mon, 21 Jul 2025 01:24:38 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpfr.net; s=key1; t=1753075470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uOxKe2CpVz/BIMamkiCwnd3rPTBlWLy/0czdV9QH934=; b=C1m15NJY3edMmcAixA8Rx+YQqg6r2HWu7NRiYUlrAAbfMm7AH7MwMBVRYc2N3Zb2JF7fiL bCQyFyemiVSom2cNq3xIqhVE/h5zZ/IELFGkvqEtWZQqVtFKkDSLXjD/OGTo7//wjEuuvP 51/rDBWIXgHDmjOSoaAmrYEAdDCEpg6B7mA4bHyYyybf8rQ726w+/rWtRVJjArA2i8AOlq NpfA8QvcZPd6dFHTXv20qAkylzSBXZK//2mYeeJ1I6IZ9uPaOBcldikAGFFHKCcYCxieIp 7A+4TtB0fXWthe5UekmRy+7DENHWylG1IA13Lj7nyf2Hnh0EAlKNFjD8+3sdZg== From: Liam Hupfer To: Maxim Cournoyer , 73416@debbugs.gnu.org Subject: Re: [bug#73416] [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'. In-Reply-To: <87qzybo9l8.fsf@hpfr.net> References: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> <87qzybo9l8.fsf@hpfr.net> Date: Mon, 21 Jul 2025 00:24:18 -0500 Message-ID: <874iv6p14t.fsf@hpfr.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 73416 Cc: Andreas Enge , Ludovic =?utf-8?Q?Court=C3=A8s?= , Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Liam Hupfer writes: > I am not really advocating for reverting this. I don=E2=80=99t think Emacs > should assume =E2=80=98argv[0]=E2=80=99 is correlated to the executable f= ile name. I > just want to write this down in proximity to the change that exposed it. > I will probably report to Emacs since the C is relatively new. I opened [bug#79064: native-lisp directory resolution shouldn=E2=80=99t dep= end on Emacs filename resolution via argv[0]=E2=80=8B]. On second thought, though, I think we should consider reverting the change to =E2=80=98wrap-program=E2=80=99. [bug#73405: wrap-program should u= se the basename of $0 as arg0] does not describe why =E2=80=98cling=E2=80=99 was s= egfaulting, but I suspect it=E2=80=99s due to similar bad assumptions about argv[0] as = the Emacs issue. I think wrappers should be as transparent as possible=E2=80=94however the u= ser invokes a command should be preserved in argv[0], whether using a basename with PATH resolution or a relative or absolute filename. We shouldn=E2=80=99t coerce argv[0] to a basename when the wrapper wasn=E2=80= =99t called that way. 99% of the time argv[0] is irrelevant, but the common case I=E2= =80=99m considering is programs that log how they were called=E2=80=94it=E2=80=99s = disorienting for the wrapper to affect that. Maybe we can expose an argument to wrap-program to use the basename approach, but IMO we should be handling the root cause in cases where problems occur and pushing upstreams to handle arbitrary argv[0] values robustly. WDYT? Thanks! =E2=80=94Liam [bug#79064: native-lisp directory resolution shouldn=E2=80=99t depend on Emacs filename resolution via argv[0]=E2=80=8B] [bug#73405: wrap-program should use the basename of $0 as arg0] --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 21 08:02:32 2025 Received: (at 73416) by debbugs.gnu.org; 21 Jul 2025 12:02:32 +0000 Received: from localhost ([127.0.0.1]:56078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1udpE0-0001nO-3g for submit@debbugs.gnu.org; Mon, 21 Jul 2025 08:02:32 -0400 Received: from wolfsden.cz ([37.205.8.62]:48096) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1udpDt-0001nB-8G for 73416@debbugs.gnu.org; Mon, 21 Jul 2025 08:02:29 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id B6B442695F0; Mon, 21 Jul 2025 12:02:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1753099343; bh=2NS45JLbzCgUzPu3kRApuveVIsr/uS1vqCPtRqnvCZg=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=pzS1SeSu5nDjHdGC2nu/8sx6ffha2bMtSmCvT8O3C4NHicAM5KtmB5u8pTzS4rG1k rs3Kb8CqPm1PwNDON+QGz7yzZ20JSgKq9/Me/4y+pAp8JPRDeh8AmYEkW3pKgyPZ/U SFvW/mMURgb2z+8PZSzMUrgMN6Q6ts0XgNaep9NGeWSo1JRA86A9+Ss7yjLcBe3fow lTS3JSFPloMs9AP+hFhXsP56XgK0illX4/8vA8IRpKg4YANzPPmFVaefW5UATY0yjq pIifSlHaaIighRbKwMkVx8j8LB8FhMyUIpqVzSNbiYVmnZ94396lEKwaHFRG/g5hPy pnW55tQhVGDzRUbOozVq/wwYXTYkItBjjkhDpvMWUoIg76K3vCCsGm5dlArLyYqZJH n2RnXavHupXNcMkXAEwkL1mV3qKo0Pp36S1ariF+kJfs6qFgh1cfN7rlQZOwJjQl6o yQEfuQsn11u7x5FJpWJizDMcePtmum4O+XVwwsgrgiJWYlaNUC1yVFYn8sqWcF1C+O JZogemj+DopjWxiuUGS5WcQmbhcmGe7xUaxAETtsYtqiKdWxBAegrnze7E6p8A+Jys B7JNfzbQ++mYgVA+o8vX/H3v+3tHAGfKnoj1ILwiGUUy+u+/6EoxS+uNy1yUflRp9j FCqSCJnpGTJHYYhUVb4blkmQ= X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 4637426B0B3; Mon, 21 Jul 2025 12:02:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1753099343; bh=2NS45JLbzCgUzPu3kRApuveVIsr/uS1vqCPtRqnvCZg=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=pzS1SeSu5nDjHdGC2nu/8sx6ffha2bMtSmCvT8O3C4NHicAM5KtmB5u8pTzS4rG1k rs3Kb8CqPm1PwNDON+QGz7yzZ20JSgKq9/Me/4y+pAp8JPRDeh8AmYEkW3pKgyPZ/U SFvW/mMURgb2z+8PZSzMUrgMN6Q6ts0XgNaep9NGeWSo1JRA86A9+Ss7yjLcBe3fow lTS3JSFPloMs9AP+hFhXsP56XgK0illX4/8vA8IRpKg4YANzPPmFVaefW5UATY0yjq pIifSlHaaIighRbKwMkVx8j8LB8FhMyUIpqVzSNbiYVmnZ94396lEKwaHFRG/g5hPy pnW55tQhVGDzRUbOozVq/wwYXTYkItBjjkhDpvMWUoIg76K3vCCsGm5dlArLyYqZJH n2RnXavHupXNcMkXAEwkL1mV3qKo0Pp36S1ariF+kJfs6qFgh1cfN7rlQZOwJjQl6o yQEfuQsn11u7x5FJpWJizDMcePtmum4O+XVwwsgrgiJWYlaNUC1yVFYn8sqWcF1C+O JZogemj+DopjWxiuUGS5WcQmbhcmGe7xUaxAETtsYtqiKdWxBAegrnze7E6p8A+Jys B7JNfzbQ++mYgVA+o8vX/H3v+3tHAGfKnoj1ILwiGUUy+u+/6EoxS+uNy1yUflRp9j FCqSCJnpGTJHYYhUVb4blkmQ= From: Tomas Volf <~@wolfsden.cz> To: Liam Hupfer Subject: Re: [bug#73416] [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'. In-Reply-To: <874iv6p14t.fsf@hpfr.net> (Liam Hupfer's message of "Mon, 21 Jul 2025 00:24:18 -0500") References: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> <87qzybo9l8.fsf@hpfr.net> <874iv6p14t.fsf@hpfr.net> Date: Mon, 21 Jul 2025 14:02:22 +0200 Message-ID: <87bjpdzr8x.fsf@wolfsden.cz> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73416 Cc: 73416@debbugs.gnu.org, Andreas Enge , Ludovic =?utf-8?Q?Court=C3=A8s?= , Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Liam Hupfer writes: > On second thought, though, I think we should consider reverting the > change to =E2=80=98wrap-program=E2=80=99. [bug#73405: wrap-program should= use the > basename of $0 as arg0] does not describe why =E2=80=98cling=E2=80=99 was= segfaulting, > but I suspect it=E2=80=99s due to similar bad assumptions about argv[0] a= s the > Emacs issue. > > I think wrappers should be as transparent as possible=E2=80=94however the= user > invokes a command should be preserved in argv[0], whether using a > basename with PATH resolution or a relative or absolute filename. We > shouldn=E2=80=99t coerce argv[0] to a basename when the wrapper wasn=E2= =80=99t called > that way. 99% of the time argv[0] is irrelevant, but the common case I=E2= =80=99m > considering is programs that log how they were called=E2=80=94it=E2=80=99= s disorienting > for the wrapper to affect that. > > Maybe we can expose an argument to wrap-program to use the basename > approach, but IMO we should be handling the root cause in cases where > problems occur and pushing upstreams to handle arbitrary argv[0] values > robustly. > > WDYT? Thanks! This member of the peanut gallery supports the revert. Exactly as you say, the wrappers should be as transparent as possible. So this mangling feels wrong. Tomas --=20 There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 22 21:28:55 2025 Received: (at 73416) by debbugs.gnu.org; 23 Jul 2025 01:28:56 +0000 Received: from localhost ([127.0.0.1]:46627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ueOHv-0002yE-GT for submit@debbugs.gnu.org; Tue, 22 Jul 2025 21:28:55 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:54293) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ueOHt-0002xp-0d for 73416@debbugs.gnu.org; Tue, 22 Jul 2025 21:28:53 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-23f8df98e41so10342625ad.0 for <73416@debbugs.gnu.org>; Tue, 22 Jul 2025 18:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753234127; x=1753838927; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rryKSK64BvoEfN0hWa4bcOWs5VoLQSFDJZSrZFwXdTY=; b=Znr1RdZvXn4AljtIRuP2+rryFTyM8kEIYoMiFrX6VezZlPykzlqXMTfDi8i0SpXIgi XCFQl5EfqTDm+YVgNuSRj2wDS/vcWdKDy/uc3ggyBsY9h/NN9i8BNlLCsp/0EqdcwVs8 cj1129zaSWHO6lUWUTw5i0flJcmcLWOji44fQ2FDmEwUZI4te5u7gzJ9KiwhyljgcVR/ kICuPBA/cUc4CFNfEiWxt2GM9Y6wYGy+NCLAqO/oVlfHn+kC/vdpDt4msRQx/3RRJaiy wRDfQk6NhE/VzsNzJ0HroeeYUeSBb2HgH0PhoivQ0Uk9YSZvbPdTu190p+tMfG72P8Ri +7xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753234127; x=1753838927; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rryKSK64BvoEfN0hWa4bcOWs5VoLQSFDJZSrZFwXdTY=; b=i/DP5JUV/xiYRSzQ+27bGc7C0uN4sab2llSMSTq3G4EEJ9F3hiRlegrL0dZOsbhp5D I9hjrLj2prwHHag3H4vzkExT/s2AEYK8T8mBS9ML6l6LxqZ6RDMBB4nh/AkL4O0H35PL jzhj82JIQWYOajXv6HnWO8sN0xDi/YfL9asTndpLobWQAyMFsyYh3aO7eDp+bhXqjZky +3EMM8B9LKxSM7fZQ7Exlar41lm0H6e42JjkFkU5CRjpImTEF9OVrSsVV0gH/qA3LtUV yGByhBbb2leZ+q7zeIeIUhWiyqH4UiDG0IXCx/NQuIYY9cuY6i137gPs0Dci//rcIbf+ Wy9w== X-Forwarded-Encrypted: i=1; AJvYcCUcrpe4GNoiA2Gszo5gfX+H2fwGVlt3SXHbeUUpsVfOFwuyRsN90UMEZO3nkZiwkAcHy55Etw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yw6ISCG4doO7K2DKo17yGmrXJzvAmyOH7FtYsWgG1IxgrzW9vJL uXMU0N4lF6zMdmG07gx4mgfMpMFsyfKFKVIe/gjmlVE0Lf4dXzax+ATT X-Gm-Gg: ASbGncsrE+fVmfhNHZNSfZPS0EP0Z+ERkik3aCrZf++Nd33YOVBeCwSbU2tUBhVIIpS 2xIuF11LRsPFnIPcU54PlY9rciW1TV8yqjOW5foGWbsD/OoVS2tlC8phlzuMCo8hfMzuKTmyzwq 19kyxCvgfz+nzUa8otdcdDbcl97xNXF+CaaOI1oLlCWKyHls4DD+OYY4fzckxZFAQNoN8HfmIcs d8W4ijw0NvzVDBreVwrW+pz28n2HpUBziVULjz55oOEntgNvhFKNeucxMpdEjoXW+7/Uk9q7EUa 4+FZB2Cgi1kO4XUFTMO4MSYmPsNLFYTHPkms3v8wMo7HwhqLI2JyeW5lrqIYDSXucYoy3RkV2EZ mwq/HgcOTWmtdRYS5p97gQpds X-Google-Smtp-Source: AGHT+IGxRpheVXPEGjXw8cHLknufcx1eFou7qEvTtPnCJDcDLcwD9JArEexT5KaevOIY7cGw2L2S5w== X-Received: by 2002:a17:903:b85:b0:234:ed31:fcaa with SMTP id d9443c01a7336-23f981dd9f1mr16851245ad.50.1753234126691; Tue, 22 Jul 2025 18:28:46 -0700 (PDT) Received: from terra ([2405:6586:7c0:4400:8c2a:c791:f284:c04b]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3bdfe68csm84056685ad.183.2025.07.22.18.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jul 2025 18:28:45 -0700 (PDT) From: Maxim Cournoyer To: Tomas Volf <~@wolfsden.cz> Subject: Re: [bug#73416] [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'. In-Reply-To: <87bjpdzr8x.fsf@wolfsden.cz> References: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> <87qzybo9l8.fsf@hpfr.net> <874iv6p14t.fsf@hpfr.net> <87bjpdzr8x.fsf@wolfsden.cz> Date: Wed, 23 Jul 2025 10:28:42 +0900 Message-ID: <87qzy71yr9.fsf@guixotic.coop> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73416 Cc: 73416@debbugs.gnu.org, Andreas Enge , Liam Hupfer , Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, Tomas Volf <~@wolfsden.cz> writes: > Liam Hupfer writes: > >> On second thought, though, I think we should consider reverting the >> change to =E2=80=98wrap-program=E2=80=99. [bug#73405: wrap-program shoul= d use the >> basename of $0 as arg0] does not describe why =E2=80=98cling=E2=80=99 wa= s segfaulting, >> but I suspect it=E2=80=99s due to similar bad assumptions about argv[0] = as the >> Emacs issue. >> >> I think wrappers should be as transparent as possible=E2=80=94however th= e user >> invokes a command should be preserved in argv[0], whether using a >> basename with PATH resolution or a relative or absolute filename. We >> shouldn=E2=80=99t coerce argv[0] to a basename when the wrapper wasn=E2= =80=99t called >> that way. 99% of the time argv[0] is irrelevant, but the common case I= =E2=80=99m >> considering is programs that log how they were called=E2=80=94it=E2=80= =99s disorienting >> for the wrapper to affect that. >> >> Maybe we can expose an argument to wrap-program to use the basename >> approach, but IMO we should be handling the root cause in cases where >> problems occur and pushing upstreams to handle arbitrary argv[0] values >> robustly. >> >> WDYT? Thanks! > > This member of the peanut gallery supports the revert. Exactly as you > say, the wrappers should be as transparent as possible. So this > mangling feels wrong. After giving it some more thoughts, I agree. I think I had originally worked under the assumption that $0 would always expand to the absolute file name of the wrapper because of the wapper itself, but that's not the case; $0 exactly matches the way the user or launcher called the application, so it makes sense to preserve that information. It'll have to be done on the next core-packages branch though, as it's a world rebuild change. --=20 Thanks, Maxim From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 06 15:58:56 2025 Received: (at 73416) by debbugs.gnu.org; 6 Aug 2025 19:58:56 +0000 Received: from localhost ([127.0.0.1]:60346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ujkHn-0000ie-OJ for submit@debbugs.gnu.org; Wed, 06 Aug 2025 15:58:56 -0400 Received: from wolfsden.cz ([37.205.8.62]:49718) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1ujkHj-0000iO-Tu for 73416@debbugs.gnu.org; Wed, 06 Aug 2025 15:58:53 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 538C326F3A2; Wed, 6 Aug 2025 19:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1754510330; bh=Fl/eTkqnm71/xgL2u9hA02Bl+e08dDNQca/wSulOfpc=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=dZ8zH8i0wMmV+XRP8tQnvIw+xCqt45Z7jrRW86AsvmhUQHrS44kjEHt2wVPRa3gOd nCscpzX57pmxFGAm5/cRBU4k6L+qq9rjdux334jP5tU8FdgRQ9Ne4Wcs0DOsAP/ZWC y/Vq9r1tbK6qp5QU1zkwbDdrkIiL0fBX6JpdmW7gZ9pGEDx1voOx0TfWjC8hvvBsME 8yx077yi7x6/+q2FyZFPp5O42e+iZTRXLvVBqad4OnayxJnyHx6e1CzgfYwm0bAaUw HQNT4jlFlbG8tWkJlZJcXPs9FuMRQuw70b4xcj89VBuldZ+hfAKJ0Tv2EYvXoJ5gU/ 3f6QWT2xzkFt3Amoa3UxWXxwNe6xA2R8Xs7P4zgMqXjThO55ITagwkP666TsVwgnMe gNKl4fPdjBEIKDdQZnhyVyx8Ptkol5PRe+icQpFdY10Nud8sGAtNFHFtMu40NN3sPK IsReAB2EYNgIUeA70cX5yQpD33puoOOHgmgXlDP8R+HYxu/YNeIdJtcCdYvYs17YSI 2xaul+p5xfM3xpECYK77kx9jf0pRabc6oFFmtjI1XfpwK+MT9VYY4DYf4aL5hxWZkP 3H0MY+6niaswFG76mO9QUc7RntzKtPfapToi7rqF9P+rweHEaSt6ufsJon2BB0TVvH Vh0Zuj7uy4Tfc9vCA3hHFZjo= X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id A134726F729; Wed, 6 Aug 2025 19:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1754510328; bh=Fl/eTkqnm71/xgL2u9hA02Bl+e08dDNQca/wSulOfpc=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=mPIqFsFnM8inl6q7SGfPpZLqYYYdAJ/CbdVrAUug8DxmILl8WpCqhpasKVPkKkuD+ wju9X95VQEaU91tYgeduLuOgF1yDvgFULBuG1yJk8B0AX5fIzMByd/VjnjvMiFkIqh Fn4NcZ24qhGNS0AMkEGcc1QJ1upx+7t/aKI6LKgcki2ZOzkes1W97sscyGJ7RlWZI9 M1ohG3BBVPgnD1LysLMvFvfbsemi0Zzf7nJ/3tCSd8BOSG7rusNZtusAcRptGlg0+Y J81N6YXbEDpGMp7V8jJzPb+yB3cHC1F0nbiFWlu8t9OtREdlscWl7N9AoXA02xIDjx 7xjweRwjMV5vaLVyER2dYS1nR7aG5PlM2xUBo5EKZHykZteOIXf2CPV/tWdZJf39Hy sXe80qmTkeX+9c3lYJ6yxFGwXr6BHiez6kmaaVoCvVIeCfLgkva9kiAIwj0z05pTCh uztyOb5X8pWhhm/PmYTcR7XwRua4Up8fNIs/FTlQBj2tt09UkZPzO2a69jIek57wfW 5rMHizNQNAyr4coJlRS7z2x7rNjDWc/djmQ7UfWc01FF28EyZWnF0BgCXFpmltxmdj AK4O7IAm4KIRKowAZ4xv/vh8cU4pV7HgAC0PwPFihuwfE5R4KpFvDXb8wlVsVJO6uV SLYFlFPyTO8qzPH/9biyjB1g= From: Tomas Volf <~@wolfsden.cz> To: Maxim Cournoyer Subject: Re: [bug#73416] [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'. In-Reply-To: <87qzy71yr9.fsf@guixotic.coop> (Maxim Cournoyer's message of "Wed, 23 Jul 2025 10:28:42 +0900") References: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> <87qzybo9l8.fsf@hpfr.net> <874iv6p14t.fsf@hpfr.net> <87bjpdzr8x.fsf@wolfsden.cz> <87qzy71yr9.fsf@guixotic.coop> Date: Wed, 06 Aug 2025 21:58:48 +0200 Message-ID: <8734a443yf.fsf@wolfsden.cz> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73416 Cc: 73416@debbugs.gnu.org, Andreas Enge , Liam Hupfer , Ludovic =?utf-8?Q?Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Maxim Cournoyer writes: > Hi, > > Tomas Volf <~@wolfsden.cz> writes: > >> Liam Hupfer writes: >> >>> On second thought, though, I think we should consider reverting the >>> change to =E2=80=98wrap-program=E2=80=99. [bug#73405: wrap-program shou= ld use the >>> basename of $0 as arg0] does not describe why =E2=80=98cling=E2=80=99 w= as segfaulting, >>> but I suspect it=E2=80=99s due to similar bad assumptions about argv[0]= as the >>> Emacs issue. >>> >>> I think wrappers should be as transparent as possible=E2=80=94however t= he user >>> invokes a command should be preserved in argv[0], whether using a >>> basename with PATH resolution or a relative or absolute filename. We >>> shouldn=E2=80=99t coerce argv[0] to a basename when the wrapper wasn=E2= =80=99t called >>> that way. 99% of the time argv[0] is irrelevant, but the common case I= =E2=80=99m >>> considering is programs that log how they were called=E2=80=94it=E2=80= =99s disorienting >>> for the wrapper to affect that. >>> >>> Maybe we can expose an argument to wrap-program to use the basename >>> approach, but IMO we should be handling the root cause in cases where >>> problems occur and pushing upstreams to handle arbitrary argv[0] values >>> robustly. >>> >>> WDYT? Thanks! >> >> This member of the peanut gallery supports the revert. Exactly as you >> say, the wrappers should be as transparent as possible. So this >> mangling feels wrong. > > After giving it some more thoughts, I agree. I think I had originally > worked under the assumption that $0 would always expand to the absolute > file name of the wrapper because of the wapper itself, but that's not > the case; $0 exactly matches the way the user or launcher called the > application, so it makes sense to preserve that information. > > It'll have to be done on the next core-packages branch though, as it's a > world rebuild change. There seems to be a `world-rebuild' branch now, which sounds like a good fit? Tomas --=20 There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 06 17:17:28 2025 Received: (at 73416) by debbugs.gnu.org; 6 Aug 2025 21:17:28 +0000 Received: from localhost ([127.0.0.1]:60465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ujlVo-0004XV-2Z for submit@debbugs.gnu.org; Wed, 06 Aug 2025 17:17:28 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:60194) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ujlVl-0004XG-FJ for 73416@debbugs.gnu.org; Wed, 06 Aug 2025 17:17:26 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A559F1F9; Wed, 6 Aug 2025 23:17:17 +0200 (CEST) Authentication-Results: hera.aquilenet.fr; none X-Virus-Scanned: Debian amavis at hera.aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavis, port 10024) with ESMTP id i08PVQ7ejlEV; Wed, 6 Aug 2025 23:17:17 +0200 (CEST) Received: from jurong (167.76.29.93.rev.sfr.net [93.29.76.167]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 9785C1E9; Wed, 6 Aug 2025 23:17:15 +0200 (CEST) Date: Wed, 6 Aug 2025 23:17:14 +0200 From: Andreas Enge To: Tomas Volf <~@wolfsden.cz> Subject: Re: [bug#73416] [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'. Message-ID: References: <361b71e6f846c6748ff0ec9ecf6c1379ac00f809.1726985178.git.maxim.cournoyer@gmail.com> <87qzybo9l8.fsf@hpfr.net> <874iv6p14t.fsf@hpfr.net> <87bjpdzr8x.fsf@wolfsden.cz> <87qzy71yr9.fsf@guixotic.coop> <8734a443yf.fsf@wolfsden.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8734a443yf.fsf@wolfsden.cz> X-Spamd-Result: default: False [-3.10 / 15.00]; NEURAL_HAM(-3.00)[-1.000]; BAYES_HAM(-3.00)[99.99%]; SUSPICIOUS_RECIPS(1.50)[]; SUBJECT_HAS_CURRENCY(1.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_FIVE(0.00)[5]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; FREEMAIL_CC(0.00)[gmail.com,hpfr.net,debbugs.gnu.org,gnu.org] X-Rspamd-Action: no action X-Rspamd-Queue-Id: A559F1F9 X-Rspamd-Server: hera X-Spamd-Bar: --- X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73416 Cc: 73416@debbugs.gnu.org, Ludovic =?iso-8859-15?Q?Court=E8s?= , Liam Hupfer , Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Am Wed, Aug 06, 2025 at 09:58:48PM +0200 schrieb Tomas Volf: > There seems to be a `world-rebuild' branch now, which sounds like a good > fit? yes, I had suggested the branch, I just need a patch to add there. Andreas From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 10 14:30:52 2025 Received: (at 73416) by debbugs.gnu.org; 10 Aug 2025 18:30:52 +0000 Received: from localhost ([127.0.0.1]:45913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ulAol-0006F2-Tr for submit@debbugs.gnu.org; Sun, 10 Aug 2025 14:30:52 -0400 Received: from wolfsden.cz ([37.205.8.62]:45586) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1ulAoi-0006Eq-FR for 73416@debbugs.gnu.org; Sun, 10 Aug 2025 14:30:49 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 560AC3261C1; Sun, 10 Aug 2025 18:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1754850646; bh=KX017Cvc27UNCcguZZZ4TkQu7CAgBqHfz4+EziTUYWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HK5gIuM2eeFj1UsvHBB6z/Sh5Tm7CbUJLx8uCu6ktwChUvWZIaEcrBTObL1RnZzMO gHleZRDWMYxL9KJ9+iqzMpQYeTFsHU5OARdwbykQ+nZm0ZEbkTs9dwRRU1xco2i+of AsYHL36w5geiGR6VV3ahR+/squduleEZSnNarQcMrIzgdhfFGHkGJF2jo6/sdVfsiS /CycxX8VOsSgEjW+Hw2GT2cNmOUbqSKjap2Rdj5u+3m1Vx9bmFE18m/R5zPcg6IAdj XUT7m1sQV1PjKyGNeIJHLYOUX+yFWOLQgPzrjOpruJyKxjyHcMG8MzoWBeNQcd+/Om 64oizCZj7nfsbpm28UhXQZ6YXqHQxpfDK6Ebl9W+0KoTjER7K2iLaxqEG1/nHua/5w 43II156/nu4OctJYjJWFryKrL8xa44izByHZcq37PhkoRhX3u5Sadn/9lW3EPM/uQF 8+AE0295q7us0k6KI7ej5LMch9th0+qFqtsANeIfq3nuYxC2Q1x2r7sN7J2bnCzSBe EmP4vH7BJAC6rm4g1etFxDcSU1C+D/ggQ6QxWZFG3gH5XKPZ+YHYdz+c62lQVVoVU8 /RjyDOvfdTLVP+b4dEcNtZrNhzjyRQSQ2xllpwnqGcqDRYho0OsUjAI8HOxxMQ55iW 5CktAwJq0JQV8yJMSbz6RAdc= X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on wolfsden X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id EB612325DCD; Sun, 10 Aug 2025 18:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1754850646; bh=KX017Cvc27UNCcguZZZ4TkQu7CAgBqHfz4+EziTUYWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HK5gIuM2eeFj1UsvHBB6z/Sh5Tm7CbUJLx8uCu6ktwChUvWZIaEcrBTObL1RnZzMO gHleZRDWMYxL9KJ9+iqzMpQYeTFsHU5OARdwbykQ+nZm0ZEbkTs9dwRRU1xco2i+of AsYHL36w5geiGR6VV3ahR+/squduleEZSnNarQcMrIzgdhfFGHkGJF2jo6/sdVfsiS /CycxX8VOsSgEjW+Hw2GT2cNmOUbqSKjap2Rdj5u+3m1Vx9bmFE18m/R5zPcg6IAdj XUT7m1sQV1PjKyGNeIJHLYOUX+yFWOLQgPzrjOpruJyKxjyHcMG8MzoWBeNQcd+/Om 64oizCZj7nfsbpm28UhXQZ6YXqHQxpfDK6Ebl9W+0KoTjER7K2iLaxqEG1/nHua/5w 43II156/nu4OctJYjJWFryKrL8xa44izByHZcq37PhkoRhX3u5Sadn/9lW3EPM/uQF 8+AE0295q7us0k6KI7ej5LMch9th0+qFqtsANeIfq3nuYxC2Q1x2r7sN7J2bnCzSBe EmP4vH7BJAC6rm4g1etFxDcSU1C+D/ggQ6QxWZFG3gH5XKPZ+YHYdz+c62lQVVoVU8 /RjyDOvfdTLVP+b4dEcNtZrNhzjyRQSQ2xllpwnqGcqDRYho0OsUjAI8HOxxMQ55iW 5CktAwJq0JQV8yJMSbz6RAdc= From: Tomas Volf <~@wolfsden.cz> To: 73416@debbugs.gnu.org Subject: [PATCH] Revert "utils: Set $0 to basename of command in `wrap-program'." Date: Sun, 10 Aug 2025 20:29:25 +0200 Message-ID: <277e280c274d75de7b06b8b31b65b383b486f46b.1754850565.git.~@wolfsden.cz> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: MIME-Version: 1.0 X-Debbugs-Cc: Andreas Enge , Janneke Nieuwenhuizen , Ludovic Courtès , Zheng Junjie Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73416 Cc: andreas@enge.fr, Tomas Volf <~@wolfsden.cz>, maxim.cournoyer@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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(-) 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)))) -- 2.50.1