Your message dated Sun, 6 Dec 2009 22:45:08 +0900 with message-id <[email protected]> and subject line $XIM_PROGRAM_SETS_ITSELF_AS_DAEMON created has caused the Debian Bug report #442318, regarding im-switch: IME running status support to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 442318: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=442318 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---Package: im-switch Version: 1.14 Severity: normal VINE's setime (/usr/share/vine/imelib) is interesting which may give idea for avoiding duplicated start of IME by im-switch initiated scripts. For example for set up IME with SCIM, first next function is run setSCIM() { XMODIFIERS="@im=SCIM" GTK_IM_MODULE=scim QT_IM_MODULE=scim rpm -q --quiet scim-qtimm || QT_IM_MODULE=xim export XMODIFIERS GTK_IM_MODULE QT_IM_MODULE startScim checkKinput2Mod && kinput2ctl stop return 0 } In here, startScim(){ if [ -z "`pidofmyproc scim-launcher`" ] ; then scim -d >& /dev/null fi TK_KCPROTO=xim } Here pidofmyproc checks existing of scim-launcher and if it s not there, it runs SCIM in daemon mode. pidofmyproc is defined in /usr/share/vine/functions (a variant of /etc/init.d/functions). Here are the relevant portions: pidofproc() { # Test syntax. if [ $# = 0 ] ; then echo "Usage: pidofproc {program}" return 1 fi # First try "/var/run/*.pid" files if [ -f /var/run/$1.pid ] ; then pid=`head -1 /var/run/$1.pid` if [ "$pid" != "" ] ; then echo $pid return 0 fi fi # Next try "pidof" pid=`/sbin/pidof $1` if [ "$pid" != "" ] ; then echo $pid return 0 fi # Finally try to extract it from ps ps auxw | awk 'BEGIN { prog=ARGV[1]; ARGC=1 } { if ((prog == $11) || (("(" prog ")") == $11) || ((prog ":") == $11)) { print $2 ; exit 0 } }' $1 } pidofmyproc() { # Test syntax. if [ $# = 0 ] ; then echo "Usage: ownofproc {program}" return 1 fi # Next try "pidof" pid=`pidofproc $1` if [ "$pid" != "" ] ; then for i in $pid; do user=`ps h -o user --pid $i` if [ "${user}" = "${USER}" ]; then echo -n $i" " fi done echo return 0 fi } I do not see the license for these script in the header but Miquel van Smoorenburg is listed as the part of upstream. In Debian there is pidof command by him. This is binary used above too. Then I find the /lib/lsb/init-functions which has a bit diferent but similar looking: pidofproc. pidofproc () { local pidfile line i pids= status specified pid pidfile= specified= OPTIND=1 while getopts p: opt ; do case "$opt" in p) pidfile="$OPTARG"; specified=1;; esac done shift $(($OPTIND - 1)) if [ -z "${pidfile:-}" ]; then pidfile=/var/run/${1##*/}.pid fi if [ -f "$pidfile" ]; then read pid < "$pidfile" if [ -n "${pid:-}" ]; then if $(kill -0 "${pid:-}" 2> /dev/null); then echo "$pid" return 0 else return 1 # program is dead and /var/run pid file exists fi fi fi if [ -x /bin/pidof -a ! "$specified" ]; then /bin/pidof -o %PPID $1 status="$?" [ "$status" = 1 ] && return 3 # program is not running return 0 fi return 4 # program or service is unknown } I was wondering -o here and -o omitpid Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof program, in other words the calling shell or shell script. Since SCIM do not use PID file thing, simple pidof maybe more than enough. In this case, using safer long option and local l_pid l_user pid=$(/bin/pidof $1) if [ -n "$l_pid" ] ; then for i in $l_pid; do l_user=$(ps --no-headers -o user --pid $i) if [ "${l_user}" = "${USER}" ]; then echo -n $i" " fi done echo return 0 fi Since we only use this to check existing process owned by the user, this may be even more simplified. Oh well, ... later im-switch handles only 3 IME controling parameters. XMODIFIERS XIM GTK_IM_MODULE QT_IM_MODULE It may be a good idea to add few more variables like VINE has in its imeset script: TK_KCPROTO=htt EMACS_IME ... -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.22-2-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash im-switch depends on no packages. Versions of packages im-switch recommends: ii x11-common 1:7.2-5 X Window System (X.Org) infrastruc -- no debconf information
--- End Message ---
--- Begin Message ---package im-switch found 431294 1.14 notfound 431294 1.15 thanks I kept this open until scim was fixed. I think lenny (1.16) is in good shape whle sarge (1.14) was affected. Let me close this prepping for squeeze. im-switch (1.15) unstable; urgency=low * To fix Bug #431294 for SCIM, new variable is introduced to control im-switch behavior: $XIM_PROGRAM_SETS_ITSELF_AS_DAEMON * Fixed display of "*" for current selection of ~/.xinput.d/* . * Added default-xim by Teemu Likonen (closes: Bug#457421) -- Osamu Aoki <[email protected]> Sat, 22 Dec 2007 23:23:50 +0900 Osamu
--- End Message ---

