[132934] trunk/dports/x11/xauth

jeremyhu at macports.org jeremyhu at macports.org
Sat Feb 14 22:25:29 PST 2015


Revision: 132934
          https://trac.macports.org/changeset/132934
Author:   jeremyhu at macports.org
Date:     2015-02-14 22:25:29 -0800 (Sat, 14 Feb 2015)
Log Message:
-----------
xauth: Fix xauth timeout on Yosemite

Modified Paths:
--------------
    trunk/dports/x11/xauth/Portfile

Added Paths:
-----------
    trunk/dports/x11/xauth/files/
    trunk/dports/x11/xauth/files/0001-Fix-for-xauth-failing-on-ENOSPC-disk-full.patch
    trunk/dports/x11/xauth/files/0002-Update-DISPLAY-parsing-to-work-with-new-launchd-path.patch
    trunk/dports/x11/xauth/files/0003-Fix-HAVE_STRLCPY-case.patch
    trunk/dports/x11/xauth/files/0004-include-POSIX-standard-limits.h-for-PATH_MAX-instead.patch

Modified: trunk/dports/x11/xauth/Portfile
===================================================================
--- trunk/dports/x11/xauth/Portfile	2015-02-14 21:57:02 UTC (rev 132933)
+++ trunk/dports/x11/xauth/Portfile	2015-02-15 06:25:29 UTC (rev 132934)
@@ -4,6 +4,7 @@
 
 name                xauth
 version             1.0.9
+revision            1
 categories          x11
 license             X11
 platforms           darwin
@@ -21,6 +22,13 @@
 use_bzip2	    yes
 use_parallel_build  yes
 
+patch.pre_args      -p1
+patchfiles \
+    0001-Fix-for-xauth-failing-on-ENOSPC-disk-full.patch \
+    0002-Update-DISPLAY-parsing-to-work-with-new-launchd-path.patch \
+    0003-Fix-HAVE_STRLCPY-case.patch \
+    0004-include-POSIX-standard-limits.h-for-PATH_MAX-instead.patch
+
 depends_build \
 	port:pkgconfig
 

Added: trunk/dports/x11/xauth/files/0001-Fix-for-xauth-failing-on-ENOSPC-disk-full.patch
===================================================================
--- trunk/dports/x11/xauth/files/0001-Fix-for-xauth-failing-on-ENOSPC-disk-full.patch	                        (rev 0)
+++ trunk/dports/x11/xauth/files/0001-Fix-for-xauth-failing-on-ENOSPC-disk-full.patch	2015-02-15 06:25:29 UTC (rev 132934)
@@ -0,0 +1,36 @@
+From 047f92a85796fca563d9345d6c4798b64be77cff Mon Sep 17 00:00:00 2001
+From: "Dr. Tilmann Bubeck" <tilmann at bubecks.de>
+Date: Tue, 24 Jun 2014 00:22:54 +0200
+Subject: [PATCH 1/4] Fix for xauth failing on ENOSPC (= disk full)
+
+If xauth must store its XAUTHORITY file on a file system which is
+full, it will be unable to write the changes. This condition was
+not detected and therefore often the whole XAUTHORITY file was
+cleared. Here is the fix.
+
+Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=21260
+
+Signed-off-by: Dr. Tilmann Bubeck <tilmann at bubecks.de>
+---
+ process.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/process.c b/process.c
+index b44858a..5b12c92 100644
+--- a/process.c
++++ b/process.c
+@@ -844,7 +844,10 @@ write_auth_file(char *tmp_nam)
+ 	}
+     }
+ 
+-    (void) fclose (fp);
++    if (fclose(fp)) {
++	return -1;
++    }
++
+     return 0;
+ }
+ 
+-- 
+2.3.0
+

Added: trunk/dports/x11/xauth/files/0002-Update-DISPLAY-parsing-to-work-with-new-launchd-path.patch
===================================================================
--- trunk/dports/x11/xauth/files/0002-Update-DISPLAY-parsing-to-work-with-new-launchd-path.patch	                        (rev 0)
+++ trunk/dports/x11/xauth/files/0002-Update-DISPLAY-parsing-to-work-with-new-launchd-path.patch	2015-02-15 06:25:29 UTC (rev 132934)
@@ -0,0 +1,151 @@
+From f990dd936b5fd1a40290bb88cde517a0ac38f823 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
+Date: Wed, 31 Dec 2014 02:42:17 -0800
+Subject: [PATCH 2/4] Update DISPLAY parsing to work with new launchd paths in
+ Yosemite
+
+Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
+---
+ gethost.c  | 63 ++++++++++++++++++++++++++++++++++++++++++++------------------
+ parsedpy.c | 31 +++++++++++++++++++++++++++++--
+ 2 files changed, 74 insertions(+), 20 deletions(-)
+
+diff --git a/gethost.c b/gethost.c
+index 0a5aff5..c75ae02 100644
+--- a/gethost.c
++++ b/gethost.c
+@@ -57,6 +57,8 @@ in this Software without prior written authorization from The Open Group.
+ #include <errno.h>
+ #include "xauth.h"
+ 
++#include <sys/stat.h>
++#include <sys/syslimits.h>
+ 
+ #ifndef WIN32
+ #include <arpa/inet.h>
+@@ -189,30 +191,55 @@ struct addrlist *get_address_info (
+ 		src = buf;
+ 		len = strlen (buf);
+ 	    }
+-	} else if(prefix == 0 && (strncmp (fulldpyname, "/tmp/launch", 11) == 0)) {
+-        /* Use the bundle id (part preceding : in the basename) as our src id */
+-        char *c;
++	} else {
++	    char path[PATH_MAX];
++	    struct stat sbuf;
++	    int is_path_to_socket = 0;
++
++#ifdef HAVE_STRLCPY
++	    strlcpy(path, fulldpyname, sizeof(path));
++#else
++	    strncpy(path, fulldpyname, sizeof(path));
++	    buf[sizeof(path) - 1] = '\0';
++#endif
++	    if (0 == stat(path, &sbuf)) {
++		is_path_to_socket = 1;
++	    } else {
++		char *dot = strrchr(path, '.');
++		if (dot) {
++		    *dot = '\0';
++		    /* screen = atoi(dot + 1); */
++		    if (0 == stat(path, &sbuf)) {
++		        is_path_to_socket = 1;
++		    }
++		}
++	    }
++
++	    if (is_path_to_socket) {
++		/* Use the bundle id (part preceding : in the basename) as our src id */
++		char *c;
+ #ifdef HAVE_STRLCPY
+-        strlcpy(buf, strrchr(fulldpyname, '/') + 1, sizeof(buf));
++		strlcpy(buf, strrchr(fulldpyname, '/') + 1, sizeof(buf));
+ #else
+-        strncpy(buf, strrchr(fulldpyname, '/') + 1, sizeof(buf));
+-	buf[sizeof(buf) - 1] = '\0';
++		strncpy(buf, strrchr(fulldpyname, '/') + 1, sizeof(buf));
++		buf[sizeof(buf) - 1] = '\0';
+ #endif
+ 
+-        c = strchr(buf, ':');
++		c = strchr(buf, ':');
+ 
+-        /* In the legacy case with no bundle id, use the full path */
+-        if(c == buf) {
+-            src = fulldpyname;
+-        } else {
+-            *c = '\0';
+-            src = buf;
+-        }
++		/* In the legacy case with no bundle id, use the full path */
++		if(c == buf) {
++			src = fulldpyname;
++		} else {
++			*c = '\0';
++			src = buf;
++		}
+ 
+-        len = strlen(src);
+-    } else {
+-	    src = fulldpyname;
+-	    len = prefix;
++		len = strlen(src);
++	    } else {
++		src = fulldpyname;
++		len = prefix;
++            }
+ 	}
+ 	break;
+       case FamilyInternet:		/* host:0 */
+diff --git a/parsedpy.c b/parsedpy.c
+index c591b77..7365224 100644
+--- a/parsedpy.c
++++ b/parsedpy.c
+@@ -42,6 +42,9 @@ in this Software without prior written authorization from The Open Group.
+ #include <X11/Xauth.h>			/* for FamilyLocal */
+ #include <X11/Xmu/SysUtil.h>
+ 
++#include <sys/stat.h>
++#include <sys/syslimits.h>
++
+ #if defined(UNIXCONN) || defined(LOCALCONN)
+ #define UNIX_CONNECTION "unix"
+ #define UNIX_CONNECTION_LENGTH 4
+@@ -158,8 +161,32 @@ parse_displayname (const char *displayname,
+ 
+     if (!host) return False;
+ 
+-    if(strncmp (host, "/tmp/launch", 11) == 0) {
+-        family = FamilyLocal;
++    {
++        /*
++         * If using launchd socket, remove the screen number from the end
++         * of $DISPLAY and check if it is a path to a socket.
++         */
++        char path[PATH_MAX];
++        struct stat sbuf;
++
++#ifdef HAVE_STRLCPY
++        strlcpy(path, displayname, sizeof(path));
++#else
++        strncpy(path, displayname, sizeof(path));
++        buf[sizeof(path) - 1] = '\0';
++#endif
++        if (0 == stat(path, &sbuf)) {
++            family = FamilyLocal;
++        } else {
++            char *dot = strrchr(path, '.');
++            if (dot) {
++                *dot = '\0';
++                /* screen = atoi(dot + 1); */
++                if (0 == stat(path, &sbuf)) {
++                    family = FamilyLocal;
++                }
++            }
++        }
+     }
+ 
+     /*
+-- 
+2.3.0
+

Added: trunk/dports/x11/xauth/files/0003-Fix-HAVE_STRLCPY-case.patch
===================================================================
--- trunk/dports/x11/xauth/files/0003-Fix-HAVE_STRLCPY-case.patch	                        (rev 0)
+++ trunk/dports/x11/xauth/files/0003-Fix-HAVE_STRLCPY-case.patch	2015-02-15 06:25:29 UTC (rev 132934)
@@ -0,0 +1,54 @@
+From a58c9d74c8f9c4292d367c6e23d15c4cba03dfde Mon Sep 17 00:00:00 2001
+From: Jon TURNEY <jon.turney at dronecode.org.uk>
+Date: Fri, 2 Jan 2015 16:18:52 +0000
+Subject: [PATCH 3/4] Fix !HAVE_STRLCPY case
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fix error in the !HAVE_STRLCPY case, introduced in commit
+f990dd936b5fd1a40290bb88cde517a0ac38f823
+
+It seems that "path[sizeof(path) - 1]" rather than "buf[sizeof(path) - 1]" must
+be meant here, especially as the second instance doesn't even compile...
+
+parsedpy.c: In function ‘parse_displayname’:
+parsedpy.c:176:9: error: ‘buf’ undeclared (first use in this function)
+
+Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
+Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
+Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
+---
+ gethost.c  | 2 +-
+ parsedpy.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gethost.c b/gethost.c
+index c75ae02..e0dc8cb 100644
+--- a/gethost.c
++++ b/gethost.c
+@@ -200,7 +200,7 @@ struct addrlist *get_address_info (
+ 	    strlcpy(path, fulldpyname, sizeof(path));
+ #else
+ 	    strncpy(path, fulldpyname, sizeof(path));
+-	    buf[sizeof(path) - 1] = '\0';
++	    path[sizeof(path) - 1] = '\0';
+ #endif
+ 	    if (0 == stat(path, &sbuf)) {
+ 		is_path_to_socket = 1;
+diff --git a/parsedpy.c b/parsedpy.c
+index 7365224..c638b26 100644
+--- a/parsedpy.c
++++ b/parsedpy.c
+@@ -173,7 +173,7 @@ parse_displayname (const char *displayname,
+         strlcpy(path, displayname, sizeof(path));
+ #else
+         strncpy(path, displayname, sizeof(path));
+-        buf[sizeof(path) - 1] = '\0';
++        path[sizeof(path) - 1] = '\0';
+ #endif
+         if (0 == stat(path, &sbuf)) {
+             family = FamilyLocal;
+-- 
+2.3.0
+

Added: trunk/dports/x11/xauth/files/0004-include-POSIX-standard-limits.h-for-PATH_MAX-instead.patch
===================================================================
--- trunk/dports/x11/xauth/files/0004-include-POSIX-standard-limits.h-for-PATH_MAX-instead.patch	                        (rev 0)
+++ trunk/dports/x11/xauth/files/0004-include-POSIX-standard-limits.h-for-PATH_MAX-instead.patch	2015-02-15 06:25:29 UTC (rev 132934)
@@ -0,0 +1,43 @@
+From ad26f2137f6414c8cadc070f96a4476d435e994b Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <alan.coopersmith at oracle.com>
+Date: Fri, 2 Jan 2015 09:49:52 -0800
+Subject: [PATCH 4/4] include POSIX-standard limits.h for PATH_MAX instead of
+ sys/syslimits.h
+
+Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
+Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
+Reviewed-by: Mark Kettenis <kettenis at openbsd.org>
+---
+ gethost.c  | 2 +-
+ parsedpy.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gethost.c b/gethost.c
+index e0dc8cb..8cb58c5 100644
+--- a/gethost.c
++++ b/gethost.c
+@@ -58,7 +58,7 @@ in this Software without prior written authorization from The Open Group.
+ #include "xauth.h"
+ 
+ #include <sys/stat.h>
+-#include <sys/syslimits.h>
++#include <limits.h>
+ 
+ #ifndef WIN32
+ #include <arpa/inet.h>
+diff --git a/parsedpy.c b/parsedpy.c
+index c638b26..97988d3 100644
+--- a/parsedpy.c
++++ b/parsedpy.c
+@@ -43,7 +43,7 @@ in this Software without prior written authorization from The Open Group.
+ #include <X11/Xmu/SysUtil.h>
+ 
+ #include <sys/stat.h>
+-#include <sys/syslimits.h>
++#include <limits.h>
+ 
+ #if defined(UNIXCONN) || defined(LOCALCONN)
+ #define UNIX_CONNECTION "unix"
+-- 
+2.3.0
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150214/1f20e83b/attachment.html>


More information about the macports-changes mailing list