After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 613775 - Reordering keyboard layouts adds tabs to gconf keys and thus duplication
Reordering keyboard layouts adds tabs to gconf keys and thus duplication
Status: RESOLVED FIXED
Product: libgnomekbd
Classification: Core
Component: Config
2.30.x
Other Linux
: Normal normal
: ---
Assigned To: libgnomekbd maintainers
Sergey V. Udaltsov
Depends on:
Blocks:
 
 
Reported: 2010-03-24 07:57 UTC by Martin Pitt
Modified: 2010-04-19 14:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
keyboard: Fix layout gconf key initialization for empty variants (1.79 KB, patch)
2010-03-24 08:21 UTC, Martin Pitt
none Details | Review

Description Martin Pitt 2010-03-24 07:57:56 UTC
(From https://launchpad.net/bugs/460328):

There is currently an inconsistency in how g-keyboard-properties and gdm/g-s-d's $GDM_KEYBOARD_LAYOUT handle keyboard layouts without variants. gdm/gsd create them just like "us", while g-k-p creates them as "us\t" after reordering.

Reproduction:

$ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts
[de	nodeadkeys,us]

Open g-k-p, move "USA" to top

$ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts
[us	,de	nodeadkeys]

Now restart the session, or just restart gnome-settings-daemon:

$ echo $GDM_KEYBOARD_LAYOUT 
us
$ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts
[us	,de	nodeadkeys,us]
Comment 1 Martin Pitt 2010-03-24 08:10:09 UTC
Sorry, I mixed that up, bad copy&paste. It only really happens if the gconf value is empty and g-k-p initializes it.

I have two keyboard layouts configured system-wide: "us" and "de nodeadkeys":

_XKB_RULES_NAMES(STRING) = "evdev", "pc105", "de,us", "nodeadkeys,", "terminate:ctrl_alt_bksp,grp:shifts_toggle"

$ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts
[]

Open g-k-p, move "USA" to top

$ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts
[us	,de	nodeadkeys]

So this is only a problem with handling multiple keyboard layouts with empty gconf keys, and thus one aspect of the problems in bug 613666 and bug 613681.
Comment 2 Martin Pitt 2010-03-24 08:21:28 UTC
Created attachment 156948 [details] [review]
keyboard: Fix layout gconf key initialization for empty variants

With this patch, gconf keys are now consistent to g-s-d's understanding and creation of them:

$ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts
[]

... Switch layouts in g-k-p ...

$ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts
[us,de	nodeadkeys]
Comment 3 Sergey V. Udaltsov 2010-03-24 22:15:23 UTC
Martin, this is somewhat suspicions.

How happened that g-k-p creates layouts with tabs without variants? I have two layouts, us and ru. I see no tabs at all.

$ gconftool -g /desktop/gnome/peripherals/keyboard/kbd/layouts
[us,de	nodeadkeys,ru]

How could I reproduce your scenario?
Comment 4 Martin Pitt 2010-03-25 08:29:19 UTC
Sergey,

it should reproduce well with comment 1:

 - set up multiple system layouts (in Ubuntu that's in /etc/default/console-setup, Fedora has a similar file, but a different path)

 - Remove the user configuration for the layouts:

   gconftool -u /desktop/gnome/peripherals/keyboard/kbd/layouts

 - This will trigger the case in xkb_layouts_get_selected_list() where the gconf list is empty, and it reads the list of layouts from initial_config.layouts_variants (which apparently uses trailing tabs)
Comment 5 Martin Pitt 2010-03-25 08:30:02 UTC
.. sorry, hit enter too early. After that, open g-k-p and switch the layout order.
Comment 6 Sergey V. Udaltsov 2010-03-25 21:41:03 UTC
I configured console-setup to use layout us,ru, then cleaned up gconf, then rebooed. After I logged in (using gdm) I immediately got single layout 'us' in gconf (that's ok, that's g-s-d copied the value from gdm).
Then, I cleared gconf again, started g-k-p, now see two layouts (right, as configured in console-setup). Then I used drug/drop to switch layouts. It just works! No tabs in gconf - only [us,ru] :((

What do you have in your console-setup?

Also, could you please do "xprop -root | grep XKB"
Comment 7 Sebastien Bacher 2010-03-25 22:04:57 UTC
Sergey, on what version do you do the testing? lucid has the change discussed there so it's not good for testing the issue
Comment 8 Sergey V. Udaltsov 2010-03-25 22:39:50 UTC
I run it on 9.10
Comment 9 Martin Pitt 2010-03-29 07:28:21 UTC
(In reply to comment #6)

> What do you have in your console-setup?

XKBMODEL="pc105"
XKBLAYOUT="de,us"
XKBVARIANT="nodeadkeys,"
XKBOPTIONS=""

> Also, could you please do "xprop -root | grep XKB"

See comment 1:

_XKB_RULES_NAMES(STRING) = "evdev", "pc105", "de,us", "nodeadkeys,",
"terminate:ctrl_alt_bksp,grp:shifts_toggle"

The difference is that I have

  XKBVARIANT="nodeadkeys,"

I suppose libgnomekbd splits on commas and thus interprets the variant for "us" as "" instead of NULL. It does work fine with XKBLAYOUT="de,us" and XKBVARIANT="".
Comment 10 Sergey V. Udaltsov 2010-04-01 17:20:03 UTC
Actually, Martin, with your patch to #613666, did anything change in relation to this bug?
Comment 11 Martin Pitt 2010-04-06 13:36:58 UTC
(In reply to comment #10)
> Actually, Martin, with your patch to #613666, did anything change in relation
> to this bug?

Kind of. Before bug 613666 got fixed, it was impossible to have multiple keyboard layouts and an empty gconf key for the layouts. Now it is possible (and in fact the common case), which lead to exhibiting this bug here.

BTW, the 

    XKBLAYOUT="de,us"
    XKBVARIANT="nodeadkeys,"

case might still be considered debatable, since we could in theory fix installers etc. to not append a trailing comma. However, (1) we should be robust for that in control-center, and (2) we need to cope with empty (not NULL) variants in control-center anyway for the reverse case:

    XKBLAYOUT="us,de"
    XKBVARIANT=",nodeadkeys"

Here we always need the initial comma to state that "nodeadkeys" applies to the second layout, not the first.
Comment 12 Sergey V. Udaltsov 2010-04-18 18:38:09 UTC
I tried to make it simpler:

http://git.gnome.org/browse/libgnomekbd/commit/?id=9e641dbb82242a450aaabcba3b052e694fd0fadb

(actually there is unneeded debug printf, next commit drops it).

Could you please check if it fixes this bug?
Comment 13 Martin Pitt 2010-04-19 14:12:12 UTC
Confirmed, this fixes it as well. Thanks!