From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3920 invoked by alias); 2 Apr 2014 00:50:24 -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: 32517 Received: (qmail 13939 invoked from network); 2 Apr 2014 00:50:10 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=Y1Q8iimgNfiBiWEjQyNvcc/vxEAasOuEEYaHnJvWpRI=; b=DpwXPJszx4nmrMHpg4VsJG2y9H125o0anaYtFZwt7J4umSbF11aRT1gknsYUUGRNQy t6Eqn9/5gWWfvzuTqeTcGbjGpHhct5Iy7eeeXYNolBoeDG0FhNsSO0Ges3r7DGGlDmfL scDnRgZknTubFmg/eQOlGYJTyefOKppJewwhylJYTOn59zUkQuP5aBNE4BvswuxRO/++ LlBgS1o12QVtGSd2vRl/+6/JETOIjZuRVNI/qNWGkHb2b4674+0664FmWdBLWXytPkXQ aNbbiavM7agG60+XANnC9oxy83WG0/9A3PUL0hfXyZ+A4qf9RKHDSmZnLgmY68mSc/OA KawQ== X-Received: by 10.50.109.130 with SMTP id hs2mr5742561igb.29.1396399806705; Tue, 01 Apr 2014 17:50:06 -0700 (PDT) Date: Tue, 1 Apr 2014 19:50:02 -0500 From: Erik Johnson To: zsh-workers@zsh.org Subject: Re: LOGNAME not properly set on FreeBSD Message-ID: <20140402005002.GG20508@gmail.com> References: <20140401212239.GE20508@gmail.com> <20140402002746.GA25309@redoubt.spodhuis.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="f5QefDQHtn8hx44O" Content-Disposition: inline In-Reply-To: <20140402002746.GA25309@redoubt.spodhuis.org> User-Agent: Mutt/1.5.23 (2014-03-12) --f5QefDQHtn8hx44O Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 01, 2014 at 08:27:46PM -0400, Phil Pennock wrote: >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. > The whole point of "su -" (and "su -l", which are equivalent), is to make the session a login session. http://www.unix.com/man-page/FreeBSD/1/SU/ So, LOGNAME should be set appropriately in those cases. I can understand not setting LOGNAME when su is invoked without "-" or "-l", because that doesn't create a login session. But not setting it for login shells is incorrect behavior. >> erik@virtubsd:~% su - root >> Password: >> virtubsd# echo $LOGNAME >> erik > >Yup, that's exactly what it's supposed to do. > No, it's not, as I noted above. >You might want USERNAME instead of LOGNAME ? > >-Phil Nope. The current behavior breaks python's getpass.getuser() (https://docs.python.org/2/library/getpass.html#getpass.getuser), which relies on a properly-set LOGNAME. --=20 -Erik "For me, it is far better to grasp the universe as it really is than to persist in delusion, however satisfying and reassuring." --Carl Sagan --f5QefDQHtn8hx44O Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iEYEARECAAYFAlM7XroACgkQXlWDxDeAjz8KrgCfcM66BFQhlaN61pvnvDSglXNL Ql4AnR37eJJL/ZJpJfgc0ob1hLp0Einz =5OzM -----END PGP SIGNATURE----- --f5QefDQHtn8hx44O--