From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22571 invoked by alias); 2 Apr 2014 00:44:20 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32516 Received: (qmail 9344 invoked from network); 2 Apr 2014 00:44:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201312; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=b4TK5+EhHVHJURSjW0P3ifLJPkL3eAmNZIN7qlJY8Ro=; b=g11O3JgZRtclJrrvv3pWsLHmHpHb4Cs2Bd29Q7T1nwTf8BPRzXxcVTaNhJszjBAxKwj3lIAjUNnMBEf37UPgCb1gfUikj1q83Ju3wQo7ssYYUtIklSdFzlR0LFmg+Yz9/t9bat3inUlzvqv4Y9Th8BArh65caqfzWZt6ouG0nbMTtIgoEUqF83okUmypz8nqV5ce6AWPyQr0Ej3+; Date: Tue, 1 Apr 2014 20:27:46 -0400 From: Phil Pennock To: Erik Johnson Cc: zsh-workers@zsh.org Subject: Re: LOGNAME not properly set on FreeBSD Message-ID: <20140402002746.GA25309@redoubt.spodhuis.org> Mail-Followup-To: Erik Johnson , zsh-workers@zsh.org References: <20140401212239.GE20508@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140401212239.GE20508@gmail.com> OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/0x3903637F.asc On 2014-04-01 at 16:22 -0500, Erik Johnson wrote: > When using "su - username" to change users, zsh is not properly setting > the LOGNAME environment variable on FreeBSD. Example below. ----------------------------8< cut here >8------------------------------ LOGNAME If the corresponding variable is not set in the environment of the shell, it is initialized to the login name corresponding to the current login session. This parameter is exported by default but this can be disabled using the typeset builtin. ----------------------------8< cut here >8------------------------------ This is the _login_ name, as a convenience, it's not the _current_ name, and is not defined as such. The whole point is that if you su to another account, LOGNAME can persist as the original. It's not _trustworthy_, but might be used to let you have a .zshrc.staff.$LOGNAME file which might be auto-sourced, or whatever else you want. If you do: % typeset +x LOGNAME then LOGNAME won't be exported. > erik@virtubsd:~% su - root > Password: > virtubsd# echo $LOGNAME > erik Yup, that's exactly what it's supposed to do. You might want USERNAME instead of LOGNAME ? -Phil