From: René Scharfe Date: Fri, 14 Oct 2011 20:54:28 GMT Subject: Re: [PATCH] t1304: fall back to $USER if $LOGNAME is not defined Message-ID: <4E98A184.2040908@lsrfire.ath.cx> In-Reply-To: <7vobxjza9t.fsf@alter.siamese.dyndns.org> Am 14.10.2011 20:41, schrieb Junio C Hamano: > René Scharfe writes: > >> For some reason $LOGNAME is not set anymore for me after an upgrade from >> Ubuntu 11.04 to 11.10. Use $USER in such a case. >> >> Signed-off-by: Rene Scharfe >> --- >> The only other use of $LOGNAME is in git-cvsimport, which does the same. > > While the change to assign $USER to $LOGNAME when the latter is not set is > not wrong per-se, I have to wonder (1) why this test should use LOGNAME > not USER in the first place, and (2) why you lost LOGNAME. > > LOGNAME > The system shall initialize this variable at the time of login to be the > user's login name. See . 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. > > Will apply anyway. Thanks. Common practise (on Linux at least) seems to be to set both $LOGNAME (from Sys-V) and $USER (from BSD) to the same value, so either could be used. The portable way is to check both. Both were set before the upgrade on my system, and $LOGNAME is _still_ set if I log onto the console or use sudo or su, but it's _not_ set in a plain Gnome Terminal with bash. I also wonder why that may be. René