Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: LOGNAME not properly set on FreeBSD



On Wed, Apr 02, 2014 at 09:58:54PM +0100, Peter Stephenson wrote:
On Wed, 2 Apr 2014 14:06:21 -0500
Erik Johnson <palehose@xxxxxxxxx> wrote:
Python os.getlogin() does indeed show "erik" instead of "root". So this
may just be a difference between glibc and BSD libc. Either way, it
"just works" in bash, sh, csh, tcsh, and ksh, as can be seen below, so
I believe there is an argument for making it work properly in FreeBSD as
well, or at the very least adding some wording to the zshparam manpage
which makes this difference in behavior clear.

Hmm...  to me, having LOGNAME *not* report the same as getlogin() is
"just not working".  Presumably there's some reason why getlogin() does
what it does and it doesn't seem to me to be the shell's job to second
guess system calls.  POSIX seems to agree with me --- to be fair, this
isn't for the variable, it's for the command "logname", but it would be
confusing if they were different.

 The logname utility shall write the user's login name to standard
 output. The login name shall be the string that would be returned by
 the getlogin() function defined in the System Interfaces volume of
 POSIX.1-2008. Under the conditions where the getlogin() function would
 fail, the logname utility shall write a diagnostic message to standard
 error and exit with a non-zero exit status.

However, there may be some documented prior art for LOGNAME that I'm
missing --- the history of shell development isn't necessarily particularly
rational.

It certainly makes sense to document it in any case.


Yeah, and for what it's worth it seems that not all of the shells are
exporting LOGNAME. But the ones that do are apparently doing so
differently than zsh does it. So, documentation is probably the best
route to go here. Thanks!


--

-Erik

"For me, it is far better to grasp the universe as it really is than to
persist in delusion, however satisfying and reassuring."  --Carl Sagan

Attachment: pgp2xd1oHIzNZ.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author