Re: DISPLAY environment variable



> >| Behavior of my X is very strange. It sets =DISPLAY= variable to value
> >| ``unix:0.0''. I have no idea who made it (gdm, gnome or enlightenment)
> 
> >"unix:0" is legal (if old-fashioned) and means the same thing as ":0".  If 
> >you have something which is confused by this then it is broken.

> unix:0.0 causes esound to emit a warning.  It attempts to perform a lookup on
> unix.

[I'm going off of memory here, some of the details may be wrong.  Check
O'Reilly X-Windows User Guide volume 1 for an authoritative source]

	The DISPLAY variable is in the format 
"hostname:servernum.dispnum".  So if you export your DISPLAY variable to
be something like

linuxmachine.microsoft.com:0.0

	...and run an X/Gnome program, then (assuming linuxmachine is a
registered host name) some dude at Microsoft would get the application
showing up on his desktop.  (This very contrived example also assumes the
guy at Microsoft has disabled access control)

	If you set the hostname portion of the DISPLAY variable to "unix",
the computer will try to do a hostname lookup on the name "unix" using
gethostbyname().  It's sort of like using

http://unix/  

	...instead of...

http://localhost/

	...to access your local webserver.  If that fails, poop could
happen.

	Possible solutions:

1) Use "localhost:0.0" for the DISPLAY
2) Use ":0.0" (it will default to localhost, i.e. 127.0.0.1)
3) Put the line
127.0.0.1	unix
	...in your /etc/hosts file.
4) et.al.

	Another minor point is that the display number (the second "0" in
":0.0") is optional, i.e., localhost:0 or :0 should also work.  If I
remember correctly, the second 0 refers to the monitor number on a
multi-head display (does it?  I can't remember right now...) and it
defaults to 0.

> >"unix:0" is legal (if old-fashioned) and means the same thing as ":0".  If 

	"unix:0" is neither old-fashioned (it's necessary anytime you want
to run a program remotely on a host named "unix") nor is it the same as
":0".

	Anyhow, I hope this helps.  


Derek Simkowiak
dereks@kd-dev.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]