This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-changelog] Currently, xm & xend allow an XAUTHORITY to be specified

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Currently, xm & xend allow an XAUTHORITY to be specified in the config
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 31 Mar 2006 14:10:06 +0000
Delivery-date: Fri, 31 Mar 2006 14:12:02 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 2769a38f0e3e7ab544293833276a5d8cd0875483
# Parent  3838105ab03b9c8c7f024cc44159d8232b1285c1
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

Signed-off-by: Charles Coffing <ccoffing@xxxxxxxxxx>

diff -r 3838105ab03b -r 2769a38f0e3e tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Fri Mar 31 11:03:42 2006
+++ b/tools/python/xen/xm/create.py     Fri Mar 31 12:51:19 2006
@@ -864,7 +864,14 @@
         gopts.vals.display = os.getenv("DISPLAY")
     if not gopts.vals.xauthority:
-        gopts.vals.xauthority = os.getenv("XAUTHORITY")
+        xauth = os.getenv("XAUTHORITY")
+        if not xauth:
+            home = os.getenv("HOME")
+            if not home:
+                import posix, pwd
+                home = pwd.getpwuid(posix.getuid())[5]
+            xauth = home + "/.Xauthority"
+        gopts.vals.xauthority = xauth
     # Process remaining args as config variables.
     for arg in args:

Xen-changelog mailing list

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Currently, xm & xend allow an XAUTHORITY to be specified in the config, Xen patchbot -unstable <=