From ecf1330c1b2f3977f8cabfd6b0f3b3eec6591db4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jun 16 2015 11:18:08 +0000 Subject: import ibus-1.5.3-12.el7 --- diff --git a/SOURCES/ibus-1183909-x11-hang-fast-type.patch b/SOURCES/ibus-1183909-x11-hang-fast-type.patch new file mode 100644 index 0000000..fa0b217 --- /dev/null +++ b/SOURCES/ibus-1183909-x11-hang-fast-type.patch @@ -0,0 +1,383 @@ +From 576ebc3633aa1fb3076ffac031255c3da4e2cd09 Mon Sep 17 00:00:00 2001 +From: Klemens Baum +Date: Thu, 18 Dec 2014 16:27:23 +0900 +Subject: [PATCH] IMdkit: Track window property offsets correctly + +The XIM specification requires that XIM tranports over 20 bytes in size +be transferred via window properties. The sender calls XChangeProperty +with PropModeAppend, and instructs the recipient via ClientMessage to +call XGetWindowProperty with delete set to True. + +Naive implementations exhibit a race condition because the receiver +could have written more data in the meantime, and XGetWindowProperty +only deletes the property when bytes_after_return is zero. If +bytes_after_return is non-zero, it is necessary to use an offset when +reading from the property again. + +To ensure that the property data does not grow indefinitely, Xlib +recycles 21 Atoms in round-robin fashion. Because the XIM specification +does not limit the number of Atom names of the form "_clientXXX" to be +used for data transfer over window properties, an XIM server should be +able to keep of track any number of Atoms, remembering the offset into +each property. + +This patch implements correct tracking of property offsets. + +Signed-off-by: Klemens Baum +Reviewed-by: Keith Packard + +rhbz#1175595 +BUG=https://code.google.com/p/ibus/issues/detail?id=1751 +TEST=client/x11/ibus-x11 + +Review URL: https://codereview.appspot.com/176190044 +Patch from Klemens Baum . +--- + util/IMdkit/Makefile.am | 5 ++- + util/IMdkit/Xi18n.h | 23 +++++++++-- + util/IMdkit/i18nOffsetCache.c | 89 +++++++++++++++++++++++++++++++++++++++++++ + util/IMdkit/i18nUtil.c | 9 +++-- + util/IMdkit/i18nX.c | 73 ++++++++++++++++++----------------- + 5 files changed, 154 insertions(+), 45 deletions(-) + create mode 100644 util/IMdkit/i18nOffsetCache.c + +diff --git a/util/IMdkit/Makefile.am b/util/IMdkit/Makefile.am +index e3946d7..6cbb908 100644 +--- a/util/IMdkit/Makefile.am ++++ b/util/IMdkit/Makefile.am +@@ -2,8 +2,8 @@ + # + # ibus - The Input Bus + # +-# Copyright (c) 2007-2010 Peng Huang +-# Copyright (c) 2007-2010 Red Hat, Inc. ++# Copyright (c) 2007-2014 Peng Huang ++# Copyright (c) 2007-2014 Red Hat, Inc. + # + # This library is free software; you can redistribute it and/or + # modify it under the terms of the GNU Lesser General Public +@@ -29,6 +29,7 @@ libIMdkit_la_SOURCES = \ + i18nIc.c \ + i18nIMProto.c \ + i18nMethod.c \ ++ i18nOffsetCache.c \ + i18nPtHdr.c \ + i18nUtil.c \ + i18nX.c \ +diff --git a/util/IMdkit/Xi18n.h b/util/IMdkit/Xi18n.h +index 484cc62..e1d24d5 100644 +--- a/util/IMdkit/Xi18n.h ++++ b/util/IMdkit/Xi18n.h +@@ -1,7 +1,9 @@ + /****************************************************************** + +- Copyright 1994, 1995 by Sun Microsystems, Inc. +- Copyright 1993, 1994 by Hewlett-Packard Company ++ Copyright (C) 1994-1995 Sun Microsystems, Inc. ++ Copyright (C) 1993-1994 Hewlett-Packard Company ++ Copyright (C) 2014 Peng Huang ++ Copyright (C) 2014 Red Hat, Inc. + + Permission to use, copy, modify, distribute, and sell this software + and its documentation for any purpose is hereby granted without fee, +@@ -45,6 +47,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + #define XIM_EXT_MOVE (0x33) + #define COMMON_EXTENSIONS_NUM 3 + ++#include + #include + #include "IMdkit.h" + +@@ -138,6 +141,19 @@ typedef struct + char *name; + } XIMExt; + ++typedef struct ++{ ++ Atom key; ++ unsigned long offset; ++} Xi18nAtomOffsetPair; ++ ++typedef struct ++{ ++ size_t capacity; ++ size_t size; ++ Xi18nAtomOffsetPair *data; ++} Xi18nOffsetCache; ++ + typedef struct _Xi18nClient + { + int connect_id; +@@ -149,8 +165,7 @@ typedef struct _Xi18nClient + */ + int sync; + XIMPending *pending; +- /* property offset to read next data */ +- long property_offset; ++ Xi18nOffsetCache offset_cache; + void *trans_rec; /* contains transport specific data */ + struct _Xi18nClient *next; + } Xi18nClient; +diff --git a/util/IMdkit/i18nOffsetCache.c b/util/IMdkit/i18nOffsetCache.c +new file mode 100644 +index 0000000..c952d5b +--- /dev/null ++++ b/util/IMdkit/i18nOffsetCache.c +@@ -0,0 +1,89 @@ ++/* ++ * Copyright (C) 2014 Peng Huang ++ * Copyright (C) 2014 Red Hat, Inc. ++ * ++ * Permission to use, copy, modify, distribute, and sell this ++ * software and its documentation for any purpose is hereby granted ++ * without fee, provided that the above copyright notice appear in ++ * all copies and that both that copyright notice and this permission ++ * notice appear in supporting documentation, and that the name of ++ * the copyright holders not be used in advertising or publicity ++ * pertaining to distribution of the software without specific, ++ * written prior permission. The copyright holders make no ++ * representations about the suitability of this software for any ++ * purpose. It is provided "as is" without express or implied ++ * warranty. ++ * ++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ++ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ++ * THIS SOFTWARE. ++ * ++ * Author: Klemens Baum ++ */ ++ ++#include ++#include ++#include "IMdkit.h" ++#include "Xi18n.h" ++ ++/* ++ * The XIM specification does not limit the number of window properties ++ * that can be used to transfer data, but Xlib uses the atom strings ++ * _client0 through _client20. ++ * ++ * So use that as a sensible initial size for the offset cache. ++ */ ++#define INITIAL_OFFSET_CACHE_CAPACITY 21 ++#define OFFSET_CACHE_GROWTH_FACTOR 2 ++ ++void _Xi18nInitOffsetCache (Xi18nOffsetCache *offset_cache) ++{ ++ offset_cache->size = 0; ++ offset_cache->capacity = INITIAL_OFFSET_CACHE_CAPACITY; ++ offset_cache->data = (Xi18nAtomOffsetPair *) malloc ( ++ INITIAL_OFFSET_CACHE_CAPACITY * sizeof (Xi18nAtomOffsetPair)); ++} ++ ++unsigned long _Xi18nLookupPropertyOffset (Xi18nOffsetCache *offset_cache, ++ Atom key) ++{ ++ Xi18nAtomOffsetPair *data = offset_cache->data; ++ size_t i; ++ ++ for (i = 0; i < offset_cache->size; ++i) { ++ if (data[i].key == key) { ++ return data[i].offset; ++ } ++ } ++ ++ return 0; ++} ++ ++void _Xi18nSetPropertyOffset (Xi18nOffsetCache *offset_cache, Atom key, ++ unsigned long offset) ++{ ++ Xi18nAtomOffsetPair *data = offset_cache->data; ++ size_t i; ++ ++ for (i = 0; i < offset_cache->size; ++i) { ++ if (data[i].key == key) { ++ data[i].offset = offset; ++ return; ++ } ++ } ++ ++ if (++offset_cache->size > offset_cache->capacity) { ++ offset_cache->capacity *= OFFSET_CACHE_GROWTH_FACTOR; ++ offset_cache->data = data = (Xi18nAtomOffsetPair *) realloc (data, ++ offset_cache->capacity * sizeof (Xi18nAtomOffsetPair)); ++ } ++ ++ data[i].key = key; ++ data[i].offset = offset; ++} ++ +diff --git a/util/IMdkit/i18nUtil.c b/util/IMdkit/i18nUtil.c +index c07de48..6557bd1 100644 +--- a/util/IMdkit/i18nUtil.c ++++ b/util/IMdkit/i18nUtil.c +@@ -1,7 +1,9 @@ + /****************************************************************** + +- Copyright 1994, 1995 by Sun Microsystems, Inc. +- Copyright 1993, 1994 by Hewlett-Packard Company ++ Copyright (C) 1994-1995 Sun Microsystems, Inc. ++ Copyright (C) 1993-1994 Hewlett-Packard Company ++ Copyright (C) 2014 Peng Huang ++ Copyright (C) 2014 Red Hat, Inc. + + Permission to use, copy, modify, distribute, and sell this software + and its documentation for any purpose is hereby granted without fee, +@@ -36,6 +38,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + #include "XimFunc.h" + + Xi18nClient *_Xi18nFindClient (Xi18n, CARD16); ++void _Xi18nInitOffsetCache (Xi18nOffsetCache *); + + int + _Xi18nNeedSwap (Xi18n i18n_core, CARD16 connect_id) +@@ -70,7 +73,7 @@ Xi18nClient *_Xi18nNewClient(Xi18n i18n_core) + client->sync = False; + client->byte_order = '?'; /* initial value */ + memset (&client->pending, 0, sizeof (XIMPending *)); +- client->property_offset = 0; ++ _Xi18nInitOffsetCache (&client->offset_cache); + client->next = i18n_core->address.clients; + i18n_core->address.clients = client; + +diff --git a/util/IMdkit/i18nX.c b/util/IMdkit/i18nX.c +index 0a54058..8385aba 100644 +--- a/util/IMdkit/i18nX.c ++++ b/util/IMdkit/i18nX.c +@@ -1,7 +1,9 @@ + /****************************************************************** + +- Copyright 1994, 1995 by Sun Microsystems, Inc. +- Copyright 1993, 1994 by Hewlett-Packard Company ++ Copyright (C) 1994-1995 Sun Microsystems, Inc. ++ Copyright (C) 1993-1994 Hewlett-Packard Company ++ Copyright (C) 2014 Peng Huang ++ Copyright (C) 2014 Red Hat, Inc. + + Permission to use, copy, modify, distribute, and sell this software + and its documentation for any purpose is hereby granted without fee, +@@ -29,6 +31,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ******************************************************************/ + ++#include + #include + #include + #include +@@ -38,12 +41,14 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + #include "Xi18nX.h" + #include "XimFunc.h" + +-extern Xi18nClient *_Xi18nFindClient(Xi18n, CARD16); +-extern Xi18nClient *_Xi18nNewClient(Xi18n); +-extern void _Xi18nDeleteClient(Xi18n, CARD16); +-static Bool WaitXConnectMessage(Display*, Window, +- XEvent*, XPointer); +-static Bool WaitXIMProtocol(Display*, Window, XEvent*, XPointer); ++extern Xi18nClient *_Xi18nFindClient (Xi18n, CARD16); ++extern Xi18nClient *_Xi18nNewClient (Xi18n); ++extern void _Xi18nDeleteClient (Xi18n, CARD16); ++extern unsigned long _Xi18nLookupPropertyOffset (Xi18nOffsetCache *, Atom); ++extern void _Xi18nSetPropertyOffset (Xi18nOffsetCache *, Atom, unsigned long); ++static Bool WaitXConnectMessage (Display*, Window, ++ XEvent*, XPointer); ++static Bool WaitXIMProtocol (Display*, Window, XEvent*, XPointer); + + static XClient *NewXClient (Xi18n i18n_core, Window new_client) + { +@@ -129,7 +134,6 @@ static unsigned char *ReadXIMMessage (XIMS ims, + else if (ev->format == 32) { + /* ClientMessage and WindowProperty */ + unsigned long length = (unsigned long) ev->data.l[0]; +- unsigned long get_length; + Atom atom = (Atom) ev->data.l[1]; + int return_code; + Atom actual_type_ret; +@@ -137,21 +141,28 @@ static unsigned char *ReadXIMMessage (XIMS ims, + unsigned long bytes_after_ret; + unsigned char *prop; + unsigned long nitems; +- +- /* Round up length to next 4 byte value. */ +- get_length = length + 3; +- if (get_length > LONG_MAX) +- get_length = LONG_MAX; +- get_length /= 4; +- if (get_length == 0) { +- fprintf(stderr, "%s: invalid length 0\n", __func__); ++ Xi18nOffsetCache *offset_cache = &client->offset_cache; ++ unsigned long offset; ++ unsigned long end; ++ unsigned long long_begin; ++ unsigned long long_end; ++ ++ if (length == 0) { ++ fprintf (stderr, "%s: invalid length 0\n", __func__); + return NULL; + } ++ ++ offset = _Xi18nLookupPropertyOffset (offset_cache, atom); ++ end = offset + length; ++ ++ /* The property data is retrieved in 32-bit chunks */ ++ long_begin = offset / 4; ++ long_end = (end + 3) / 4; + return_code = XGetWindowProperty (i18n_core->address.dpy, + x_client->accept_win, + atom, +- client->property_offset / 4, +- get_length, ++ long_begin, ++ long_end - long_begin, + True, + AnyPropertyType, + &actual_type_ret, +@@ -162,32 +173,22 @@ static unsigned char *ReadXIMMessage (XIMS ims, + if (return_code != Success || actual_format_ret == 0 || nitems == 0) { + if (return_code == Success) + XFree (prop); +- client->property_offset = 0; ++ fprintf (stderr, ++ "(XIM-IMdkit) ERROR: XGetWindowProperty failed.\n" ++ "Protocol data is likely to be inconsistent.\n"); ++ _Xi18nSetPropertyOffset (offset_cache, atom, 0); + return (unsigned char *) NULL; + } + /* Update the offset to read next time as needed */ + if (bytes_after_ret > 0) +- client->property_offset += length; ++ _Xi18nSetPropertyOffset (offset_cache, atom, offset + length); + else +- client->property_offset = 0; +- switch (actual_format_ret) { +- case 8: +- case 16: +- case 32: +- length = nitems * actual_format_ret / 8; +- break; +- default: +- fprintf(stderr, "%s: unknown property return format: %d\n", +- __func__, actual_format_ret); +- XFree(prop); +- client->property_offset = 0; +- return NULL; +- } ++ _Xi18nSetPropertyOffset (offset_cache, atom, 0); + /* if hit, it might be an error */ + if ((p = (unsigned char *) malloc (length)) == NULL) + return (unsigned char *) NULL; + +- memmove (p, prop, length); ++ memcpy (p, prop + (offset % 4), length); + XFree (prop); + } + return (unsigned char *) p; +-- +2.1.0 + diff --git a/SPECS/ibus.spec b/SPECS/ibus.spec index 271371a..9136a67 100644 --- a/SPECS/ibus.spec +++ b/SPECS/ibus.spec @@ -26,7 +26,7 @@ Name: ibus Version: 1.5.3 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Intelligent Input Bus for Linux OS License: LGPLv2+ Group: System Environment/Libraries @@ -51,6 +51,8 @@ Patch4: %{name}-xx-setup-frequent-lang.patch Patch95: %{name}-xx-ctrl-space.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1030358 Patch96: %{name}-1030358-translation_updates.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1183909 +Patch97: %{name}-1183909-x11-hang-fast-type.patch BuildRequires: gettext-devel @@ -235,6 +237,9 @@ rm -f data/dconf/00-upstream-settings %if (0%{?fedora} < 1 && 0%{?rhel} <= 7) %patch96 -p2 -b .po-rhel %endif +%if (0%{?fedora} < 20 && 0%{?rhel} <= 7) +%patch97 -p1 -b .xhang +%endif %build %if %with_preload_xkb_engine @@ -319,20 +324,20 @@ dconf update || : %post gtk2 if [ $1 -eq 1 ] ; then # For upgrades, the cache will be regenerated by the new package's %%postun - %{_bindir}/update-gtk-immodules %{_host} || : + gtk-query-immodules-2.0-%{__isa_bits} --update-cache &> /dev/null || : fi %postun gtk2 -%{_bindir}/update-gtk-immodules %{_host} || : +gtk-query-immodules-2.0-%{__isa_bits} --update-cache &> /dev/null || : %post gtk3 if [ $1 -eq 1 ] ; then # For upgrades, the cache will be regenerated by the new package's %%postun - /usr/bin/gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || : + gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || : fi %postun gtk3 -/usr/bin/gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || : +gtk-query-immodules-3.0-%{__isa_bits} --update-cache &> /dev/null || : # FIXME: no version number @@ -413,6 +418,10 @@ fi %{_datadir}/gtk-doc/html/* %changelog +* Fri Apr 03 2015 Takao Fujiwara - 1.5.3-12 +- Resolves: #1183909 - programs using "PreeditType: OverTheSpot" is stalled +- Resolves: #1191825 - gtk2's immodules.cache won't be updated in some cases + * Wed Jan 29 2014 Takao Fujiwara - 1.5.3-11 - Resolves: #1055842 Fixed typo.