Environment passed to Applications-launched processes
Hi Jeremy, I wouldn't say it's worth holding up the release process, but I noticed something about the latest prereleases and environment variables -- X11.app doesn't seem to be inheriting the same environment as other Aqua apps (or it's at least not passing it to processes it starts from the Applications menu). I have a couple of shell scripts as entries in X11's Application menu, and they don't work any more (they launch programs that are in /usr/local/bin). I dumped the environment to a file from one script, and it's very bare, PATH only includes "/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin". From my /etc/paths and /etc/paths.d, it should also have "/usr/local/bin:/usr/local/sbin:$HOME/bin:/Developer/Tools:/opt/local/bin:/opt/local/sbin". I'm not sure how far back, but it did pass the full Aqua environment fairly recently. -- Brian
Oh, one other thing: it seems to depend on how X11.app is launched. If it's launched automatically from an X program starting up, everything works right. If it's launched by starting X11.app directly, then I get the bare environment. - Brian
Brian Bender wrote:
Oh, one other thing: it seems to depend on how X11.app is launched. If it's launched automatically from an X program starting up, everything works right. If it's launched by starting X11.app directly, then I get the bare environment.
Starting /A/U/X11.app "directly", i.e. from the Finder gives a very minimal environment to processes started from the Applications menu. They simply inherit Finder's poor environment. If you start X automatically via an X client, then /A/U/X11.app is run as a child process of /usr/X11/bin/X, which inherits its environment from startx, and the startx process runs inside a bash login shell. That is, it reads the user's bash login startup scripts (whether the user has bash as login shell or not). Conclusion: Don't start X11.app from the finder. And define a decent environment in ~/.bash_profile, even if you have tcsh as your login shell. Or don't use X11.app's Application menu (which for me is not configurable any more, anyway, but that's a different story). -- Martin
On Sat, Aug 30, 2008 at 6:21 AM, Martin Costabel costabel-at-wanadoo.fr |Xquartz-dev/personal| <...> wrote:
Starting /A/U/X11.app "directly", i.e. from the Finder gives a very minimal environment to processes started from the Applications menu. They simply inherit Finder's poor environment.
That was kind of my point, really -- I was wondering if X11.app is _explicitly_ setting a minimal path when it's started from the app bundle, overwriting what it inherited from the Finder, because it's not even including things in the Finder's path that are added from my /etc/paths and /etc/paths.d/* entries. - Brian
Brian Bender wrote:
On Sat, Aug 30, 2008 at 6:21 AM, Martin Costabel costabel-at-wanadoo.fr |Xquartz-dev/personal| <...> wrote:
Starting /A/U/X11.app "directly", i.e. from the Finder gives a very minimal environment to processes started from the Applications menu. They simply inherit Finder's poor environment.
That was kind of my point, really -- I was wondering if X11.app is _explicitly_ setting a minimal path when it's started from the app bundle, overwriting what it inherited from the Finder, because it's not even including things in the Finder's path that are added from my /etc/paths and /etc/paths.d/* entries.
I don't think the Finder cares about /etc/whatever. Upon login, it gets the environment it transmits to other apps from your ~/.MacOSX/environment.plist file if it exists. -- Martin
On Tue, Sep 2, 2008 at 2:34 PM, Martin Costabel costabel-at-wanadoo.fr |Xquartz-dev/personal| <...> wrote:
I don't think the Finder cares about /etc/whatever. Upon login, it gets the environment it transmits to other apps from your ~/.MacOSX/environment.plist file if it exists.
Doh, you're right. For whatever reason, I had thought that paths.d (path_helper in general) had replaced the environment.plist functionality, but it looks like it's only for shells. Sorry for the noise, everyone... - Brian
+ "Brian Bender" <zt4q4o402@sneakemail.com>:
-- X11.app doesn't seem to be inheriting the same environment as other Aqua apps (or it's at least not passing it to processes it starts from the Applications menu). I have a couple of shell scripts as entries in X11's Application menu, and they don't work any more (they launch programs that are in /usr/local/bin). I dumped the environment to a file from one script, and it's very bare, PATH only includes "/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin". From my /etc/paths and /etc/paths.d, it should also have [...]
I think the problem has nothing to do with what environment X11 gets, but that your xterms aren't running a login shell. To make sure they do, they must be started using xterm -ls or you need to have XTerm.vt100.loginShell: true in your .Xresources file (or otherwise available as a resource to xterm). For the former optiion, if you run defaults write org.x.X11 app_to_run 'xterm -ls' you ensure the initial xterm runs a login shell. You may need to customize the X11 Applications menu also. - Harald
participants (3)
-
Brian Bender
-
Harald Hanche-Olsen
-
Martin Costabel