On Fr, 28.01.22 10:55, Demi Marie Obenour (demiobenour(a)gmail.com) wrote:
As an aside, can Linux and/or glibc please disallow passing a NULL
argv[0]? I would honestly be okay with glibc just crashing the process
during startup if argv[0] is NULL or empty.
Yeah, it would be good if glibc start-up code would automatically
synthesize argv[0] in some way (maybe set it to the name PR_GET_NAME
returns or so) if argc == 0. And that this would then propagate into
program_invocation_name[] and program_invocation_short_name[] so that
all code can safely rely that once main() is invoked argc > 0, argv[0]
is non-NULL (and ideally even a non-empty string), and both
program_invocation{_short,}_name are set. There's just too much code
out there that relies on this, and I think it would be best if glibc
would just make it so that what people assume is guaranteed actually
becomes guaranteed.
Lennart
--
Lennart Poettering, Berlin