[xorg-x11-server] Fix code including glamor.h not compiling due to strndup re-definition

Hans de Goede jwrdegoede at fedoraproject.org
Wed Jul 2 19:14:54 UTC 2014


commit 3f526f40949979e09200aeea0cd9f05567df00ba
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Jul 2 21:12:24 2014 +0200

    Fix code including glamor.h not compiling due to strndup re-definition

 ...eaders-Fix-build-errors-with-latest-glibc.patch |  181 ++++++++++++++++++++
 xorg-x11-server.spec                               |    6 +-
 2 files changed, 186 insertions(+), 1 deletions(-)
---
diff --git a/0001-headers-Fix-build-errors-with-latest-glibc.patch b/0001-headers-Fix-build-errors-with-latest-glibc.patch
new file mode 100644
index 0000000..53ffe5f
--- /dev/null
+++ b/0001-headers-Fix-build-errors-with-latest-glibc.patch
@@ -0,0 +1,181 @@
+From 4d672dd0f41e4bd8f5e67936d7e14409ba80d54e Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Wed, 2 Jul 2014 20:55:53 +0200
+Subject: [PATCH] headers: Fix build errors with latest glibc
+
+include/os.h defines protyptes for various non ansi-c str functions, such
+as str[n]casecmp and strndup. The definition of the prototypes is guarded
+by #ifndef HAVE_STRFOO, but HAVE_STRFOO is defined by xorg-server.h which
+is not included by all users of os.h. E.g. glamor.h does not and should not
+include xorg-server.h
+
+This is a problem since the these prototype declarations clash with the libc
+declarations when using the latest glibc:
+
+In file included from /usr/include/xorg/misc.h:115:0,
+                 from /usr/include/xorg/screenint.h:50,
+                 from /usr/include/xorg/scrnintstr.h:50,
+                 from /usr/include/xorg/glamor.h:32,
+                 from conftest.c:61:
+/usr/include/xorg/os.h:579:2: error: expected identifier or '(' before '__extension__'
+ strndup(const char *str, size_t n);
+
+To fix this, this commit moves the HAVE_STRFOO defines to their own
+(generated) header called os-strfeatures.h, and unconditionally includes this
+header from os.h .
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ configure.ac                |  2 ++
+ include/Makefile.am         |  2 +-
+ include/dix-config.h.in     | 18 ------------------
+ include/os-strfeatures.h.in | 33 +++++++++++++++++++++++++++++++++
+ include/os.h                |  1 +
+ include/xorg-server.h.in    | 18 ------------------
+ 6 files changed, 37 insertions(+), 37 deletions(-)
+ create mode 100644 include/os-strfeatures.h.in
+
+diff --git a/configure.ac b/configure.ac
+index 2daa6be..05ae8e6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -72,6 +72,8 @@ AC_CONFIG_HEADERS(include/kdrive-config.h)
+ dnl version-config.h covers the version numbers so they can be bumped without
+ dnl forcing an entire recompile.x
+ AC_CONFIG_HEADERS(include/version-config.h)
++dnl os-strfeatures.h covers HAVE_STRFOO for non ansi-c string functions
++AC_CONFIG_HEADERS(include/os-strfeatures.h)
+ 
+ AM_PROG_AS
+ AC_PROG_LN_S
+diff --git a/include/Makefile.am b/include/Makefile.am
+index 6578038..b2ee27b 100644
+--- a/include/Makefile.am
++++ b/include/Makefile.am
+@@ -62,7 +62,7 @@ sdk_HEADERS =		\
+ 	xkbrules.h      \
+ 	xserver-properties.h
+ 
+-nodist_sdk_HEADERS = xorg-server.h
++nodist_sdk_HEADERS = xorg-server.h os-strfeatures.h
+ endif
+ 
+ AM_CFLAGS = $(DIX_CFLAGS)
+diff --git a/include/dix-config.h.in b/include/dix-config.h.in
+index f980a3d..f055b2c 100644
+--- a/include/dix-config.h.in
++++ b/include/dix-config.h.in
+@@ -175,30 +175,12 @@
+ /* Define to 1 if you have the <stdlib.h> header file. */
+ #undef HAVE_STDLIB_H
+ 
+-/* Define to 1 if you have the `strcasecmp' function. */
+-#undef HAVE_STRCASECMP
+-
+-/* Define to 1 if you have the `strcasestr' function. */
+-#undef HAVE_STRCASESTR
+-
+-/* Define to 1 if you have the `strncasecmp' function. */
+-#undef HAVE_STRNCASECMP
+-
+-/* Define to 1 if you have the `strlcat' function. */
+-#undef HAVE_STRLCAT
+-
+-/* Define to 1 if you have the `strlcpy' function. */
+-#undef HAVE_STRLCPY
+-
+ /* Define to 1 if you have the <strings.h> header file. */
+ #undef HAVE_STRINGS_H
+ 
+ /* Define to 1 if you have the <string.h> header file. */
+ #undef HAVE_STRING_H
+ 
+-/* Define to 1 if you have the `strndup' function. */
+-#undef HAVE_STRNDUP
+-
+ /* Define to 1 if libsystemd-daemon is available */
+ #undef HAVE_SYSTEMD_DAEMON
+ 
+diff --git a/include/os-strfeatures.h.in b/include/os-strfeatures.h.in
+new file mode 100644
+index 0000000..88c3b30
+--- /dev/null
++++ b/include/os-strfeatures.h.in
+@@ -0,0 +1,33 @@
++/* os-strfeatures.h.in						-*- c -*-
++ *
++ * This file is the template file for the os-strfeatures.h file which gets
++ * installed as part of the SDK.  The #defines in this file are HAVE_STRFOO
++ * defines which control whether os.h declares protype for non ansi-c
++ * string functions suchs as str[n]casecmp and strndup,
++ *
++ * Note this file is not generated by autoheader, so it needs to by synced
++ * manually with changes to configure.in where necessary.
++ */
++
++#ifndef OS_STRFEATURES_H
++#define OS_STRFEATURES_H
++
++/* Define to 1 if you have the `strcasecmp' function. */
++#undef HAVE_STRCASECMP
++
++/* Define to 1 if you have the `strncasecmp' function. */
++#undef HAVE_STRNCASECMP
++
++/* Define to 1 if you have the `strcasestr' function. */
++#undef HAVE_STRCASESTR
++
++/* Define to 1 if you have the `strlcat' function. */
++#undef HAVE_STRLCAT
++
++/* Define to 1 if you have the `strlcpy' function. */
++#undef HAVE_STRLCPY
++
++/* Define to 1 if you have the `strndup' function. */
++#undef HAVE_STRNDUP
++
++#endif /* OS_STRFEATURES_H */
+diff --git a/include/os.h b/include/os.h
+index d26e399..54819f9 100644
+--- a/include/os.h
++++ b/include/os.h
+@@ -48,6 +48,7 @@ SOFTWARE.
+ #define OS_H
+ 
+ #include "misc.h"
++#include "os-strfeatures.h"
+ #include <stdarg.h>
+ #include <stdint.h>
+ #include <string.h>
+diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
+index 8bf9d38..9daf0fa 100644
+--- a/include/xorg-server.h.in
++++ b/include/xorg-server.h.in
+@@ -43,24 +43,6 @@
+ /* Define to 1 if you have the `ffs' function. */
+ #undef HAVE_FFS
+ 
+-/* Define to 1 if you have the `strcasecmp' function. */
+-#undef HAVE_STRCASECMP
+-
+-/* Define to 1 if you have the `strcasestr' function. */
+-#undef HAVE_STRCASESTR
+-
+-/* Define to 1 if you have the `strlcat' function. */
+-#undef HAVE_STRLCAT
+-
+-/* Define to 1 if you have the `strlcpy' function. */
+-#undef HAVE_STRLCPY
+-
+-/* Define to 1 if you have the `strncasecmp' function. */
+-#undef HAVE_STRNCASECMP
+-
+-/* Define to 1 if you have the `strndup' function. */
+-#undef HAVE_STRNDUP
+-
+ /* Support IPv6 for TCP connections */
+ #undef IPv6
+ 
+-- 
+2.0.0
+
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index 8011f45..6a21a8e 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -42,7 +42,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.15.99.903
-Release:   4%{?gitdate:.%{gitdate}}%{dist}
+Release:   5%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -76,6 +76,7 @@ Source40: driver-abi-rebuild.sh
 
 # Submitted upstream
 Patch0001: 0001-fb-Fix-xvfb-crash-in-fbCloseScreen-on-client-disconn.patch
+Patch0002: 0001-headers-Fix-build-errors-with-latest-glibc.patch
 
 # Trivial things to never merge upstream ever:
 # This really could be done prettier.
@@ -621,6 +622,9 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
 
 
 %changelog
+* Wed Jul  2 2014 Hans de Goede <hdegoede at redhat.com> - 1.15.99.903-5
+- Fix code including glamor.h not compiling due to strndup re-definition
+
 * Wed Jul 02 2014 Adam Jackson <ajax at redhat.com> 1.15.99.903-4
 - Snap xwayland damage reports to the bounding box
 


More information about the scm-commits mailing list