im-config hangs if LC_CTYPE does not have quotes

Bug #1431862 reported by Nobuto Murata
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
im-config (Ubuntu)
Fix Released
High
Aron Xu

Bug Description

If LC_CTYPE does not have any quotes, regex does not hit, then im-config hangs at the point below.

/usr/share/im-config/xinputrc.common
     92 IM_CONFIG_LC_CTYPE=$(locale | sed -nr 's/LC_CTYPE=\"([a-zA-Z_]*).*\"/\1/p')
     93 IM_CONFIG_SCRIPT=$(grep $IM_CONFIG_LC_CTYPE $IM_CONFIG_LC_PREFS | grep -v '^#' | awk '{print $2}')

$ cat ~/.pam_environment
LC_CTYPE=ja_JP.UTF-8
LC_PAPER=ja_JP.UTF-8
LC_MEASUREMENT=ja_JP.UTF-8
PAPERSIZE=a4

$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE=ja_JP.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=ja_JP.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=ja_JP.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

$ bash -x /usr/bin/im-config
+ . /usr/share/im-config/xinputrc.common
++ IM_CONFIG_VERSION=0.27-1ubuntu3
++ IM_CONFIG_DATA=/usr/share/im-config/data
++ IM_CONFIG_LC_PREFS=/usr/share/im-config/locale_prefs.conf
++ IM_CONFIG_XINPUTRC_USR=/home/nobuto/.xinputrc
++ IM_CONFIG_XINPUTRC_SYS=/etc/X11/xinit/xinputrc
++ IM_CONFIG_DEFAULT=/etc/default/im-config
++ . gettext.sh
+++ test 'X\t' = 'X\t'
+++ echo=echo
+++ test -z ''
+++ case "$0" in
++ TEXTDOMAIN=im-config
++ export TEXTDOMAIN
++ TEXTDOMAINDIR=/usr/share/locale/
++ export TEXTDOMAINDIR
++ '[' -r /etc/default/im-config ']'
++ . /etc/default/im-config
+++ IM_CONFIG_DEFAULT_MODE=auto
++ id -u
+ '[' 1000 = 0 ']'
+ IM_CONFIG_XINPUTRC=/home/nobuto/.xinputrc
++ gettext 'user configuration'
+ IM_CONFIG_XINPUTRC_TYPE='user configuration'
++ automatic_im
++ '[' -r /usr/share/im-config/locale_prefs.conf ']'
+++ locale
+++ sed -nr 's/LC_CTYPE=\"([a-zA-Z_]*).*\"/\1/p'
++ IM_CONFIG_LC_CTYPE=
+++ grep /usr/share/im-config/locale_prefs.conf
+++ awk '{print $2}'

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: im-config 0.27-1ubuntu3
ProcVersionSignature: Ubuntu 3.19.0-9.9-generic 3.19.1
Uname: Linux 3.19.0-9-generic x86_64
ApportVersion: 2.16.2-0ubuntu3
Architecture: amd64
CurrentDesktop: Unity
Date: Fri Mar 13 22:26:12 2015
EcryptfsInUse: Yes
InstallationDate: Installed on 2015-02-28 (12 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Alpha amd64 (20150228)
PackageArchitecture: all
SourcePackage: im-config
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Nobuto Murata (nobuto) wrote :
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Hi Nobuto,

So it wasn't so theoretical, after all. ;) One way to fix it is to change line 92 in /usr/share/im-config/xinputrc.common to:

IM_CONFIG_LC_CTYPE=$(locale | sed -nr 's/LC_CTYPE=\"?([a-zA-Z_]*).*/\1/p')

Changed in im-config (Ubuntu):
assignee: nobody → Aron Xu (happyaron)
importance: Undecided → High
status: New → Triaged
Revision history for this message
Aron Xu (happyaron) wrote :

Applied the fix of adding ? mark.

Changed in im-config (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package im-config - 0.27-1ubuntu6

---------------
im-config (0.27-1ubuntu6) vivid; urgency=medium

  * Handle the situation that LC_CTYPE is set through variable
    (LP: #1431862)
 -- Aron Xu <email address hidden> Sat, 14 Mar 2015 18:04:35 +0800

Changed in im-config (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Not sufficient, Aron. You need to remove the trailing quote also.

Changed in im-config (Ubuntu):
status: Fix Released → Triaged
Revision history for this message
Aron Xu (happyaron) wrote :

Missed it, now fixed.

Changed in im-config (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package im-config - 0.27-1ubuntu7

---------------
im-config (0.27-1ubuntu7) vivid; urgency=medium

  * Handle the situation that LC_CTYPE is set through variable
    (LP: #1431862)
 -- Aron Xu <email address hidden> Sun, 15 Mar 2015 07:04:35 +0800

Changed in im-config (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.