From f326c8fde73c2f202d7f2d39ee575fbb950bbf90bae769aaa4ce723af8f42c85 Mon Sep 17 00:00:00 2001 From: Michal Srb Date: Fri, 5 Jan 2018 11:15:21 +0000 Subject: [PATCH 1/2] Accepting request 561848 from home:michalsrb:branches:bnc1073996:X11:XOrg - n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch * Prevent infinite loop also in case DISPLAY is non-local. - Use spaces instead of tabs in the patches (as does the original source code) to avoid confusion. - n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch * If authentication (with *stage == 0) failed and the variable XAUTHLOCALHOSTNAME wasn't set, we were never getting to stage 2 in the original patch, causing calls to xcb_connect_to_display to be stuck in an infinite loop. Now we also go to stage 2 if the variable isn't set. OBS-URL: https://build.opensuse.org/request/show/561848 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/libxcb?expand=0&rev=47 --- bug-262309_xcb-xauthlocalhostname.diff | 25 +++++----- libxcb.changes | 18 +++++++ libxcb.spec | 2 +- ...-fails-retry-with-XAUTHLOCALHOSTNAME.patch | 47 ++++++++++--------- 4 files changed, 56 insertions(+), 36 deletions(-) diff --git a/bug-262309_xcb-xauthlocalhostname.diff b/bug-262309_xcb-xauthlocalhostname.diff index 7182d05..ffd3eb7 100644 --- a/bug-262309_xcb-xauthlocalhostname.diff +++ b/bug-262309_xcb-xauthlocalhostname.diff @@ -1,27 +1,24 @@ --- src/xcb_auth.c.orig 2009-05-29 17:48:24.000000000 +0200 +++ src/xcb_auth.c 2009-05-29 17:56:01.000000000 +0200 -@@ -100,2 +100,3 @@ static Xauth *get_authptr(struct sockadd +@@ -119,2 +119,3 @@ static Xauth *get_authptr(struct sockadd int dispbuflen; + Xauth *authptr = NULL; -@@ -143,6 +143,16 @@ static Xauth *get_authptr(struct sockadd +@@ -163,6 +163,16 @@ static Xauth *get_authptr(struct sockadd - return XauGetBestAuthByAddr (family, -- (unsigned short) addrlen, addr, -- (unsigned short) dispbuflen, dispbuf, -- N_AUTH_PROTOS, authnames, authnameslen); + authptr = XauGetBestAuthByAddr (family, -+ (unsigned short) addrlen, addr, -+ (unsigned short) dispbuflen, dispbuf, -+ N_AUTH_PROTOS, authnames, authnameslen); + (unsigned short) addrlen, addr, + (unsigned short) dispbuflen, dispbuf, + N_AUTH_PROTOS, authnames, authnameslen); + // && !phostname + if ((!authptr || !authptr->data_length) && family == FamilyLocal) { -+ if ( (addr = getenv("XAUTHLOCALHOSTNAME")) ) { -+ authptr = XauGetBestAuthByAddr (family, -+ (unsigned short) strlen(addr), addr, -+ (unsigned short) dispbuflen, dispbuf, -+ N_AUTH_PROTOS, authnames, authnameslen); -+ } ++ if ( (addr = getenv("XAUTHLOCALHOSTNAME")) ) { ++ authptr = XauGetBestAuthByAddr (family, ++ (unsigned short) strlen(addr), addr, ++ (unsigned short) dispbuflen, dispbuf, ++ N_AUTH_PROTOS, authnames, authnameslen); ++ } + } + return authptr; } diff --git a/libxcb.changes b/libxcb.changes index c2e63c5..249d310 100644 --- a/libxcb.changes +++ b/libxcb.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Fri Jan 5 10:44:07 UTC 2018 - msrb@suse.com + +- n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch + * Prevent infinite loop also in case DISPLAY is non-local. + +------------------------------------------------------------------- +Wed Dec 20 21:07:38 UTC 2017 - aaronpuchert@alice-dsl.net + +- Use spaces instead of tabs in the patches (as does the original + source code) to avoid confusion. +- n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch + * If authentication (with *stage == 0) failed and the variable + XAUTHLOCALHOSTNAME wasn't set, we were never getting to stage 2 + in the original patch, causing calls to xcb_connect_to_display + to be stuck in an infinite loop. + Now we also go to stage 2 if the variable isn't set. + ------------------------------------------------------------------- Mon Dec 11 12:13:21 UTC 2017 - sndirsch@suse.com diff --git a/libxcb.spec b/libxcb.spec index 47d40fa..e298fb0 100644 --- a/libxcb.spec +++ b/libxcb.spec @@ -1,7 +1,7 @@ # # spec file for package libxcb # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed diff --git a/n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch b/n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch index 2475558..f1f7774 100644 --- a/n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch +++ b/n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch @@ -29,37 +29,42 @@ Index: libxcb-1.12/src/xcb_auth.c Xauth *authptr = NULL; + if (*stage == 2) -+ return NULL; ++ return NULL; family = FamilyLocal; /* 256 */ switch(sockname->sa_family) { -@@ -161,10 +163,13 @@ static Xauth *get_authptr(struct sockadd +@@ -161,18 +163,23 @@ static Xauth *get_authptr(struct sockadd addrlen = strlen(addr); } - authptr = XauGetBestAuthByAddr (family, -- (unsigned short) addrlen, addr, -- (unsigned short) dispbuflen, dispbuf, -- N_AUTH_PROTOS, authnames, authnameslen); +- (unsigned short) addrlen, addr, +- (unsigned short) dispbuflen, dispbuf, +- N_AUTH_PROTOS, authnames, authnameslen); +- // && !phostname +- if ((!authptr || !authptr->data_length) && family == FamilyLocal) { +- if ( (addr = getenv("XAUTHLOCALHOSTNAME")) ) { + if (*stage == 0) { -+ authptr = XauGetBestAuthByAddr (family, -+ (unsigned short) addrlen, addr, -+ (unsigned short) dispbuflen, dispbuf, -+ N_AUTH_PROTOS, authnames, authnameslen); -+ *stage = 1; ++ authptr = XauGetBestAuthByAddr (family, ++ (unsigned short) addrlen, addr, ++ (unsigned short) dispbuflen, dispbuf, ++ N_AUTH_PROTOS, authnames, authnameslen); ++ *stage = 1; ++ return authptr; + } - // && !phostname - if ((!authptr || !authptr->data_length) && family == FamilyLocal) { - if ( (addr = getenv("XAUTHLOCALHOSTNAME")) ) { -@@ -172,6 +177,7 @@ static Xauth *get_authptr(struct sockadd - (unsigned short) strlen(addr), addr, - (unsigned short) dispbuflen, dispbuf, - N_AUTH_PROTOS, authnames, authnameslen); -+ *stage = 2; - } ++ if (*stage == 1) { ++ if ((!authptr || !authptr->data_length) && family == FamilyLocal && (addr = getenv("XAUTHLOCALHOSTNAME"))) { + authptr = XauGetBestAuthByAddr (family, + (unsigned short) strlen(addr), addr, + (unsigned short) dispbuflen, dispbuf, + N_AUTH_PROTOS, authnames, authnameslen); + } ++ *stage = 2; ++ return authptr; } return authptr; -@@ -320,7 +326,7 @@ static struct sockaddr *get_peer_sock_na + } +@@ -320,7 +327,7 @@ static struct sockaddr *get_peer_sock_na return NULL; } @@ -68,7 +73,7 @@ Index: libxcb-1.12/src/xcb_auth.c { /* code adapted from Xlib/ConnDis.c, xtrans/Xtranssocket.c, xtrans/Xtransutils.c */ -@@ -345,7 +351,7 @@ int _xcb_get_auth_info(int fd, xcb_auth_ +@@ -345,7 +352,7 @@ int _xcb_get_auth_info(int fd, xcb_auth_ gotsockname = 1; } From aae4bce3eb5e721f8dea776586d77e8ae91a438f3a7b440d93e9eafcb5558827 Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Mon, 8 Jan 2018 14:50:51 +0000 Subject: [PATCH 2/2] Accepting request 562552 from home:michalsrb:branches:X11:XOrg - Enable xinput extension. (bnc#1074249) - U_add-support-for-eventstruct.patch * Update xinput to the state when it was enabled by default upstream. - Update xinput to the state when it was enabled by default upstream. (bnc#1074249) * U_SendExtensionEvent-uses-eventstruct.patch * U_add-support-for-eventstruct.patch * U_xinput-typedef-for-event_type_base.patch OBS-URL: https://build.opensuse.org/request/show/562552 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/libxcb?expand=0&rev=48 --- U_add-support-for-eventstruct.patch | 104 ++++++++++++++++++++++++++++ baselibs.conf | 2 + libxcb.changes | 8 +++ libxcb.spec | 24 +++++++ 4 files changed, 138 insertions(+) create mode 100644 U_add-support-for-eventstruct.patch diff --git a/U_add-support-for-eventstruct.patch b/U_add-support-for-eventstruct.patch new file mode 100644 index 0000000..66b5783 --- /dev/null +++ b/U_add-support-for-eventstruct.patch @@ -0,0 +1,104 @@ +From ee9dfc9a7658e7fe75d27483bb5ed1ba4d1e2c86 Mon Sep 17 00:00:00 2001 +From: Christian Linhart +Date: Wed, 25 Jan 2017 10:21:05 +0100 +Subject: [PATCH] add support for eventstruct + +eventstruct allows to use events as part of requests. +This is, e.g., needed by xcb_input_send_extension_event. + +Signed-off-by: Christian Linhart +--- + src/c_client.py | 32 +++++++++++++++++++++++++++++++- + src/xcb.h | 12 ++++++++++++ + 2 files changed, 43 insertions(+), 1 deletion(-) + +diff --git a/src/c_client.py b/src/c_client.py +index b0eb47c..0cbdf30 100644 +--- a/src/c_client.py ++++ b/src/c_client.py +@@ -437,7 +437,11 @@ def _c_type_setup(self, name, postfix): + first_field_after_varsized = None + + for field in self.fields: +- field.c_field_type = _t(field.field_type) ++ if field.type.is_event: ++ field.c_field_type = _t(field.field_type + ('event',)) ++ else: ++ field.c_field_type = _t(field.field_type) ++ + field.c_field_const_type = ('' if field.type.nmemb == 1 else 'const ') + field.c_field_type + field.c_field_name = _cpp(field.field_name) + field.c_subscript = '[%d]' % field.type.nmemb if (field.type.nmemb and field.type.nmemb > 1) else '' +@@ -3156,6 +3160,28 @@ def c_request(self, name): + # TODO: what about aux helpers? + _man_request(self, name, void=not self.reply, aux=False) + ++ ++def c_eventstruct(self, name): ++ #add fields that are needed to get the event-type in a generic way ++ self.fields.append( Field( tevent, tevent.name, 'event_header', False, True, True) ) ++ ++ if self.contains_ge_events: ++ #TODO: add header of ge-events as an extra field ++ raise Exception( 'eventstructs with ge-events are not yet supported' ) ++ ++ _c_type_setup(self, name, ()) ++ ++ #correct the format of the field names ++ for field in self.fields: ++ field.c_field_name = _n_item(field.c_field_name).lower() ++ ++ _c_complex(self) ++ _c_iterator(self, name) ++ ++ if not self.fixed_size(): ++ #TODO: Create sizeof function (and maybe other accessors) for var-sized eventstructs ++ raise Exception( 'var sized eventstructs are not yet supported' ) ++ + def c_event(self, name): + ''' + Exported function that handles event declarations. +@@ -3253,6 +3279,7 @@ output = {'open' : c_open, + 'struct' : c_struct, + 'union' : c_union, + 'request' : c_request, ++ 'eventstruct' : c_eventstruct, + 'event' : c_event, + 'error' : c_error, + } +@@ -3296,6 +3323,9 @@ Refer to the README file in xcb/proto for more info. + ''') + raise + ++# predefined datatype globals. ++tevent = SimpleType(('xcb_raw_generic_event_t',), 32) ++ + # Ensure the man subdirectory exists + try: + os.mkdir('man') +diff --git a/src/xcb.h b/src/xcb.h +index 6873e79..cbc0f2b 100644 +--- a/src/xcb.h ++++ b/src/xcb.h +@@ -143,6 +143,18 @@ typedef struct { + } xcb_generic_event_t; + + /** ++ * @brief Raw Generic event. ++ * ++ * A generic event structure as used on the wire, i.e., without the full_sequence field ++ */ ++typedef struct { ++ uint8_t response_type; /**< Type of the response */ ++ uint8_t pad0; /**< Padding */ ++ uint16_t sequence; /**< Sequence number */ ++ uint32_t pad[7]; /**< Padding */ ++} xcb_raw_generic_event_t; ++ ++/** + * @brief GE event + * + * An event as sent by the XGE extension. The length field specifies the +-- +2.13.6 + diff --git a/baselibs.conf b/baselibs.conf index a291e1c..404473d 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -20,6 +20,7 @@ libxcb-xf86dri0 libxcb-xfixes0 libxcb-xkb1 libxcb-xinerama0 +libxcb-xinput0 libxcb-xtest0 libxcb-xv0 libxcb-xvmc0 @@ -45,6 +46,7 @@ libxcb-devel requires "libxcb-xfixes0- = " requires "libxcb-xkb1- = " requires "libxcb-xinerama0- = " + requires "libxcb-xinput0- = " requires "libxcb-xtest0- = " requires "libxcb-xv0- = " requires "libxcb-xvmc0- = " diff --git a/libxcb.changes b/libxcb.changes index 249d310..a27a4c6 100644 --- a/libxcb.changes +++ b/libxcb.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Jan 8 13:53:53 UTC 2018 - msrb@suse.com + +- Enable xinput extension. (bnc#1074249) +- U_add-support-for-eventstruct.patch + * Update xinput to the state when it was enabled by default + upstream. + ------------------------------------------------------------------- Fri Jan 5 10:44:07 UTC 2018 - msrb@suse.com diff --git a/libxcb.spec b/libxcb.spec index e298fb0..a7894df 100644 --- a/libxcb.spec +++ b/libxcb.spec @@ -38,6 +38,7 @@ Source: %{name}-%{version}.tar.bz2 Source1: baselibs.conf Patch1: bug-262309_xcb-xauthlocalhostname.diff Patch2: n_If-auth-with-credentials-for-hostname-fails-retry-with-XAUTHLOCALHOSTNAME.patch +Patch3: U_add-support-for-eventstruct.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: autoconf >= 2.57 BuildRequires: automake @@ -288,6 +289,18 @@ Xinerama is an extension to the X Window System which enables multi-headed X applications and window managers to use two or more physical displays as one large virtual display. +%package -n libxcb-xinput0 +Summary: X11 XInput Extension C library +Group: System/Libraries + +%description -n libxcb-xinput0 +The X protocol C-language Binding (XCB) is a replacement for Xlib +featuring a small footprint, latency hiding, direct access to the +protocol, improved threading support, and extensibility. + +Xinput is an extension to the X Window System intended to replace +core input processing. + %package -n libxcb-xtest0 Summary: X11 XTEST Extension C library Group: System/Libraries @@ -351,6 +364,7 @@ Requires: libxcb-sync1 = %version Requires: libxcb-xf86dri0 = %version Requires: libxcb-xfixes0 = %version Requires: libxcb-xinerama0 = %version +Requires: libxcb-xinput0 = %version Requires: libxcb-xkb1 = %version Requires: libxcb-xtest0 = %version Requires: libxcb-xv0 = %version @@ -384,11 +398,13 @@ libxcb. %setup -q %patch -P 1 -p0 %patch2 -p1 +%patch3 -p1 %build ./autogen.sh %configure --docdir=%_docdir/%name \ --disable-static \ + --enable-xinput \ --enable-xkb \ --enable-sendfds make %{?_smp_mflags} @@ -477,6 +493,10 @@ rm -f "%buildroot/%_libdir"/*.la %postun -n libxcb-xinerama0 -p /sbin/ldconfig +%post -n libxcb-xinput0 -p /sbin/ldconfig + +%postun -n libxcb-xinput0 -p /sbin/ldconfig + %post -n libxcb-xtest0 -p /sbin/ldconfig %postun -n libxcb-xtest0 -p /sbin/ldconfig @@ -568,6 +588,10 @@ rm -f "%buildroot/%_libdir"/*.la %defattr(-,root,root) %_libdir/libxcb-xinerama.so.0* +%files -n libxcb-xinput0 +%defattr(-,root,root) +%_libdir/libxcb-xinput.so.0* + %files -n libxcb-xtest0 %defattr(-,root,root) %_libdir/libxcb-xtest.so.0*