[PATCH libxkbcommon 1/2] makekeys: add all symbols converted to lower-case

David Herrmann dh.herrmann at googlemail.com
Mon Oct 1 12:42:19 PDT 2012


Hi Bill

Could you please avoid top-posting? It's so much easier to read
comments if they are _below_ the quoted text.

On Mon, Oct 1, 2012 at 9:11 PM, Bill Spitzak <spitzak at gmail.com> wrote:
> I think you are asking for trouble here.
>
> The biggest problem I see is that you are calling tolower() which changes
> depending on the locale. Though most software fixes this by forcing the
> locale to C, I'm not sure if that is acceptable for xkb. Please do not rely
> on anything more complicated that ASCII-only to-lower. Unicode tolower is
> extremely complex and changes over time. ISO-8859-1 tolower will require you
> to assume the text is either UTF-8 or not UTF-8, both are bad assumptions.

What are you talking about? "makekeys" is a small helper program that
is called during compilation. It does not modify the locale-settings
at all. Therefore, corresponding to POSIX, the "C" locale is set
during startup. Please see "man 3p setlocale".
This means, tolower() is working restricted to the ASCII set.
Furthermore, all input-strings to "makekeys" are C-identifiers, which
means, they're ASCII only. So if your C-library is POSIX-compliant, it
is _very_ predictable how "tolower()" is working here: According to
ASCII

And for your information, xkb_keysym_from_name() expects ASCII
compatible input (which includes UTF8) and all entries in the
hashtable are ASCII only.

Please show me an example if you think there are any charset-related problems.

> Also if the calling code adds "Foo" and makes it point to A, then decides to
> replace it with a pointer to B, the "foo" entry will still point to A.
> Probably not what is wanted.

That doesn't make any sense. There is no _calling code_. The
lookup-table is static and constant during runtime.

> Case independence is a bad idea all around for lookup in tables.

Why?

> Also not clear why users would type in any of these strings, rather than
> click on pre-defined strings, which can have the right case.

To edit configuration files. Or to pass command-line arguments.

Regards
David


More information about the wayland-devel mailing list