Bug 78804

Summary: Xutf8LookupString fails in UTF-8 locale if X server lacks XKB support
Product: [Retired] Red Hat Linux Reporter: Markus Kuhn <mgk25>
Component: XFree86Assignee: Mike A. Harris <mharris>
Status: CLOSED ERRATA QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: medium    
Version: 8.0CC: mitr
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://www.cl.cam.ac.uk/~mgk25/ucs/xev-adiaeresis-utf8.txt
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-12-15 10:27:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Xfree86 patch 5513 by Ivan Pascal <pascal@info.tsu.ru> none

Description Markus Kuhn 2002-11-30 20:42:18 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827

Description of problem:
Xutf8LookupString performs an unnecessary ISO 8859-1 -> UTF-8 translation,
thereby corrupting keyboard input data. This happens only if the X client runs
on Red Hat 8.0 in a UTF-8 locale *and* the X server does not have XKB activated,
is for example the case by default with the Solaris 5.8 X server.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Use an X server with XKB disabled
2. LC_ALL=en_GB.UTF-8 xterm (with correct ISO10646-1 fonts)
3. If you have no non-ASCII keysym on your keyboard (e.g., you have US
keyboard), then map with xmodmap a keysym such as adiaeresis) onto
a key and press it in the xterm.
	

Actual Results:  The application in the xterm receives the UTF-8 sequence for
the keystream as if it had been passed unnecessarily through a ISO 8859-1 ->
UTF-8 converter.

Expected Results:  The correct UTF-8 sequence should have been received and the
correct character appear on the screen (d).

Additional info:

This bug was located on 2002-11-29 by Ivan Pascal (pascal.ru),
explained the same day on the i18n mailing list and fixed in patch
number 5513 sent to XFree86.Org:

--- xc/lib/X11/XKB.c.orig	Fri Nov 29 11:13:59 2002
+++ xc/lib/X11/XKB.c		Fri Nov 29 11:16:16 2002
@@ -417,9 +417,10 @@
     unsigned	values;
 #endif
 {
-    if ((dpy->flags & XlibDisplayNoXkb) ||
-	(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
-	return False;
+	if (!dpy->xkb_info)
+	   XkbUseExtension(dpy,NULL,NULL);
+	if (!dpy->xkb_info)
+	   return 0;
     affect&= XkbLC_AllControls;
     dpy->xkb_info->xlib_ctrls&= ~affect;
     dpy->xkb_info->xlib_ctrls|= (affect&values);
@@ -434,9 +435,10 @@
     Display *	dpy;
 #endif
 {
-    if ((dpy->flags & XlibDisplayNoXkb) ||
-	(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
-	return 0;
+	if (!dpy->xkb_info)
+	   XkbUseExtension(dpy,NULL,NULL);
+	if (!dpy->xkb_info)
+	   return 0;
     return dpy->xkb_info->xlib_ctrls;
 }



For more information, see the thread "XFree86 Xutf8LookupString BUG with Solarix
X server" started by myself on 2002-11-28 on i18n.

Comment 1 Mike A. Harris 2002-12-06 15:20:52 UTC
Please attach the patch as a file attachment.  Cut and pasted patches
always get munged in bugzilla.

Comment 2 Mike A. Harris 2002-12-06 15:23:00 UTC
Oh, I forgot to mention...   I'll put this into my next erratum for 8.0
which will be 4.2.1 based.

Thanks.

Comment 3 Markus Kuhn 2002-12-06 15:28:29 UTC
Created attachment 87665 [details]
Xfree86 patch 5513 by Ivan Pascal <pascal.ru>

Comment 4 Mike A. Harris 2002-12-15 10:27:00 UTC
Thanks Markus.  Patch applied to my 4.2.1-9.6 build.  Will be in
future erratum release.  This should probably be commited to the
xf-4_2-branch by someone with CVS write permission also.

Closing as ERRATA, as it will be public when errata is released.