[systemd-devel] [PATCH v2] localed: validate set-x11-keymap input
David Herrmann
dh.herrmann at gmail.com
Mon Nov 17 01:54:41 PST 2014
Hi
On Fri, Nov 14, 2014 at 12:42 PM, Jan Synacek <jsynacek at redhat.com> wrote:
> Try to validate the input similarly to how setxkbmap does it. Multiple
> layouts and variants can be specified, separated by a comma. Variants
> can also be left out, meaning that the user doesn't want any particular
> variant for the respective layout.
>
> Variants are validated respectively to their layouts. First variant
> validates against first layout, second variant to second layout, etc. If
> there are more entries of either layouts or variants, only their
> respective counterparts are validated, the rest is ignored.
>
> Examples:
> $ set-x11-keymap us,cz pc105 ,qwerty
> "us" is not validated, because no respective variant was specified. "cz"
> is checked for an existing "qwerty" variant, the check succeeds.
>
> $ set-x11-keymap us pc105 ,qwerty
> "us" is not validated as in the above example. The rest of the variants
> is ignored, because there are no respective layouts.
>
> $ set-x11-keymap us,cz pc105 qwerty
> "us" is validated against the "qwerty" variant, check fails, because
> there is no "qwerty" variant for the "us" layout.
>
> $ set-x11-keymap us,cz pc105 euro,qwerty
> Validation succeeds, there is the "euro" variant for the "us" layout,
> and "qwerty" variant for the "cz" layout.
>
> http://lists.freedesktop.org/archives/systemd-devel/2014-October/024411.html
I didn't follow the discussion on v1, but why don't we use
libxkbcommon to compile the keymap? If it doesn't compile, print an
error (or warning and maybe optionally still proceed?).
Sure, this would add a dependency to libxkbcommon for localed, but we
could make it optional. And libxkbcommon has no dependencies by
itself. Furthermore, set-x11-keymap is pretty useless without
libxkbcommon installed, anyway.
It'd be a ~10 line patch to use
xkb_context_new()+xkb_keymap_from_rmlvo(). And it would be guaranteed
to have the same semantics as the real keymap compilation.
Thanks
David
More information about the systemd-devel
mailing list