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

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Sun, 22 Sep 2024 06:08:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Full log


View this message in rfc822 format

From: Liam Hupfer <liam <at> hpfr.net>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>, 73416 <at> debbugs.gnu.org
Cc: Andreas Enge <andreas <at> enge.fr>, Ludovic Courtès <ludo <at> gnu.org>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [bug#73416] [PATCH core-updates] build: Set $0 to basename of command in `wrap-program'.
Date: Mon, 21 Jul 2025 00:24:18 -0500
[Message part 1 (text/plain, inline)]
Liam Hupfer <liam <at> hpfr.net> writes:

> I am not really advocating for reverting this. I don’t think Emacs
> should assume ‘argv[0]’ is correlated to the executable file 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’t depend on
Emacs filename resolution via argv[0]​].

On second thought, though, I think we should consider reverting the
change to ‘wrap-program’. [bug#73405: wrap-program should use the
basename of $0 as arg0] does not describe why ‘cling’ was segfaulting,
but I suspect it’s due to similar bad assumptions about argv[0] as the
Emacs issue.

I think wrappers should be as transparent as possible—however 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’t coerce argv[0] to a basename when the wrapper wasn’t called
that way. 99% of the time argv[0] is irrelevant, but the common case I’m
considering is programs that log how they were called—it’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!

—Liam


[bug#79064: native-lisp directory resolution shouldn’t depend on
Emacs filename resolution via argv[0]​] <https://yhetil.org/emacs/87h5z6p3m3.fsf <at> hpfr.net/>

[bug#73405: wrap-program should use the
basename of $0 as arg0] <https://yhetil.org/guix/87a5g1o8pc.fsf <at> gmail.com/>

This bug report was last modified today.

Previous Next


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