git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t1304: fall back to $USER if $LOGNAME is not defined
@ 2011-10-14 17:44 René Scharfe
  2011-10-14 18:41 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: René Scharfe @ 2011-10-14 17:44 UTC (permalink / raw
  To: Git Mailing List; +Cc: Junio C Hamano, Brandon Casey, Matthieu Moy

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 <rene.scharfe@lsrfire.ath.cx>
---
The only other use of $LOGNAME is in git-cvsimport, which does the same.

 t/t1304-default-acl.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/t/t1304-default-acl.sh b/t/t1304-default-acl.sh
index b5d89a2..2b962cf 100755
--- a/t/t1304-default-acl.sh
+++ b/t/t1304-default-acl.sh
@@ -25,6 +25,11 @@ else
 	test_set_prereq SETFACL
 fi
 
+if test -z "$LOGNAME"
+then
+	LOGNAME=$USER
+fi
+
 check_perms_and_acl () {
 	test -r "$1" &&
 	getfacl "$1" > actual &&
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] t1304: fall back to $USER if $LOGNAME is not defined
  2011-10-14 17:44 [PATCH] t1304: fall back to $USER if $LOGNAME is not defined René Scharfe
@ 2011-10-14 18:41 ` Junio C Hamano
  2011-10-14 20:54   ` René Scharfe
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2011-10-14 18:41 UTC (permalink / raw
  To: René Scharfe; +Cc: Git Mailing List, Brandon Casey, Matthieu Moy

René Scharfe <rene.scharfe@lsrfire.ath.cx> 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 <rene.scharfe@lsrfire.ath.cx>
> ---
> 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 <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.

Will apply anyway. Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] t1304: fall back to $USER if $LOGNAME is not defined
  2011-10-14 18:41 ` Junio C Hamano
@ 2011-10-14 20:54   ` René Scharfe
  0 siblings, 0 replies; 3+ messages in thread
From: René Scharfe @ 2011-10-14 20:54 UTC (permalink / raw
  To: Junio C Hamano; +Cc: Git Mailing List, Brandon Casey, Matthieu Moy

Am 14.10.2011 20:41, schrieb Junio C Hamano:
> René Scharfe <rene.scharfe@lsrfire.ath.cx> 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 <rene.scharfe@lsrfire.ath.cx>
>> ---
>> 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 <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.
> 
> 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é

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-14 20:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-14 17:44 [PATCH] t1304: fall back to $USER if $LOGNAME is not defined René Scharfe
2011-10-14 18:41 ` Junio C Hamano
2011-10-14 20:54   ` René Scharfe

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).