For linux why when providing stdin (input redirection) to logname it is not able to determine the user?
@> echo `logname`
<username>
@> echo `logname` < /dev/null
logname: no login name
@> echo `logname` < /dev/tty
logname: no login name
Moverover this does not seem to affect whoami.
@> echo `whoami`
<username>
@> echo `whoami` < /dev/null
<username>
Edit: Adding OS versions (tested it on multiple different Linux machines).
@> uname -a
Linux <machine1> 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
@> uname -a
Linux <machine2> 2.6.18-238.el5 #1 SMP Sun Dec 19 14:22:44 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
@> uname -a
Linux <machine3> 3.0.13-0.27-default #1 SMP Wed Feb 15 13:33:49 UTC 2012 (d73692b) x86_64 x86_64 x86_64 GNU/Linux