On Sat, Oct 29, 2005 at 05:25:00PM +0100, Martin Orr wrote:
> First some observations about reproducing this bug.  If
> charset "iso-8859-7"
> is added as the first line of the provided keymap, loadkeys accepts it.
> This is why the gr-utf8 keymap in console-tools works - it has a
> charset line at the top.
> 
> Now why the bug happens.
> The 430_read_keymaps_fmt patch, added in 0.2.3dbs-57, introduces the
> prefer_unicode variable in lib/ksyms.c.  This variable is used instead
> of checking whether the console is in UTF-8 mode; however it is never
> set anywhere.  If this variable is unconditionally set to 1, the keymap
> supplied by the reporter is loaded correctly.
> 
> However setting prefer_unicode either to 1 or 0 unconditionally is
> presumably not the correct behaviour.  It should be 1 iff the console is
> in UTF-8 mode or the user specified the -u flag.  Since
> kbdtools/loadkeys.c calls set_charset("unicode") in either of these
> cases, set_charset would appear to be the place to set the
> prefer_unicode variable.
> 
> The following patch does that:
> diff -Naru2 console-tools-0.2.3.orig/lib/ksyms.c 
> console-tools-0.2.3/lib/ksyms.c
> --- console-tools-0.2.3.orig/lib/ksyms.c        2005-10-29
> 17:06:31.000000000 +0100
> +++ console-tools-0.2.3/lib/ksyms.c     2005-10-29 17:07:45.000000000 +0100
> @@ -1669,6 +1669,9 @@
>         int i;
> 
> -       if (!strcasecmp(charset, "unicode"))
> +       if (!strcasecmp(charset, "unicode")) {
> +               prefer_unicode = 1;
>                 return 0;
> +       }
> +       prefer_unicode = 0;
> 
>         for (i = 1; i < sizeof(charsets)/sizeof(charsets[0]); i++) {

You are fully right.  I applied a very similar patch for the kbd package,
but it looks like the 430_read_keymaps_fmt patch I sent to Alastair was
buggy (or maybe I fixed kbd after sending it, I do not remember).

Denis


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to