setxkbmap -I /usr/local/share/X11/xkb broken

Bug #1556295 reported by Charles Lindsey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
x11-xkb-utils (Ubuntu)
New
Undecided
Unassigned

Bug Description

x11-xkb-utils 7.7+1 (as supplied with Ubuntu 14.04 - Trusty)

setxkbmap -I /usr/local/share/X11/xkb should search first in /usr/local/share/X11/xkb, and if not found then search in /usr/share/X11/xkb
Instead, it appears to search first in the current directory, and then in /usr/share/X11/xkb

To reproduce, set up some file in /usr/local/share/X11/xkb/rules. For example, I created a modified version of evdev with
$ diff /usr/share/X11/xkb/rules/evdev /usr/local/share/X11/xkb/rules/evdev
247c247,248
< * $sun_custom $sun_var = pc+sun_vndr/%l%(v)
---
> ! * $sun_custom $sun_var = pc+sun_vndr/%l%(v)
> $sun gb mod3 = pc+gb(mod3)
332c333,334
< $sun $sun_custom = pc+sun_vndr/%l%(v)
---
> ! $sun $sun_custom = pc+sun_vndr/%l%(v)
> $sun gb pc+gb%(v)

Then
$ cd /usr/local/share/X11/xkb/
$ setxkbmap -query -v 10 -model sun_type6_unix_usb -layout gb -variant mod3
Setting verbose level to 10
locale is C
Warning! Multiple definitions of keyboard model
         Using command line, ignoring X server
Warning! Multiple definitions of keyboard layout
         Using command line, ignoring X server
Warning! Multiple definitions of layout variant
         Using command line, ignoring X server
Trying to load rules file ./rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: sun_type6_unix_usb
layout: gb
variant: mod3
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+gb(mod3)+inet(evdev)
geometry: sun(type6unix)
rules: evdev
model: sun_type6_unix_usb
layout: gb
variant: mod3

Observe the "symbols: pc+gb(mod3)+inet(evdev)" which is exactly what I wanted (clearly I had also to set up a suitably hacked symbols/gb file)

Now try the following from the home directory, which ought to have produced the same result:

$ cd
$ setxkbmap -I /usr/local/share/X11/xkb -query -v 10 -model sun_type6_unix_usb -layout gb -variant mod3
Setting verbose level to 10
locale is C
Warning! Multiple definitions of keyboard model
         Using command line, ignoring X server
Warning! Multiple definitions of keyboard layout
         Using command line, ignoring X server
Warning! Multiple definitions of layout variant
         Using command line, ignoring X server
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules: evdev
model: sun_type6_unix_usb
layout: gb
variant: mod3
Trying to build keymap using the following components:
keycodes: evdev+aliases(qwerty)
types: complete
compat: complete
symbols: pc+sun_vndr/gb(mod3)+inet(evdev)
geometry: sun(type6unix)
rules: evdev
model: sun_type6_unix_usb
layout: gb
variant: mod3

Evidently it was 'Trying to load rules file /usr/share/X11/xkb/rules/evdev...', but clearly it was still using the rules/evdev from /usr/share/X11/xkb (all of which can be confirmed by running both attempts with 'strace -e trace=open ...)

Note that there is some disagreement between the manpage and the -help as to whether there should be a space after the '-I'. The bug arises with and without that space. So this is a subsidiary bug in the -help, which ought to be fixed.

Note also that it thinks that it is in the 'C' locale, whereas I actually use 'en_GB.UTF-8'. This is another subsidiary bug; I have verified using gdb that there is no relevant call of 'getenv'.

Note also that is -I <directory> of xkbcomp appears to work correctly.

Share and Enjoy!

Revision history for this message
Charles Lindsey (chl-z) wrote :

I am not quite sure what rules.evdev.lst does, but it certainly gets read by setxkbmap. So to reproduce the bug you may need

$ diff /usr/share/X11/xkb/rules/evdev.lst /usr/local/share/X11/xkb/rules/evdev.lst
659a660
> mod3 gb: Mod3 modifier

which I omitted to mention in my report above.

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.