ia64/xen-unstable

changeset 9553:2769a38f0e3e

Currently, xm & xend allow an XAUTHORITY to be specified in the config
file. If that is not specified, then xm will pass the XAUTHORITY
environment variable back to xend instead. This is not sufficient,
since it is possible that XAUTHORITY is not set at all. This doesn't
cause a problem for most X apps, because xlib will use the fall-back of
$HOME/.Xauthority. But the viewer is started from xend, which almost
certainly doesn't have a reasonable HOME variable.

We fix this by always passing some value for
XAUTHORITY. In order of preference, that value is:
1. Use the value from the config file, if specified.
2. Use the value from the XAUTHORITY env variable, if set.
3. Use $HOME/.Xauthority, if HOME is set.
4. Look up the user's home directory via getpwuid, and append
"/.Xauthority"

Signed-off-by: Charles Coffing <ccoffing@novell.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Mar 31 13:51:19 2006 +0100 (2006-03-31)
parents 3838105ab03b
children dadadf9aeee7
files tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xm/create.py	Fri Mar 31 12:03:42 2006 +0100
     1.2 +++ b/tools/python/xen/xm/create.py	Fri Mar 31 13:51:19 2006 +0100
     1.3 @@ -864,7 +864,14 @@ def parseCommandLine(argv):
     1.4          gopts.vals.display = os.getenv("DISPLAY")
     1.5  
     1.6      if not gopts.vals.xauthority:
     1.7 -        gopts.vals.xauthority = os.getenv("XAUTHORITY")
     1.8 +        xauth = os.getenv("XAUTHORITY")
     1.9 +        if not xauth:
    1.10 +            home = os.getenv("HOME")
    1.11 +            if not home:
    1.12 +                import posix, pwd
    1.13 +                home = pwd.getpwuid(posix.getuid())[5]
    1.14 +            xauth = home + "/.Xauthority"
    1.15 +        gopts.vals.xauthority = xauth
    1.16  
    1.17      # Process remaining args as config variables.
    1.18      for arg in args: