xserver: Branch 'master' - 9 commits

Keith Packard keithp at kemper.freedesktop.org
Thu Apr 3 10:47:04 PDT 2014


 configure.ac                                 |   13 +++++++---
 hw/xfree86/.gitignore                        |    1 
 hw/xfree86/Makefile.am                       |    3 +-
 hw/xfree86/common/xf86Globals.c              |    2 -
 hw/xfree86/common/xf86Helper.c               |   31 +++++++++++++++++++++++-
 hw/xfree86/man/Xorg.man                      |    6 +++-
 hw/xfree86/man/xorg.conf.man                 |    6 +++-
 hw/xfree86/os-support/linux/systemd-logind.c |   34 +++++++++++++++++++++++++--
 include/xorg-config.h.in                     |   11 +++++++-
 include/xwin-config.h.in                     |    3 --
 xkb/xkbAccessX.c                             |    2 -
 11 files changed, 95 insertions(+), 17 deletions(-)

New commits:
commit 84f977467b514af88019ab2791bf7a74530b54df
Merge: 9d20d18 9892471
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Apr 3 10:44:28 2014 -0700

    Merge remote-tracking branch 'whot/for-keith'

commit 98924719d524bf87cdf301063cd744d1271c33ff
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Apr 2 13:55:10 2014 +1000

    Revert "xkb: ProcesssPointerEvent must work on the VCP if it gets the VCP"
    
    This was the wrong fix to the problem, and it triggered a change in XKB
    behavior: previously a button event would unlock a latched modifier, now it
    doesn't anymore.
    https://bugs.freedesktop.org/show_bug.cgi?id=73155
    
    Note that the new behavior is is strictly spec compliant but we've had the
    other behavior for a long time so we shouldn't break it.
    
    The bug this patch originally fixed was a null-pointer dereference when
    releasing button events on server shutdown. This was addressed by the commit
    below, so the need for this patch has gone away anyway.
    
    commit 3e4be4033aed78b2bb3a18d51f0963989efd1af3
    Author: Peter Hutterer <peter.hutterer at who-t.net>
    Date:   Fri Jan 25 11:47:32 2013 +1000
    
        dix: when shutting down slave devices, shut down xtest devices last
    
    This reverts commit 2decff6393a44b56d80d53570718f95354fde454.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index cb4bca0..5f3de0d 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -711,7 +711,7 @@ ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
     xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
     DeviceEvent *event = &ev->device_event;
 
-    dev = (IsMaster(mouse) || IsFloating(mouse)) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
+    dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
 
     if (dev && dev->key) {
         xkbi = dev->key->xkbInfo;
commit 9d65c515d83d2158b5949e249777ca2a02b31901
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Tue Apr 1 11:24:17 2014 +0200

    xf86LogInit: log to XDG_DATA_HOME when not running as root
    
    When no logfile was specified (xf86LogFileFrom == X_DEFAULT) and we're not
    running as root log to $XDG_DATA_HOME/xorg/Xorg.#.log as Xorg won't be able to
    log to the default /var/log/... when it is not running as root.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index bc643e8..cdd3258 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2043,6 +2043,8 @@ if test "x$XORG" = xyes; then
 	AC_SUBST(XF86CONFIGDIR)
 	CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
 	LOGPREFIX="Xorg."
+	XDG_DATA_HOME=".local/share"
+	XDG_DATA_HOME_LOGDIR="xorg"
 	AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
 	AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
 	AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
@@ -2057,6 +2059,8 @@ if test "x$XORG" = xyes; then
 	AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
 	AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
 	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default logfile prefix])
+	AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME, XDG_DATA_HOME, [Default XDG_DATA dir under HOME])
+	AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME_LOGDIR, XDG_DATA_HOME_LOGDIR, [Default log dir under XDG_DATA_HOME])
 	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
 	if test "x$VGAHW" = xyes; then
 		AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 12a8771..e2b32a0 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1217,16 +1217,45 @@ xf86ErrorF(const char *format, ...)
     va_end(ap);
 }
 
+/* Note temporarily modifies the passed in buffer! */
+static void xf86_mkdir_p(char *path)
+{
+    char *sep = path;
+
+    while ((sep = strchr(sep + 1, '/'))) {
+        *sep = 0;
+        (void)mkdir(path, 0777);
+        *sep = '/';
+    }
+    (void)mkdir(path, 0777);
+}
+
 void
 xf86LogInit(void)
 {
-    char *lf = NULL;
+    char *env, *lf = NULL;
+    char buf[PATH_MAX];
 
 #define LOGSUFFIX ".log"
 #define LOGOLDSUFFIX ".old"
 
     /* Get the log file name */
     if (xf86LogFileFrom == X_DEFAULT) {
+        /* When not running as root, we won't be able to write to /var/log */
+        if (geteuid() != 0) {
+            if ((env = getenv("XDG_DATA_HOME")))
+                snprintf(buf, sizeof(buf), "%s/%s", env,
+                         DEFAULT_XDG_DATA_HOME_LOGDIR);
+            else if ((env = getenv("HOME")))
+                snprintf(buf, sizeof(buf), "%s/%s/%s", env,
+                         DEFAULT_XDG_DATA_HOME, DEFAULT_XDG_DATA_HOME_LOGDIR);
+
+            if (env) {
+                xf86_mkdir_p(buf);
+                strlcat(buf, "/" DEFAULT_LOGPREFIX, sizeof(buf));
+                xf86LogFile = buf;
+            }
+        }
         /* Append the display number and ".log" */
         if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
             FatalError("Cannot allocate space for the log file name\n");
diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man
index 0cd5a10..3ff6aef 100644
--- a/hw/xfree86/man/Xorg.man
+++ b/hw/xfree86/man/Xorg.man
@@ -301,9 +301,11 @@ Use the file called
 .I filename
 as the
 .B Xorg
-server log file.  The default log file is
+server log file.  The default log file when running as root is
 .BI __logdir__/Xorg. n .log
-on most platforms, where
+and for non root it is
+.BI $XDG_DATA_HOME/xorg/Xorg. n .log
+where
 .I n
 is the display number of the
 .B Xorg
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 85f9f2e..6d2652e 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -442,11 +442,15 @@ __modulepath__
 .TP 7
 .BI "LogFile \*q" path \*q
 sets the name of the Xorg server log file.
-The default log file name is
+The default log file name when running as root is
 .PP
 .RS 11
 .RI __logdir__/Xorg. <n> .log
 .RE
+and for non root it is
+.RS 11
+.RI $XDG_DATA_HOME/xorg/Xorg. <n> .log
+.RE
 .PP
 .RS 7
 where
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 4e2a45b..629ae40 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -51,6 +51,12 @@
 /* Default logfile prefix */
 #undef DEFAULT_LOGPREFIX
 
+/* Default XDG_DATA dir under HOME */
+#undef DEFAULT_XDG_DATA_HOME
+
+/* Default log dir under XDG_DATA_HOME */
+#undef DEFAULT_XDG_DATA_HOME_LOGDIR
+
 /* Building DRI-capable DDX. */
 #undef XF86DRI
 
commit f37a46913489397d8628ffe578c8d4ed50b6ca72
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Mar 26 12:24:49 2014 +0100

    configure: Change DEFAULT_LOGPREFIX to really be a filename prefix
    
    Rather then a full path prefix, this is a preparation patch for adding
    support for logging to another location when not running as root.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index f051414..bc643e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2042,7 +2042,7 @@ if test "x$XORG" = xyes; then
 	XF86CONFIGDIR="xorg.conf.d"
 	AC_SUBST(XF86CONFIGDIR)
 	CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
-	LOGPREFIX="$logdir/Xorg."
+	LOGPREFIX="Xorg."
 	AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
 	AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
 	AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
@@ -2055,7 +2055,8 @@ if test "x$XORG" = xyes; then
 	AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
 	AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
 	AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
-	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
+	AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
+	AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default logfile prefix])
 	AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
 	if test "x$VGAHW" = xyes; then
 		AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c
index 7df7a80..984c39b 100644
--- a/hw/xfree86/common/xf86Globals.c
+++ b/hw/xfree86/common/xf86Globals.c
@@ -143,7 +143,7 @@ const char *xf86ConfigFile = NULL;
 const char *xf86ConfigDir = NULL;
 const char *xf86ModulePath = DEFAULT_MODULE_PATH;
 MessageType xf86ModPathFrom = X_DEFAULT;
-const char *xf86LogFile = DEFAULT_LOGPREFIX;
+const char *xf86LogFile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX;
 MessageType xf86LogFileFrom = X_DEFAULT;
 Bool xf86LogFileWasOpened = FALSE;
 serverLayoutRec xf86ConfigLayout = { NULL, };
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 77a1aae..4e2a45b 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -45,7 +45,10 @@
 /* Path to installed libraries. */
 #undef DEFAULT_LIBRARY_PATH
 
-/* Path to server log file. */
+/* Default log location */
+#undef DEFAULT_LOGDIR
+
+/* Default logfile prefix */
 #undef DEFAULT_LOGPREFIX
 
 /* Building DRI-capable DDX. */
diff --git a/include/xwin-config.h.in b/include/xwin-config.h.in
index 176c019..a5e6b17 100644
--- a/include/xwin-config.h.in
+++ b/include/xwin-config.h.in
@@ -26,8 +26,5 @@
 /* Vendor web address for support */
 #undef __VENDORDWEBSUPPORT__
 
-/* Default log location */
-#undef DEFAULT_LOGDIR
-
 /* Whether we should re-locate the root to where the executable lives */
 #undef RELOCATE_PROJECTROOT
commit dc48bd653c7e1013e2d69e3f59ae3cbc0c893473
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Mon Mar 24 16:32:01 2014 +0100

    systemd-logind: Monitor systemd-logind going away
    
    When we're using server managed-fds through systemd-logind, systemd-logind
    *must* keep running while we are using it, as it does things like drmSetMaster
    and drmDropMaster for us on vt-switch.
    
    On a systemd-logind restart, we cannot simply re-connect since we will then
    get a different fd for the /dev/dri/card# node, and we've tied a lot of
    state to the old fd. I've discussed this with the systemd people, and in the
    future there may be a restart mechanism were systemd-logind passed fds from
    the old logind to the new logind. But for now there answer is simply:
    "Don't restart systemd-logind", and there never really is a good reason to
    restart it.
    
    So to ensure unpleasentness if people do decide to restart systemd-logind
    anyways (or when it crashes), monitor logind going away and make this a fatal
    error. This avoids getting a hard-hung machine on the next vt-switch and will
    hopefully quickly educate users to not restart systemd-logind while they have
    an X session using it active.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index 62858b0..ed670a8 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -310,10 +310,31 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
     dbus_int32_t major, minor;
     char *pause_str;
 
-    if (strcmp(dbus_message_get_path(message), info->session) != 0)
+    dbus_error_init(&error);
+
+    if (dbus_message_is_signal(message,
+                               "org.freedesktop.DBus", "NameOwnerChanged")) {
+        char *name, *old_owner, *new_owner;
+
+        dbus_message_get_args(message, &error,
+                              DBUS_TYPE_STRING, &name,
+                              DBUS_TYPE_STRING, &old_owner,
+                              DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID);
+        if (dbus_error_is_set(&error)) {
+            LogMessage(X_ERROR, "systemd-logind: NameOwnerChanged: %s\n",
+                       error.message);
+            dbus_error_free(&error);
+            return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+        }
+
+        if (name && strcmp(name, "org.freedesktop.login1") == 0)
+            FatalError("systemd-logind disappeared (stopped/restarted?)\n");
+
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+    }
 
-    dbus_error_init(&error);
+    if (strcmp(dbus_message_get_path(message), info->session) != 0)
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
     if (dbus_message_is_signal(message, "org.freedesktop.login1.Session",
                                "PauseDevice")) {
@@ -472,6 +493,15 @@ connect_hook(DBusConnection *connection, void *data)
         goto cleanup;
     }
 
+    dbus_bus_add_match(connection,
+        "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus'",
+        &error);
+    if (dbus_error_is_set(&error)) {
+        LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n",
+                   error.message);
+        goto cleanup;
+    }
+
     /*
      * HdG: This is not useful with systemd <= 208 since the signal only
      * contains invalidated property names there, rather than property, val
commit c0d3a13e7ee42be26d6d1923c9f3ae0355497869
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Mon Mar 24 16:31:59 2014 +0100

    Buildsys: Create SUID_WRAPPER_DIR before using it
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 418a35a..8f13905 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -105,6 +105,7 @@ if INSTALL_SETUID
 	chmod u+s $(DESTDIR)$(bindir)/Xorg
 endif
 if SUID_WRAPPER
+	$(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR)
 	mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.bin
 	${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg
 	-chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap
commit 6289f71494453d34614b7ff1238840681c2472af
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Tue Mar 25 14:00:13 2014 -0400

    suid: adding Xorg.sh.in to EXTRA_DIST is redundant
    
    All files specified in AC_CONFIG_FILES get distributed automatically.
    
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index a315bbc..418a35a 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -89,7 +89,7 @@ endif
 
 BUILT_SOURCES = xorg.conf.example
 DISTCLEANFILES = xorg.conf.example
-EXTRA_DIST = xorgconf.cpp Xorg.sh.in
+EXTRA_DIST = xorgconf.cpp
 
 # Without logdir, X will post an error on the terminal and will not start
 install-data-local:
commit b82ef51509bf24e8eafeb615a3e2f4fcd559554e
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Tue Mar 25 13:49:02 2014 -0400

    suid: add generated Xorg.sh to hw/xfree86/.gitignore
    
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/.gitignore b/hw/xfree86/.gitignore
index 997a94e..fb6830b 100644
--- a/hw/xfree86/.gitignore
+++ b/hw/xfree86/.gitignore
@@ -1,4 +1,5 @@
 Xorg
+Xorg.sh
 xorg.conf.example
 sdksyms.c
 sdksyms.dep
commit ca8f26f63694c27fa488a3b58ea6f00b7dd50f81
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Tue Mar 25 13:48:52 2014 -0400

    suid: replace deprecated AC_HELP_STRING with AS_HELP_STRING
    
    Fixes automake warning.
    
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index a75ba8f..f051414 100644
--- a/configure.ac
+++ b/configure.ac
@@ -624,8 +624,8 @@ AC_ARG_ENABLE(clientids,      AS_HELP_STRING([--disable-clientids], [Build Xorg
 AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
 AC_ARG_ENABLE(linux_acpi, AS_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes])
 AC_ARG_ENABLE(linux_apm, AS_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes])
-AC_ARG_ENABLE(systemd-logind, AC_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
-AC_ARG_ENABLE(suid-wrapper, AC_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no])
+AC_ARG_ENABLE(systemd-logind, AS_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
+AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no])
 
 dnl DDXes.
 AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])


More information about the xorg-commit mailing list