GNU bug report logs - #73405
wrap-program should use the basename of $0 as arg0

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; Reported by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; dated Sat, 21 Sep 2024 05:55:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

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


Received: (at submit) by debbugs.gnu.org; 21 Sep 2024 05:54:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 21 01:54:25 2024
Received: from localhost ([127.0.0.1]:36910 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srt4a-0007po-Tg
	for submit <at> 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 <maxim.cournoyer@HIDDEN>) id 1srt4Z-0007pe-1o
 for submit <at> 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 <maxim.cournoyer@HIDDEN>)
 id 1srt28-0006lX-VL
 for bug-guix@HIDDEN; 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 <maxim.cournoyer@HIDDEN>)
 id 1srt27-0003Gi-8C
 for bug-guix@HIDDEN; Sat, 21 Sep 2024 01:51:52 -0400
Received: by mail-pj1-x102d.google.com with SMTP id
 98e67ed59e1d1-2d889ba25f7so1955088a91.0
 for <bug-guix@HIDDEN>; 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 <bug-guix@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 20 Sep 2024 22:51:46 -0700 (PDT)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: bug-guix <bug-guix@HIDDEN>
Subject: wrap-program should use the basename of $0 as arg0
Date: Sat, 21 Sep 2024 14:51:43 +0900
Message-ID: <87a5g1o8pc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::102d;
 envelope-from=maxim.cournoyer@HIDDEN; 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 <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 (--)

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




Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#73405; Package guix. 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.