From owner-freebsd-hackers@FreeBSD.ORG Fri Sep 27 22:15:17 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 61C3ABAC; Fri, 27 Sep 2013 22:15:17 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (unknown [IPv6:2001:610:1108:5012::107]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 282E22E35; Fri, 27 Sep 2013 22:15:17 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id C9A0F1203C2; Sat, 28 Sep 2013 00:14:59 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id A1702CB4E; Sat, 28 Sep 2013 00:14:59 +0200 (CEST) Date: Sat, 28 Sep 2013 00:14:59 +0200 From: Jilles Tjoelker To: sbruno@freebsd.org Subject: Re: Trying to use /bin/sh Message-ID: <20130927221459.GA27990@stack.nl> References: <1380309632.84323.3.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1380309632.84323.3.camel@localhost> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "freebsd-hackers@freebsd.org" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2013 22:15:17 -0000 On Fri, Sep 27, 2013 at 12:20:32PM -0700, Sean Bruno wrote: > I was attempting to simply set my EDITOR env variable for use on my > system today and discovered that I do *not* understand how computers > work. > After realizing that I simply do not understand what's going on, I broke > down and put an "echo test" into /etc/profile and ~/.profile. > I can't see why, but logging in via xdm/xfce4 isn't doing any of the > normal login things and nothing in my .profile is ever executed by any > shell, ever. > None of these get executed unless its a login shell. xfce4 doesn't seem > to pick these up when starting up, so I have no idea what to do. > For now, I've put the needed things into a .bashrc and switched my > loging shell to bash, which is not really what I wanted to do. sh's model of startup files (only login shells use startup files with fixed names, other interactive shells only use $ENV) assumes that every session will load /etc/profile and ~/.profile at some point. This includes graphical sessions. The ENV file typically contains only shell options, aliases, function definitions and unexported variables but no environment variables. Some graphical environments actually source shell startup files like ~/.profile when logging in. I remember this from CDE for example. It is important to have some rule where this should happen to avoid doing it twice or never in "strange" configurations. As a workaround, I made ~/.xsession a script interpreted by my login shell and source some startup files. A problem here is that different login shells have incompatible startup files. A different direction is to accept that the environment variables in the X session will be incorrect and make all xterms start login shells (e.g. xterm -ls). You may also be able to use setenv in ~/.login_conf. -- Jilles Tjoelker