Subject: bug#18365: nohup logname failes with error "logname: no login name"

From: Pádraig Brady <[email-masked]>
Date: Mon, 01 Sep 2014 16:04:22 +0100

tag 18365 notabug
close 18365
stop

On 08/30/2014 05:37 PM, Allen.Shepherd wrote:
> Hi we cannot retrieve the login name with the below version while running with nohup.
> Is there any workaround available?
> Thanks,
> 
> 
> host.com(oracle:NONE)/: logname --version
> logname (GNU coreutils) 5.97
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software.  You may redistribute copies of it under the terms of
> the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
> There is NO WARRANTY, to the extent permitted by law.
> Written by FIXME: unknown.

POSIX states that logname should be a simple wrapper around getlogin():
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/logname.html

getlogin() may fail on some systems if stdin is redirected from the controlling tty

thanks,
Pádraig.