Bug 211406 - su -l clears LOGNAME environment variable
Summary: su -l clears LOGNAME environment variable
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.3-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
Keywords: patch
Depends on:
Reported: 2016-07-27 12:32 UTC by d.y.kazarov
Modified: 2016-08-02 21:06 UTC (History)
0 users

See Also:

Patch for su.c and su.1 (1.53 KB, text/plain)
2016-07-27 12:32 UTC, d.y.kazarov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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:
    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."

"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.