Re: DISPLAY setting
Re: DISPLAY setting
- Subject: Re: DISPLAY setting
- From: Ben Byer <email@hidden>
- Date: Wed, 31 Oct 2007 18:28:49 -0700
On Oct 31, 2007, at 4:01 PM, Rich Cook wrote:
On Oct 31, 2007, at 3:52 PM, Greg Parker wrote:
On Oct 31, 2007, at 3:06 PM, Bobby Jones wrote:
The scenario I was thinking about is ssh from Tiger to Tiger once
you remove DISPLAY to accomodate Leopard. I had DISPLAY exported
in /etc/bashrc for all my Tiger installs. . . but Leopard
obviously doesn't play well with that.
So now I remove that to accommodate Leopard's X. . . but now when
I ssh Tiger to Tiger. . .obviously there is no DISPLAY being
passed. So I guess now I have to manually set DISPLAY every time I
ssh from Tiger to Tiger if I've removed DISPLAY to accommodate
Leopard's new X11?
The best way to handle this is to set DISPLAY if not already set,
in some appropriate shell startup file. The file to use and syntax
depend on which shell you're using; presumably adding an
appropriate `if` statement where you're already handling it in
Tiger will work.
The results:
Tiger: DISPLAY is not set, script sets it
Leopard: launchd set DISPLAY, script leaves it alone
SSH -Y out: ssh sees DISPLAY set at one end, ssh starts X
forwarding and sets DISPLAY at the other end
SSH -Y in: ssh set DISPLAY, script leaves it alone
Why do you need to set DISPLAY at all? I did not know ssh looked at
your DISPLAY, I thought it always tunneled port 6000.
Just to be (slightly) pedantic -- when you run X11.app on Tiger, any
shell it spawns (read: xterm) will have DISPLAY set to ":0". That's
not quite the same as "localhost:0".
localhost:0 -> connect to machine localhost on port 6000
:0 -> connect to the unix domain socket /tmp/.X11-unix/:0
/tmp/launchd-xxxxxx/:0 -> connect to the unix domain socket /tmp/
launchd-xxxxxx/:0
open-x11 on Tiger is a silly wrapper that looks to see if X11 is
already running, and if so, it runs a command with the environment
variable DISPLAY set to :0. The easiest way to make X11 apps work
"automagically" on Tiger is to start X11.app upon login using the
Dock, and then you can just set DISPLAY=:0 in one of your login
scripts or the environment plist.
That's kind of a hack -- this launchd mechanism will automatically
work on any system with the standard configuration -- and hey, X11 is
installed by default on Leopard, too! Support for this launchd
customization will work out of the box for anything that links against
libX11.dylib, and adding support to other programs is fairly trivial
-- for example, this is the patch to OpenSSH:
http://www.opensource.apple.com/darwinsource/10.5/OpenSSH-87/patches/DVG-5142987_launchd_DISPLAY_for_X11.patch
It's an unfortunate coincidence that the same customizations that you,
the X11 Power User, would have made on Tiger to get everything work
automatically end up being the same things that cause Leopard breakage
-- starting X11.app from the dock will get you two icons, and setting
DISPLAY in your environment will throw away the location of the
launchd socket that X clients need to know how to use.
It would have been extra-clever of us to have made something that
would have checked to see if you had made either of those
customizations (X11 in dock or set to auto-launch, or set DISPLAY
variable in dot-rc file or Environment.plist), and then display a
nice, informative message that asked you not to do that (much like
the .xinitrc warning). I guess it never occurred to us, because we
were so happy to no longer need those customizations. Also, it's
only a transition concern -- you'll hit a stumbling block when you
upgrade to Leopard. Persistent things like the click-to-focus issue,
fullscreen support and stability have taken priority.
--
Ben Byer
CoreOS / BSD Technology Group, XDarwin maintainer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden