From unknown Sat Jun 21 05:00:51 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73405: wrap-program should use the basename of $0 as arg0 Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 21 Sep 2024 05:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73405 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 73405@debbugs.gnu.org X-Debbugs-Original-To: bug-guix Received: via spool by submit@debbugs.gnu.org id=B.172689806530124 (code B ref -1); Sat, 21 Sep 2024 05:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Sep 2024 05:54:25 +0000 Received: from localhost ([127.0.0.1]:36910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srt4a-0007po-Tg for submit@debbugs.gnu.org; Sat, 21 Sep 2024 01:54:25 -0400 Received: from lists.gnu.org ([209.51.188.17]:51530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srt4Z-0007pe-1o for submit@debbugs.gnu.org; Sat, 21 Sep 2024 01:54:24 -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 1srt28-0006lX-VL for bug-guix@gnu.org; Sat, 21 Sep 2024 01:51:52 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srt27-0003Gi-8C for bug-guix@gnu.org; Sat, 21 Sep 2024 01:51:52 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2d889ba25f7so1955088a91.0 for ; Fri, 20 Sep 2024 22:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726897908; x=1727502708; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=hmEa65h05VGZa4jQTGceVE1KDe+tE0TBDWc3CKw5h0E=; b=fQjfE2CuE+EcRv4/RNZi+b+neWMpybbBnm0P/O+YOOHe8hV+Z6/xdOdsRR/QAsujMr j/4Zpko9lovRqkcHItoHJqIx4jIrAdxuB+zDr8cuuZbKjgfAeEVkQ6feh2uSOm07zT8P xzHx6KQwJnphbzU9yYc9RES3x6radjWvAWhe30rp74FGFUujrV3f4Kl/8qIvG90Wnzsr cYRyjY5Hp6OuO+pQu/L0rfW8rZT6WJKXs8BQ+Qm3/EHjgLJXi7xIVqpebFPpGSW6QLZA pZ5le3UDJN1b+SH4nkj0W+8Bzf8Wxv1wO4NgoPE14MpaaoMk9XIdLujs36dC6Z/DmPyw AU2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726897908; x=1727502708; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hmEa65h05VGZa4jQTGceVE1KDe+tE0TBDWc3CKw5h0E=; b=Aoo6JUkvDadRaHPX31SwGLPrHN2xmza92iy2re4aJuSocANVlAbAJmvULPmf8ulTrE i3rmNmMzIffJl0Zpi6DhyIaKF3PZZ4oDP32F609B9kmJCV42uVB9NxURAiMEwgn1di2a KORu/emq24KFMFwQCEZ/h9MwguRkRBl+PviSrNq7hocFRhbD8YhU5Zv8cgfs+8H9hBLc xt69ZoTk5XSI+9SPCkXoPQDjcwLpqt+mxOFBaHyJp2qr9nT9STaYCI3iijZgm6ydj49K YoxNtP2VGM0ZMpLHxhOASBJJvWCEJIqs+cyziQyT+IX1yhqvOut29yl5ZG8AeTdDIcHu e9oQ== X-Gm-Message-State: AOJu0YzZlxJ9UcL/M5PCl1COuIPM6d4IyyFxvSEGb6nkmyp1c7H4UfQG od/qVdLLMjs/rHfZcy/D0d7JADtmbpnPQAqNrg8e2TyOcwz9b9TcouwMQQ== X-Google-Smtp-Source: AGHT+IFNpmHzdX6CMgM81F936xdhBDnWjQwpRdtVHjJvPONk180wVHZfYqrJ7JMS/OM/a6hiz6edGw== X-Received: by 2002:a17:90a:2f22:b0:2d3:cf20:80bd with SMTP id 98e67ed59e1d1-2dd7f402850mr6174548a91.17.1726897907651; Fri, 20 Sep 2024 22:51:47 -0700 (PDT) Received: from hurd ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2dd7f93b64fsm3004303a91.46.2024.09.20.22.51.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Sep 2024 22:51:46 -0700 (PDT) From: Maxim Cournoyer Date: Sat, 21 Sep 2024 14:51:43 +0900 Message-ID: <87a5g1o8pc.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=maxim.cournoyer@gmail.com; helo=mail-pj1-x102d.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-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 (--) Hi, I believe wrap-program should be using --8<---------------cut here---------------start------------->8--- exec -a ${0##*/} ... --8<---------------cut here---------------end--------------->8--- instead of --8<---------------cut here---------------start------------->8--- exec -a "$0" ... --8<---------------cut here---------------end--------------->8--- as the later will use the full file name of the command (/gnu/store/.../bin/something) instead of just the command name, which is more conventional. I made this discovery while investigating a segfault that occured in a wrapped 'cling'; adjusting the wrapper script to read as: --8<---------------cut here---------------start------------->8--- #!/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash exec -a ${0##*/} "/gnu/store/0ccm05058yjd5qi8hcdr70ymhf9q6cc2-cling-1.1/bin/.cling-real" "$@" --8<---------------cut here---------------end--------------->8--- where the value of -a becomes 'cling' instead of its full file name resolved the issue. The original wrapper reads like: --8<---------------cut here---------------start------------->8--- #!/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash exec -a "$0" "/gnu/store/l8875yavr1nls7n3i3yx8ah0s1lasn43-cling-1.1/bin/.cling-real" "$@" --8<---------------cut here---------------end--------------->8--- It's probably rare that this "problem" would manifest itself so critically, but still, I think it'd be good to adjust our wrap-program procedure. I'll send a patch. -- Thanks, Maxim From unknown Sat Jun 21 05:00:51 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Maxim Cournoyer Subject: bug#73405: closed (Re: bug#73416: [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'.) Message-ID: References: <87tt7k4rtb.fsf@gnu.org> <87a5g1o8pc.fsf@gmail.com> X-Gnu-PR-Message: they-closed 73405 X-Gnu-PR-Package: guix Reply-To: 73405@debbugs.gnu.org Date: Sat, 22 Mar 2025 22:36:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1742682962-16621-1" This is a multi-part message in MIME format... ------------=_1742682962-16621-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #73405: wrap-program should use the basename of $0 as arg0 which was filed against the guix package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 73405@debbugs.gnu.org. --=20 73405: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D73405 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1742682962-16621-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 73405-done) by debbugs.gnu.org; 22 Mar 2025 22:35:41 +0000 Received: from localhost ([127.0.0.1]:46125 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tw7RM-0004He-J6 for submit@debbugs.gnu.org; Sat, 22 Mar 2025 18:35:41 -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: 73405-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. ------------=_1742682962-16621-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 21 Sep 2024 05:54:25 +0000 Received: from localhost ([127.0.0.1]:36910 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srt4a-0007po-Tg for submit@debbugs.gnu.org; Sat, 21 Sep 2024 01:54:25 -0400 Received: from lists.gnu.org ([209.51.188.17]:51530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1srt4Z-0007pe-1o for submit@debbugs.gnu.org; Sat, 21 Sep 2024 01:54:24 -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 1srt28-0006lX-VL for bug-guix@gnu.org; Sat, 21 Sep 2024 01:51:52 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1srt27-0003Gi-8C for bug-guix@gnu.org; Sat, 21 Sep 2024 01:51:52 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2d889ba25f7so1955088a91.0 for ; Fri, 20 Sep 2024 22:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726897908; x=1727502708; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=hmEa65h05VGZa4jQTGceVE1KDe+tE0TBDWc3CKw5h0E=; b=fQjfE2CuE+EcRv4/RNZi+b+neWMpybbBnm0P/O+YOOHe8hV+Z6/xdOdsRR/QAsujMr j/4Zpko9lovRqkcHItoHJqIx4jIrAdxuB+zDr8cuuZbKjgfAeEVkQ6feh2uSOm07zT8P xzHx6KQwJnphbzU9yYc9RES3x6radjWvAWhe30rp74FGFUujrV3f4Kl/8qIvG90Wnzsr cYRyjY5Hp6OuO+pQu/L0rfW8rZT6WJKXs8BQ+Qm3/EHjgLJXi7xIVqpebFPpGSW6QLZA pZ5le3UDJN1b+SH4nkj0W+8Bzf8Wxv1wO4NgoPE14MpaaoMk9XIdLujs36dC6Z/DmPyw AU2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726897908; x=1727502708; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hmEa65h05VGZa4jQTGceVE1KDe+tE0TBDWc3CKw5h0E=; b=Aoo6JUkvDadRaHPX31SwGLPrHN2xmza92iy2re4aJuSocANVlAbAJmvULPmf8ulTrE i3rmNmMzIffJl0Zpi6DhyIaKF3PZZ4oDP32F609B9kmJCV42uVB9NxURAiMEwgn1di2a KORu/emq24KFMFwQCEZ/h9MwguRkRBl+PviSrNq7hocFRhbD8YhU5Zv8cgfs+8H9hBLc xt69ZoTk5XSI+9SPCkXoPQDjcwLpqt+mxOFBaHyJp2qr9nT9STaYCI3iijZgm6ydj49K YoxNtP2VGM0ZMpLHxhOASBJJvWCEJIqs+cyziQyT+IX1yhqvOut29yl5ZG8AeTdDIcHu e9oQ== X-Gm-Message-State: AOJu0YzZlxJ9UcL/M5PCl1COuIPM6d4IyyFxvSEGb6nkmyp1c7H4UfQG od/qVdLLMjs/rHfZcy/D0d7JADtmbpnPQAqNrg8e2TyOcwz9b9TcouwMQQ== X-Google-Smtp-Source: AGHT+IFNpmHzdX6CMgM81F936xdhBDnWjQwpRdtVHjJvPONk180wVHZfYqrJ7JMS/OM/a6hiz6edGw== X-Received: by 2002:a17:90a:2f22:b0:2d3:cf20:80bd with SMTP id 98e67ed59e1d1-2dd7f402850mr6174548a91.17.1726897907651; Fri, 20 Sep 2024 22:51:47 -0700 (PDT) Received: from hurd ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2dd7f93b64fsm3004303a91.46.2024.09.20.22.51.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Sep 2024 22:51:46 -0700 (PDT) From: Maxim Cournoyer To: bug-guix Subject: wrap-program should use the basename of $0 as arg0 Date: Sat, 21 Sep 2024 14:51:43 +0900 Message-ID: <87a5g1o8pc.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=maxim.cournoyer@gmail.com; helo=mail-pj1-x102d.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 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 (--) Hi, I believe wrap-program should be using --8<---------------cut here---------------start------------->8--- exec -a ${0##*/} ... --8<---------------cut here---------------end--------------->8--- instead of --8<---------------cut here---------------start------------->8--- exec -a "$0" ... --8<---------------cut here---------------end--------------->8--- as the later will use the full file name of the command (/gnu/store/.../bin/something) instead of just the command name, which is more conventional. I made this discovery while investigating a segfault that occured in a wrapped 'cling'; adjusting the wrapper script to read as: --8<---------------cut here---------------start------------->8--- #!/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash exec -a ${0##*/} "/gnu/store/0ccm05058yjd5qi8hcdr70ymhf9q6cc2-cling-1.1/bin/.cling-real" "$@" --8<---------------cut here---------------end--------------->8--- where the value of -a becomes 'cling' instead of its full file name resolved the issue. The original wrapper reads like: --8<---------------cut here---------------start------------->8--- #!/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash exec -a "$0" "/gnu/store/l8875yavr1nls7n3i3yx8ah0s1lasn43-cling-1.1/bin/.cling-real" "$@" --8<---------------cut here---------------end--------------->8--- It's probably rare that this "problem" would manifest itself so critically, but still, I think it'd be good to adjust our wrap-program procedure. I'll send a patch. -- Thanks, Maxim ------------=_1742682962-16621-1--