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

From: Tomas Volf <[email-masked]>
Date: Mon, 21 Jul 2025 14:02:22 +0200

Liam Hupfer <[email-masked]> writes:

> 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!

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

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.