Hi Bruno,
Bruno Haible via Gnulib discussion list <[email protected]> writes:
> Consider these two implementations of getlogin() on Linux:
> - the glibc one (used on systems with glibc),
> - the gnulib one (used on systems with musl libc).
>
> [...]
>
> If the conclusion is that failure is better, we should remove the fallback 2)
> from Gnulib.
> If the conclusion is that returning "nobody" is better, we should override
> getlogin() on glibc systems and keep the fallback 2).
I'm not sure if you were suggesting removing the replacement on musl, so
I figured it was worth mentioning that I think it we should keep the
replacement there.
That is because the POSIX description of 'logname' says [1]:
APPLICATION USAGE
The logname utility explicitly ignores the LOGNAME environment
variable because environment changes could produce erroneous
results.
But as mentioned in Gnulib's documentation musl has a getlogin
implementation that uses the LOGNAME environment variable.
Collin
[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/logname.html