[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#685867: unblock: im-config/0.18



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package im-config

This will fix 
 * http://bugs.debian.org/683950
 * http://bugs.debian.org/300486
 * Fundamental X initialization sequence/timing problem for the input
   method at its root cause.

Diff is attached but git repo may be easier:
 Vcs-Git: git://git.debian.org/git/collab-maint/im-config.git
 Vcs-browser: http://git.debian.org/?p=collab-maint/im-config.git

=======================

This looks large patch but it is essentially simple minded code to
reorder X start up process in /etc/X11/Xsession.d/. (Diff attached)

Let me explain why this is needed and what is all about.

Non-european languages use input method to input their key strokes into
applications.  Its initialization is done during X start up by a hook
script provided by im-config.

There was a long standing bug in im-switch (previous version of hook
script) /im-config, where the input method hook script was executed
after the dbus hook script.  This looked good until we found out that
actual execution of dbus initialization is delayed until the last
99x11-common_start of the initialization with a tricky substitution use
of $STARTUP string.

Not knowing this was the root cause, when people had had problem getting
input method daemons started, we put some delay/waiting somewhere in the
code (sometimes daemon itself, sometimes within hook script.).  See
http://bugs.debian.org/300486 .  10 second wait implemented in im-config
was OK workaround for many system using uim but it is guaranteed to fail
on very slow system.

The bug report http://bugs.debian.org/683950 got me rethink this
initialization in /etc/X11/Xsession.d/.

Old way in 0.17:
* 50x11-common_determine-startup   STARTUP=/usr/bin/x-session-manager
* 75dbus_dbus-launch               STARTUP="$DBUSLAUNCH --exit-with-session $STARTUP"
* 80im-config_launch               starting input method daemon etc.
* 99x11-common_start               exec "$STARTUP"

New way in 0.18:
* 50x11-common_determine-startup   STARTUP="/usr/bin/x-session-manager"
* 70im-config_launch               STARTUP="/usr/bin/im-launch $STARTUP"
* 75dbus_dbus-launch               STARTUP="$DBUSLAUNCH --exit-with-session $STARTUP"
* 99x11-common_start               exec "$STARTUP"

Practically, the entire content of old 80im-config_launch is moved into
/usr/bin/im-launch where daemon is started etc.

Since there is no more need to delay uim start, delay is dropped.

Since /etc/X11/Xsession.d/*im-config_launch is conffile, I extended
the existing postinst script handling of moving such file safely.  (I
know there is another way but I tried not to make too new changes.)

==============================

unblock im-config/0.18

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (10, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5-trunk-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru im-config-0.17/70im-config_launch im-config-0.18/70im-config_launch
--- im-config-0.17/70im-config_launch	1970-01-01 09:00:00.000000000 +0900
+++ im-config-0.18/70im-config_launch	2012-08-11 15:55:23.000000000 +0900
@@ -0,0 +1,18 @@
+#!/bin/sh
+# vim: set sts=4 expandtab:
+# Copyright (C) 2012 Osamu Aoki <osamu@debian.org>
+# Copyright (C) 2012 Aron Xu <aron@debian.org>
+# GNU General Public License version 2 or later.
+#
+# Input Method launcher hook ... see im-launch(1).
+# The hook script for dbus-launch is in 75 which changes $STARTUP string.
+# This shuld be befor this dbus-launch hook to ensure the working dbus 
+# for input method.  Thus moved from 80 to 70.
+
+IMLAUNCH=/usr/bin/im-launch
+
+# Change $STARTUP string to im-launch while keeping the old $STARTUP string
+# as its arguments
+if [ -x "$IMLAUNCH" ]; then
+    STARTUP="$IMLAUNCH $STARTUP"
+fi
diff -Nru im-config-0.17/80im-config_launch im-config-0.18/80im-config_launch
--- im-config-0.17/80im-config_launch	2011-12-05 23:44:29.000000000 +0900
+++ im-config-0.18/80im-config_launch	1970-01-01 09:00:00.000000000 +0900
@@ -1,31 +0,0 @@
-#!/bin/sh
-# vim: set sts=4 expandtab: 
-# Copyright (C) 2010 Osamu Aoki <osamu@debian.org> 
-# GNU General Public License version 2 or later.
-#
-# Input Method for X, GNOME, KDE, ... see im-config(8).
-
-# If already tweaked, keep hands off :-)
-# If im-config is removed but not purged, keep hands off :-)
-if [ -z "$XMODIFIERS" ] && \
-   [ -z "$GTK_IM_MODULE" ] && \
-   [ -z "$QT_IM_MODULE" ] && \
-   [ -z "$QT4_IM_MODULE" ] && \
-   [ -z "$CLUTTER_IM_MODULE" ] && \
-   [ -r /usr/share/im-config/xinputrc.common ]; then
-    # initialize all im-config common functions and parameters
-    . /usr/share/im-config/xinputrc.common
-    # source the first found configuration file
-    if [ -r "$IM_CONFIG_XINPUTRC_USR" ]; then
-        . $IM_CONFIG_XINPUTRC_USR
-    elif [ -r "$IM_CONFIG_XINPUTRC_SYS" ]; then
-        . $IM_CONFIG_XINPUTRC_SYS
-    fi
-    # always export variables even for manual configuration.
-    export XMODIFIERS
-    export GTK_IM_MODULE
-    export QT_IM_MODULE
-    export QT4_IM_MODULE
-    export CLUTTER_IM_MODULE
-fi
-
diff -Nru im-config-0.17/data/24_uim.conf im-config-0.18/data/24_uim.conf
--- im-config-0.17/data/24_uim.conf	2011-12-25 13:22:52.000000000 +0900
+++ im-config-0.18/data/24_uim.conf	2012-08-25 10:54:06.000000000 +0900
@@ -11,6 +11,7 @@
    * Vietnamese: uim-viqr
    * General-purpose M17n: uim-m17nlib
  * Application platform support:
+   * XIM: uim-xim
    * GNOME/GTK+: uim-gtk2.0 and uim-gtk3 (both)
    * KDE/Qt4: uim-qt
    * EMACS: uim-el")"
diff -Nru im-config-0.17/data/24_uim.rc im-config-0.18/data/24_uim.rc
--- im-config-0.17/data/24_uim.rc	2012-04-26 23:44:34.000000000 +0900
+++ im-config-0.18/data/24_uim.rc	2012-08-25 11:07:35.000000000 +0900
@@ -8,14 +8,18 @@
 XMODIFIERS=@im=uim
 
 # Starting GUI
-if [ -x /usr/bin/uim-toolbar-gtk-systray ]; then
-    (sleep 10; uim-toolbar-gtk-systray) &
+if [ -x /usr/bin/uim-toolbar-gtk3-systray ]; then
+    uim-toolbar-gtk3-systray &
+elif [ -x /usr/bin/uim-toolbar-gtk3 ]; then
+    uim-toolbar-gtk3 &
+elif [ -x /usr/bin/uim-toolbar-gtk-systray ]; then
+    uim-toolbar-gtk-systray &
 elif [ -x /usr/bin/uim-toolbar-gtk ]; then
-    (sleep 10; uim-toolbar-gtk) &
+    uim-toolbar-gtk &
 elif [ -x /usr/bin/uim-toolbar-qt4 ]; then
-    (sleep 10; uim-toolbar-qt4) &
+    uim-toolbar-qt4 &
 elif [ -x /usr/bin/uim-toolbar-qt ]; then
-    (sleep 10; uim-toolbar-qt) &
+    uim-toolbar-qt &
 fi
 
 GTK_IM_MODULE=xim
diff -Nru im-config-0.17/debian/changelog im-config-0.18/debian/changelog
--- im-config-0.17/debian/changelog	2012-06-29 21:35:27.000000000 +0900
+++ im-config-0.18/debian/changelog	2012-08-25 13:39:20.000000000 +0900
@@ -1,3 +1,16 @@
+im-config (0.18) unstable; urgency=low
+
+  * Updated uim support for gtk3 and add uim-xim requirement for XIM.
+
+ -- Osamu Aoki <osamu@debian.org>  Sat, 25 Aug 2012 13:38:42 +0900
+
+im-config (0.18~pre1) experimental; urgency=low
+
+  * Inspired by Aron Xu's patch, new im-launch script was created
+    while moving its hook script to 70im-config_launch. Closes: #683950
+
+ -- Osamu Aoki <osamu@debian.org>  Sat, 11 Aug 2012 13:28:14 +0900
+
 im-config (0.17) unstable; urgency=low
 
   * Update for scim using Tz-Huan Huang' patch as its basis. 
diff -Nru im-config-0.17/debian/copyright im-config-0.18/debian/copyright
--- im-config-0.17/debian/copyright	2010-07-17 21:59:05.000000000 +0900
+++ im-config-0.18/debian/copyright	2012-08-11 15:55:23.000000000 +0900
@@ -4,7 +4,8 @@
 Source: git://git.debian.org/git/collab-maint/im-config.git
 
 Files: *
-Copyright: 2010, Osamu Aoki <osamu@debian.org>
+Copyright: 2010-2012, Osamu Aoki <osamu@debian.org>
+           2012, Aron Xu <aron@debian.org>
 License: GPL-2+
  .
  On Debian systems, the full text of the GNU General Public License
diff -Nru im-config-0.17/debian/install im-config-0.18/debian/install
--- im-config-0.17/debian/install	2011-12-25 13:22:53.000000000 +0900
+++ im-config-0.18/debian/install	2012-08-11 15:55:23.000000000 +0900
@@ -1,7 +1,8 @@
 default/im-config      etc/default
-80im-config_launch     etc/X11/Xsession.d
+70im-config_launch     etc/X11/Xsession.d
 xinputrc               etc/X11/xinit
 im-config              usr/bin
+im-launch              usr/bin
 im-config.desktop      usr/share/applications
 share/im-config.common usr/share/im-config
 share/xinputrc.common  usr/share/im-config
diff -Nru im-config-0.17/debian/manpages im-config-0.18/debian/manpages
--- im-config-0.17/debian/manpages	2010-07-17 21:59:05.000000000 +0900
+++ im-config-0.18/debian/manpages	2012-08-11 15:55:23.000000000 +0900
@@ -1 +1,2 @@
 im-config.8
+im-launch.1
diff -Nru im-config-0.17/debian/postinst im-config-0.18/debian/postinst
--- im-config-0.17/debian/postinst	2010-07-17 21:59:05.000000000 +0900
+++ im-config-0.18/debian/postinst	2012-08-11 15:55:23.000000000 +0900
@@ -4,8 +4,14 @@
 
 set -e
 
-# acb685ae9264be3fc1800f98a70b12bb  80im-switch.1.14
-# 044a2f13aa8382902dc8f47dc7da7064  80im-switch.1.16
+# version just before wheezy release
+# acb685ae9264be3fc1800f98a70b12bb  80im-switch 1.14
+# 044a2f13aa8382902dc8f47dc7da7064  80im-switch 1.16 (oldstable) - 1.22 (unstable)
+
+# 4045a8eeb0e9226cdd9f8a121ccf4c04  80im-config_launch 0.3 (stable initial)
+# 8a4829f935b5561ca6e61bec6eb3893f  80im-config_launch 0.3+squeeze1 (stable), 0.4
+# b243876a16f7b87c397ceef626098069  80im-config_launch 0.5
+# 5ef27261ac38d704d8f766da19635461  80im-config_launch 0.6-0.17 (testing, unstable)
 
 case "$1" in
     configure)
@@ -22,6 +28,19 @@
                 ;;
             esac
         fi
+        IM_CONFIG_HOOK=/etc/X11/Xsession.d/80im-config_launch
+        if [ -f $IM_CONFIG_HOOK ]; then
+            IM_CONFIG_HOOK_MD5SUM=$(md5sum < $IM_CONFIG_HOOK|cut -d ' ' -f 1)
+            case $IM_CONFIG_HOOK_MD5SUM in
+                4045a8eeb0e9226cdd9f8a121ccf4c04|8a4829f935b5561ca6e61bec6eb3893f|b243876a16f7b87c397ceef626098069|5ef27261ac38d704d8f766da19635461)
+                    rm -f $IM_CONFIG_HOOK
+                ;;
+    
+                *)
+                    echo "ERROR: Unknown hook file exists: $IM_CONFIG_HOOK." >&2
+                ;;
+            esac
+        fi
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
diff -Nru im-config-0.17/im-launch im-config-0.18/im-launch
--- im-config-0.17/im-launch	1970-01-01 09:00:00.000000000 +0900
+++ im-config-0.18/im-launch	2012-08-11 16:02:23.000000000 +0900
@@ -0,0 +1,42 @@
+#!/bin/sh
+# vim: set sts=4 expandtab:
+# Copyright (C) 2012 Osamu Aoki <osamu@debian.org>
+# Copyright (C) 2012 Aron Xu <aron@debian.org>
+# GNU General Public License version 2 or later.
+#
+# Launch input method configuration script for X, GNOME, KDE, ...
+# see im-launch(1).
+
+if [ "x$1" = "x-h" ] || [ "x$1" = "x--help" ] || [ "x$1" = "x" ]; then
+    echo "Unknown option: $1"
+    echo "Usage: $0 SESSION-PROGRAM"
+    exit 1
+fi
+
+IM_START_SESSION="$@"
+
+# If already tweaked, keep hands off :-)
+# If im-config is removed but not purged, keep hands off :-)
+if [ -z "$XMODIFIERS" ] && \
+   [ -z "$GTK_IM_MODULE" ] && \
+   [ -z "$QT_IM_MODULE" ] && \
+   [ -z "$QT4_IM_MODULE" ] && \
+   [ -z "$CLUTTER_IM_MODULE" ] && \
+   [ -r /usr/share/im-config/xinputrc.common ]; then
+    # initialize all im-config common functions and parameters
+    . /usr/share/im-config/xinputrc.common
+    # source the first found configuration file
+    if [ -r "$IM_CONFIG_XINPUTRC_USR" ]; then
+        . $IM_CONFIG_XINPUTRC_USR
+    elif [ -r "$IM_CONFIG_XINPUTRC_SYS" ]; then
+        . $IM_CONFIG_XINPUTRC_SYS
+    fi
+    # always export variables even for manual configuration.
+    export XMODIFIERS
+    export GTK_IM_MODULE
+    export QT_IM_MODULE
+    export QT4_IM_MODULE
+    export CLUTTER_IM_MODULE
+fi
+
+exec $IM_START_SESSION
diff -Nru im-config-0.17/im-launch.1 im-config-0.18/im-launch.1
--- im-config-0.17/im-launch.1	1970-01-01 09:00:00.000000000 +0900
+++ im-config-0.18/im-launch.1	2012-08-11 15:55:23.000000000 +0900
@@ -0,0 +1,34 @@
+.TH IM\-LAUNCH 1
+.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
+.\" other parms are allowed: see man(7), man(1)
+.SH NAME
+im\-launch \- launch input method end execute session program
+.SH SYNOPSIS
+.TP
+.B im\-launch \fISESSION\-PROGRAM\fP
+
+.SH DESCRIPTION
+
+The \fBim\-launch\fP command is used to start a input method framework server
+daemon such as \fBibus\-daemon\fP, set up the appropriate environment variables
+for the client programs, and execute \fISESSION\-PROGRAM\fP such as
+\fBx\-session\-manager\fP.
+
+This command is usually not invoked from the console of a normal user but 
+is normally invoked by the \fB/etc/X11/Xsession.d/70im-config_launch\fP.
+
+.SH "TROUBLESHOOT"
+If you have any problem, see the first part of \fB~/.xsession-errors\fP and
+look for the cause.  If you are running \fBim\-config\fP while Debian (sid)
+system is undergoing a major library transition, you may need to manually set
+up \fB~/.xinputrc\fP with adjusted library version number etc.  Please file a
+bug report to the im\-config package using reportbug(1) describing your
+resolution experience.
+
+.SH "SEE ALSO"
+.BR im-config(8),
+.BR /usr/share/doc/im\-config/README.Debian.gz
+.SH AUTHOR
+This manual page was written by Aron Xu <aron@debian.org>, and Osamu
+Aoki <osamu@debian.org> for the Debian GNU/Linux system (but may be used
+by others).

Reply to: