Bug 211406

Summary: su -l clears LOGNAME environment variable
Product: Base System Reporter: d.y.kazarov
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Some People Keywords: patch
Priority: ---    
Version: 10.3-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch for su.c and su.1 none

Description d.y.kazarov 2016-07-27 12:32:15 UTC
Created attachment 173036 [details]
Patch for su.c and su.1

POSIX 1003.1 states:
"LOGNAME
    The system shall initialize this variable at the time of login to be the user's login name. See <pwd.h>. For a value of LOGNAME to be portable across implementations of POSIX.1-2008, the value should be composed of characters from the portable filename character set."
(http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html)

"su -l" Simulate a full login. But LOGNAME is unset after "su -l".

samba port depends on this variable during some operations (see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=175544) but samba's developer refuses to do anything about it (see https://bugzilla.samba.org/show_bug.cgi?id=9592).

IMHO "su -l" shall set this variable  since it's part of POSIX standard.