X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0	tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
Message-ID: <131d29e048915ced6aaff45b7fc9d156.squirrel@mail.morrison.mine.nu>
In-Reply-To: <AANLkTikWtsAkY6ZasbF3ihfjtLVXBxkHDNN-Zj3AhQoL@mail.gmail.com>
References: <4C021FA8.4030403@users.sourceforge.net>    <AANLkTilUfdSyZF6bVEKHCqImBF62vIu8aV2SNq2cx6xI@mail.gmail.com>    <20100531081825.GF16885@calimero.vinschen.de>    <AANLkTikWtsAkY6ZasbF3ihfjtLVXBxkHDNN-Zj3AhQoL@mail.gmail.com>
Date: Mon, 31 May 2010 12:55:50 +0100
Subject: Re: base-files: LOGNAME
From: "John Morrison" <john@morrison.mine.nu>
To: cygwin@cygwin.com
User-Agent: SquirrelMail/1.4.20
MIME-Version: 1.0
Content-Type: text/plain;charset=UTF-8
Content-Transfer-Encoding: 8bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Mon, May 31, 2010 12:22 pm, Andy Koppe wrote:
> On 31 May 2010 09:18, Corinna Vinschen wrote:
>> On May 30 10:02, Andy Koppe wrote:
>>> On Sunday, May 30, 2010, Yaakov wrote:
>>> > POSIX.1[1] describes a LOGNAME environment variable which represents
>>> the user's login name.  Adding the following lines to /etc/profile
>>> should do the trick:
>>> >
>>> > LOGNAME="`logname`"
>>> > export LOGNAME
>>> >
>>> > Where logname(1) is a program supplied by coreutils whose presence is
>>> required by POSIX.1[2].
>>>
>>> That would mean a costly fork() during shell startup. Could this be
>>> set in the DLL instead, as happens with the SHELL variable?
>>
>> Huh?  The Cygwin DLL does not set $SHELL.
>
> You're right of course, it's actually bash that sets it. Seems I
> confused myself quite thoroughly when I looked into this a few weeks
> ago.
>
> Anyway, so we've got USERNAME, USER, and LOGNAME. Does anyone know
> what the differences between those are supposed to be? Apparently
> USERNAME is set automatically on NT systems, so could /etc/profile
> just copy that to USER and LOGNAME instead of invoking 'id' and
> 'logname'?

USERNAME == logname != USER

John     == John    != john

on my system.

/etc/passwd;

john:unused:1001:513:U-Win7\John,S-1-5-21-2757910492-2695755496-4075423505-1001:/home/John:/bin/bash

Does that explain the differences?

> Posix defines LOGNAME, but regarding USER it only says that it is
> "unwise to conflict with certain variables that are frequently
> exported by widely used command interpreters and applications".
> (http://opengroup.org/onlinepubs/007908799/xbd/envvar.html)



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

