xserver: Branch 'master' - 7 commits

Keith Packard keithp at kemper.freedesktop.org
Fri Apr 18 10:38:28 PDT 2014


 configure.ac                       |    2 
 hw/xfree86/.gitignore              |    1 
 hw/xfree86/man/Makefile.am         |    2 
 hw/xfree86/man/Xorg.wrap.man       |    4 -
 hw/xfree86/man/Xwrapper.config.man |    2 
 hw/xfree86/xorg-wrapper.c          |   75 ++++++++++++++++++++++++++++---------
 6 files changed, 65 insertions(+), 21 deletions(-)

New commits:
commit 461ed561b9f75cee43c0dfd39228716f977956e7
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Fri Apr 18 11:30:16 2014 +0200

    Xorg.wrap manpages: use __appmansuffix__ instead of hardcoding 1
    
    Cc: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Gaetan Nadon <memsize at videotron.ca>

diff --git a/hw/xfree86/man/Xorg.wrap.man b/hw/xfree86/man/Xorg.wrap.man
index f2153e3..58937c7 100644
--- a/hw/xfree86/man/Xorg.wrap.man
+++ b/hw/xfree86/man/Xorg.wrap.man
@@ -1,4 +1,4 @@
-.\" Xwrapper.wrap.1
+.\" Xwrapper.wrap.__appmansuffix__
 .\"
 .\" Copyright 2014 Red Hat, Inc.
 .\"
@@ -26,7 +26,7 @@
 .\"
 .\" shorthand for double quote that works everywhere.
 .ds q \N'34'
-.TH Xorg.wrap 1 __xorgversion__
+.TH Xorg.wrap __appmansuffix__ __xorgversion__
 .SH NAME
 Xorg.wrap \- Xorg X server binary wrapper
 .SH DESCRIPTION
diff --git a/hw/xfree86/man/Xwrapper.config.man b/hw/xfree86/man/Xwrapper.config.man
index 800947c..5c777c9 100644
--- a/hw/xfree86/man/Xwrapper.config.man
+++ b/hw/xfree86/man/Xwrapper.config.man
@@ -1 +1 @@
-.so man1/Xorg.wrap.1
+.so man__appmansuffix__/Xorg.wrap.__appmansuffix__
commit 584961c86427b400a5ba65b0f145d00748d2da1e
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Fri Apr 18 11:26:00 2014 +0200

    man/Makefile.am: Fix Xorg.wrap.man Xwrapper.config.man missing from make dist
    
    Fix suggested by: Gaetan Nadon <memsize at videotron.ca>
    
    Cc: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Gaetan Nadon <memsize at videotron.ca>

diff --git a/hw/xfree86/man/Makefile.am b/hw/xfree86/man/Makefile.am
index f41d26c..5da404c 100644
--- a/hw/xfree86/man/Makefile.am
+++ b/hw/xfree86/man/Makefile.am
@@ -5,4 +5,6 @@ fileman_PRE = xorg.conf.man xorg.conf.d.man
 if SUID_WRAPPER
 appman_PRE += Xorg.wrap.man
 fileman_PRE += Xwrapper.config.man
+else
+EXTRA_DIST += Xorg.wrap.man Xwrapper.config.man
 endif
commit ec01d51a9973a9cf5f32f14f00058f1fdc9ed25e
Author: Guillem Jover <guillem at hadrons.org>
Date:   Mon Apr 14 18:13:25 2014 +0200

    Xorg.wrap: Make the console check portable
    
    Handle the unported case by issuing a build-time and run-time warning.
    
    And add support for FreeBSD kernel based systems, by using the
    VT_GETINDEX ioctl to check if the file descriptor is on a virtual
    console.
    
    Signed-off-by: Guillem Jover <guillem at hadrons.org>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index 12ea2c3..4ea4733 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -35,6 +35,9 @@
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include <sys/consio.h>
+#endif
 #include <unistd.h>
 #include <drm.h>
 #include <xf86drm.h> /* For DRM_DEV_NAME */
@@ -150,10 +153,37 @@ static void parse_config(int *allowed, int *needs_root_rights)
     fclose(f);
 }
 
+static int on_console(int fd)
+{
+#if defined(__linux__)
+    struct stat st;
+    int r;
+
+    r = fstat(fd, &st);
+    if (r == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4)
+      return 1;
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+    int idx;
+
+    if (ioctl(fd, VT_GETINDEX, &idx) != -1)
+        return 1;
+#else
+#warning This program needs porting to your kernel.
+    static int seen;
+
+    if (!seen) {
+        fprintf(stderr, "%s: Unable to determine if running on a console\n",
+            progname);
+        seen = 1;
+    }
+#endif
+
+    return 0;
+}
+
 int main(int argc, char *argv[])
 {
     struct drm_mode_card_res res;
-    struct stat st;
     char buf[PATH_MAX];
     int i, r, fd;
     int kms_cards = 0;
@@ -176,8 +206,7 @@ int main(int argc, char *argv[])
         case CONSOLE_ONLY:
             /* Some of stdin / stdout / stderr maybe redirected to a file */
             for (i = STDIN_FILENO; i <= STDERR_FILENO; i++) {
-                r = fstat(i, &st);
-                if (r == 0 && S_ISCHR(st.st_mode) && major(st.st_rdev) == 4)
+                if (on_console(i))
                     break;
             }
             if (i > STDERR_FILENO) {
commit 3a469917b585914ba2421e305f3b6a837b232e93
Author: Guillem Jover <guillem at hadrons.org>
Date:   Mon Apr 14 18:13:24 2014 +0200

    Xorg.wrap: Clarify error messages
    
    Not printing the program name produces very confusing messages that
    might be difficult to attribute while trying to diagnose problems,
    let's be explicit about who we are.
    
    Also add a missing "/" between SUID_WRAPPER_DIR and "Xorg.bin".
    
    Signed-off-by: Guillem Jover <guillem at hadrons.org>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index 80889e8..12ea2c3 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -25,6 +25,7 @@
 
 #include "dix-config.h"
 
+#include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
 #include <stdint.h>
@@ -40,6 +41,8 @@
 
 #define CONFIG_FILE SYSCONFDIR "/X11/Xwrapper.config"
 
+static const char *progname;
+
 enum { ROOT_ONLY, CONSOLE_ONLY, ANYBODY };
 
 /* KISS non locale / LANG parsing isspace version */
@@ -88,18 +91,21 @@ static void parse_config(int *allowed, int *needs_root_rights)
         /* Split in a key + value pair */
         equals = strchr(stripped, '=');
         if (!equals) {
-            fprintf(stderr, "Syntax error at %s line %d\n", CONFIG_FILE, line);
+            fprintf(stderr, "%s: Syntax error at %s line %d\n", progname,
+                CONFIG_FILE, line);
             exit(1);
         }
         *equals = 0;
         key   = strip(stripped);   /* To remove trailing whitespace from key */
         value = strip(equals + 1); /* To remove leading whitespace from val */
         if (!key[0]) {
-            fprintf(stderr, "Missing key at %s line %d\n", CONFIG_FILE, line);
+            fprintf(stderr, "%s: Missing key at %s line %d\n", progname,
+                CONFIG_FILE, line);
             exit(1);
         }
         if (!value[0]) {
-            fprintf(stderr, "Missing value at %s line %d\n", CONFIG_FILE, line);
+            fprintf(stderr, "%s: Missing value at %s line %d\n", progname,
+                CONFIG_FILE, line);
             exit(1);
         }
 
@@ -113,8 +119,8 @@ static void parse_config(int *allowed, int *needs_root_rights)
                 *allowed = ANYBODY;
             else {
                 fprintf(stderr,
-                    "Invalid value '%s' for 'allowed_users' at %s line %d\n",
-                    value, CONFIG_FILE, line);
+                    "%s: Invalid value '%s' for 'allowed_users' at %s line %d\n",
+                    progname, value, CONFIG_FILE, line);
                 exit(1);
             }
         }
@@ -127,8 +133,8 @@ static void parse_config(int *allowed, int *needs_root_rights)
                 *needs_root_rights = -1;
             else {
                 fprintf(stderr,
-                    "Invalid value '%s' for 'needs_root_rights' at %s line %d\n",
-                    value, CONFIG_FILE, line);
+                    "%s: Invalid value '%s' for 'needs_root_rights' at %s line %d\n",
+                    progname, value, CONFIG_FILE, line);
                 exit(1);
             }
         }
@@ -136,8 +142,8 @@ static void parse_config(int *allowed, int *needs_root_rights)
             /* Backward compatibility with older Debian Xwrapper, ignore */
         }
         else {
-            fprintf(stderr, "Invalid key '%s' at %s line %d\n", key,
-                    CONFIG_FILE, line);
+            fprintf(stderr, "%s: Invalid key '%s' at %s line %d\n", key,
+                progname, CONFIG_FILE, line);
             exit(1);
         }
     }
@@ -155,6 +161,8 @@ int main(int argc, char *argv[])
     int allowed = CONSOLE_ONLY;
     int needs_root_rights = -1;
 
+    progname = argv[0];
+
     parse_config(&allowed, &needs_root_rights);
 
     /* For non root users check if they are allowed to run the X server */
@@ -207,11 +215,13 @@ int main(int argc, char *argv[])
         uid_t realuid = getuid();
 
         if (setresgid(-1, realgid, realgid) != 0) {
-            perror("Could not drop setgid privileges");
+            fprintf(stderr, "%s: Could not drop setgid privileges: %s\n",
+                progname, strerror(errno));
             exit(1);
         }
         if (setresuid(-1, realuid, realuid) != 0) {
-            perror("Could not drop setuid privileges");
+            fprintf(stderr, "%s: Could not drop setuid privileges: %s\n",
+                progname, strerror(errno));
             exit(1);
         }
     }
@@ -220,12 +230,14 @@ int main(int argc, char *argv[])
 
     /* Check if the server is executable by our real uid */
     if (access(buf, X_OK) != 0) {
-        perror("Missing execute permissions for " SUID_WRAPPER_DIR "Xorg.bin");
+        fprintf(stderr, "%s: Missing execute permissions for %s/Xorg.bin: %s\n",
+            progname, SUID_WRAPPER_DIR, strerror(errno));
         exit(1);
     }
 
     argv[0] = buf;
     (void) execv(argv[0], argv);
-    perror("Failed to execute " SUID_WRAPPER_DIR "/Xorg.bin");
+    fprintf(stderr, "%s: Failed to execute %s/Xorg.bin: %s\n",
+        progname, SUID_WRAPPER_DIR, strerror(errno));
     exit(1);
 }
commit 50b6e1b0d786d95ee8eab030b0d1fd7420e2fbeb
Author: Guillem Jover <guillem at hadrons.org>
Date:   Mon Apr 14 18:13:23 2014 +0200

    Xorg.wrap: Use <drm.h> instead of hardcoding libdrm include path
    
    The libdrm.pc file gives us the correct include path, do not try to
    hardcode it on the source, as it might vary on the installed system,
    for example on Debian-based systems it's under /user/include/libdrm/.
    
    Signed-off-by: Guillem Jover <guillem at hadrons.org>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index 90c8c11..80889e8 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -35,7 +35,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <drm/drm.h>
+#include <drm.h>
 #include <xf86drm.h> /* For DRM_DEV_NAME */
 
 #define CONFIG_FILE SYSCONFDIR "/X11/Xwrapper.config"
commit 7bffceb9f939c0bf5529b00500cbb14ae01bb61a
Author: Guillem Jover <guillem at hadrons.org>
Date:   Mon Apr 14 18:13:22 2014 +0200

    Xorg: Add Xorg.wrap to hw/xfree86/.gitignore
    
    Signed-off-by: Guillem Jover <guillem at hadrons.org>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/hw/xfree86/.gitignore b/hw/xfree86/.gitignore
index fb6830b..c84c37f 100644
--- a/hw/xfree86/.gitignore
+++ b/hw/xfree86/.gitignore
@@ -1,4 +1,5 @@
 Xorg
+Xorg.wrap
 Xorg.sh
 xorg.conf.example
 sdksyms.c
commit 208157a76c6f340e0161e18ac77149d7110af2f5
Author: Julien Cristau <jcristau at debian.org>
Date:   Sun Apr 13 19:14:34 2014 +0200

    configure: fix help text for dmx
    
    As of 93fa64e17d7bd600ebf18ecab85f5b2d17fe30ce it's disabled by default,
    so stop saying it's automatically enabled in configure --help.
    
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>

diff --git a/configure.ac b/configure.ac
index 695a481..bfe1fc9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -629,7 +629,7 @@ AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-
 
 dnl DDXes.
 AC_ARG_ENABLE(xorg,    	      AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
-AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=no])
+AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no])
 AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
 AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
 AC_ARG_ENABLE(xquartz,        AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])


More information about the xorg-commit mailing list