On 2025-03-08 08:46, Nicolas Boos via GNU coreutils Bug Reports wrote:
> It seems getlogin() is malfunctioning only with glibc.

It's the other way round: glibc is right (in the sense that it conforms 
to POSIX) and the other two are wrong.

> Adding a permanent fix to gnulib/getlogin.c code might be a better solution.

Any such fix should work around the musl bug. (Gnulib doesn't worry 
about uclibc.)

I expect such a patch would be welcome if someone had the time to write 
and test it. In the meantime I installed the attached to Gnulib, to 
document the incompatibility, which also occurs with getlogin_r.