[Xquartz-dev] 2.1.2 release candidate

Jeremy Huddleston jeremyhu at berkeley.edu
Wed Jan 9 14:20:12 PST 2008


On Jan 8, 2008, at 23:55, Martin Costabel wrote:
> For people who don't have bash as their login shell, this is a  
> regression. With /usr/bin/X11 now on the PATH, X11 will start up OK,  
> but it will not have the rest of their environment. If they use Fink  
> or macports, they will once again have to bend backwards in order to  
> get a decent environment for the applications started from the  
> Applications menu.

No, that's not entirely true.  The applications launched from the  
Applications menu are started via /usr/bin/login -f ...., so your tcsh  
environment will be handed off to that application.  Unfortunately  
XQuartz itself wont have the right environment, but that is fixable by  
setting up PATH right in your {/etc/,~/.}profile

> I don't know what launchd has for an environment, but couldn't you  
> run the login inside startx? Something like

It has a minimalist environment... where PATH=/usr/bin:/bin:/usr/sbin:/ 
sbin (not sure on the ordering)

> #!/bin/sh
> /usr/bin/login -f $USER
> /bin/sh
>
> right at the beginning? This would continue inside sh, but with the  
> user's login environment.

No, that just won't work.  '/usr/bin/login -f $USER' will just give  
you a login shell waiting for you to exit.  When you exit it, you  
create a /bin/sh subshell, then when you exit that, you will continue  
with the rest of startx.

I tried this in the launchd.plist:

<key>ProgramArguments</key>
	<array>
		<string>/usr/bin/login</string>
		<string>-fp</string>
		<string>$USER</string>
		<string>/usr/X11/bin/startx</string>
	</array>
<key>EnableGlobbing</key>
	<true/>

but from the console log, I see a 'Password:' prompt which indicates  
that the globbing isn't taking care of $USER (documentation indicated  
that it wouldn't, but I was hopeful).

In the launchd.plist man page, this is interesting:

EnvironmentVariables <dictionary of strings>
      This optional key is used to specify additional environmental  
variables
      to be setup before running the job.

EnvironmentVariables seems a bit vague... I'm not sure how they are  
set up exactly...

SO... this is my current thought of a way to take care of it:

/bin/sh -c '/usr/bin/login -fp $USER /usr/X11/bin/startx'

<key>ProgramArguments</key>
	<array>
		<string>/bin/sh</string>
		<string>-c</string>
		<string>/usr/bin/login -fp $USER /usr/X11/bin/startx</string>
	</array>

I'm going to give that a try, and if it works for me, I'll put up a  
new rc for you guys to try...

--Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3040 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/xquartz-dev/attachments/20080109/44ad75f8/smime.bin


More information about the Xquartz-dev mailing list