Hello community,

here is the log from the commit of package fcitx for openSUSE:Factory checked 
in at 2013-01-31 16:27:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/fcitx (Old)
 and      /work/SRC/openSUSE:Factory/.fcitx.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "fcitx", Maintainer is ""

Changes:
--------
--- /work/SRC/openSUSE:Factory/fcitx/fcitx.changes      2013-01-30 
11:15:40.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.fcitx.new/fcitx.changes 2013-01-31 
16:27:31.000000000 +0100
@@ -1,0 +2,9 @@
+Wed Jan 30 18:24:37 UTC 2013 - [email protected]
+
+- fix bnc#801318: xkeyboard-config symlink breaks fcitx in detecting xkb rule 
files.
+  * bnc801318-fcitx-4.2.7-xkb-rule-symlink-detection.patch
+  * remove next release
+- fix bnc#801319: invalid /etc/xdg/autostart/fcitx-autostart.desktop breaks 
ibus
+  * leave fcitx-autostart.desktop only for fedora.
+
+-------------------------------------------------------------------

New:
----
  bnc801318-fcitx-4.2.7-xkb-rule-symlink-detection.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ fcitx.spec ++++++
--- /var/tmp/diff_new_pack.WLvlwc/_old  2013-01-31 16:27:33.000000000 +0100
+++ /var/tmp/diff_new_pack.WLvlwc/_new  2013-01-31 16:27:33.000000000 +0100
@@ -40,6 +40,9 @@
 Patch2:         fcitx-4.2.7-compat-qt474.patch
 # fix-for-openSUSE [email protected] - fix gcc 4.6 builds
 Patch3:         fcitx-4.2.7-compat-gcc46.patch
+# fix-for-openSUSE [email protected] - xkeyboard-config in SUSE use symlink for 
xkb rule files,
+# which caused fcitx unexpected behavior in keyboard layout handling.
+Patch4:         bnc801318-fcitx-4.2.7-xkb-rule-symlink-detection.patch
 BuildRequires:  cairo-devel
 %if 0%{?suse_version}
 BuildRequires:  dbus-1-devel
@@ -366,6 +369,7 @@
 %patch2 -p1
 %patch3 -p1
 %endif
+%patch4 -p1
 
 %build
 mkdir build
@@ -465,6 +469,9 @@
         popd
     done
 popd
+
+# bnc#801319 remove the unneeded fcitx-autostart.desktop which blocks ibus 
from starting.
+rm -rf %{buildroot}%{_sysconfdir}/xdg/autostart/%{name}-autostart.desktop
 %endif
 
 %if 0%{?fedora_version}
@@ -589,8 +596,8 @@
 %if 0%{?fedora_version}
 %config %{_sysconfdir}/X11/xinit/xinput.d/
 %{_docdir}/packages/%{name}/
-%endif
 %config %{_sysconfdir}/xdg/autostart/%{name}-autostart.desktop
+%endif
 
 # excludes
 %exclude %{_datadir}/%{name}/pinyin

++++++ bnc801318-fcitx-4.2.7-xkb-rule-symlink-detection.patch ++++++
diff --git a/src/module/xkb/xkb.c b/src/module/xkb/xkb.c
index d5d928d..36025bb 100644
--- a/src/module/xkb/xkb.c
+++ b/src/module/xkb/xkb.c
@@ -176,37 +176,50 @@ static char* FcitxXkbFindXkbRulesFile(FcitxXkb* xkb)
         } else {
             int count = 0, i = 0;
             const char* base = XLIBDIR;
+            char *parent_to_free = NULL;
             while (base[i]) {
                 if (base[i] == '/')
                     count++;
                 i++;
             }
 
+            /**
+             * guess X11 data base directory.
+             **/
             if (count >= 3) {
                 // .../usr/lib/X11 -> /usr/share/X11/xkb vs
                 // .../usr/X11/lib -> /usr/X11/share/X11/xkb
                 const char* delta = StringEndsWith(base, "X11") ?
                     "/../../share/X11" : "/../share/X11";
-                char *tmppath;
-                fcitx_utils_alloc_cat_str(tmppath, base, delta,
-                                          "/xkb/rules/", rulesName, ".xml");
-                if(fcitx_utils_isreg(tmppath)) {
-                    rulesFile = realpath(tmppath, NULL);
-                    free(tmppath);
-                } else {
-                    fcitx_utils_alloc_cat_str(tmppath, base, "/X11/xkb/rules/",
-                                              rulesName, ".xml");
-                    if(fcitx_utils_isreg(tmppath)) {
-                        rulesFile = realpath(tmppath, NULL);
-                        free(tmppath);
+                fcitx_utils_alloc_cat_str(parent_to_free, base, delta);
+                if(!fcitx_utils_isdir(parent_to_free)) {
+                    // fallback to ${base}/X11
+                    fcitx_utils_set_cat_str(parent_to_free, base, "/X11");
+                    if(!fcitx_utils_isdir(parent_to_free)) {
+                        free(parent_to_free);
+                        parent_to_free = NULL;
                     }
                 }
             }
-            if(!rulesFile) {
-                fcitx_utils_alloc_cat_str(rulesFile,
-                                          "/usr/share/X11/xkb/rules/",
-                                          rulesName, ".xml");
+            const char *parent_path;
+            if (parent_to_free) {
+                /**
+                 * Found a existing dir, simplify it.
+                 * Using realpath() on rules files' name can change the base
+                 * name of the file (due to symlink), so it is only safe
+                 * to do it for directory's name. T-T..
+                 **/
+                char *tmp = realpath(parent_to_free, NULL);
+                parent_path = tmp;
+                free(parent_to_free);
+                parent_to_free = tmp;
+            } else {
+                // last fallback for known rules name.
+                parent_path = "/usr/share/X11";
             }
+            fcitx_utils_alloc_cat_str(rulesFile, parent_path,
+                                      "/xkb/rules/", rulesName, ".xml");
+            fcitx_utils_free(parent_to_free);
         }
         free(rulesName);
     } else {
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to