Bug 65352 - xkl_engine_get_num_groups() returns 2 when only 1 layout is configured
Summary: xkl_engine_get_num_groups() returns 2 when only 1 layout is configured
Status: RESOLVED NOTOURBUG
Alias: None
Product: libxklavier
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other OpenBSD
: medium normal
Assignee: Sergey V. Udaltsov
QA Contact: Sergey V. Udaltsov
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-04 13:43 UTC by Landry Breuil
Modified: 2013-06-17 08:48 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
testcase (1.05 KB, text/plain)
2013-06-04 13:49 UTC, Landry Breuil
Details
test_config with start_listen call added (1.11 KB, text/plain)
2013-06-05 01:00 UTC, Landry Breuil
Details

Description Landry Breuil 2013-06-04 13:43:02 UTC
On OpenBSD, using the xkb panel plugin (or just a small testcase code) xkl_engine_get_num_groups() returns 2 when only one layout is configured, which leads to crashs in the xkb plugin.
Comment 1 Landry Breuil 2013-06-04 13:44:41 UTC
The linked xfce bug has a reduced testcase, showing the problem
Comment 2 Landry Breuil 2013-06-04 13:49:01 UTC
Created attachment 80291 [details]
testcase

With two layouts

$./test_config 
[1370353612,000,test_config.c:main/]    original layouts: fr et 
xkl_engine_get_next_group returned 1
xkl_engine_get_num_groups returned 2

With only one layout

$./test_config 
[1370353639,000,test_config.c:main/]    original layouts: fr 
xkl_engine_get_next_group returned 1
xkl_engine_get_num_groups returned 2
Comment 3 Sergey V. Udaltsov 2013-06-04 22:32:57 UTC
There is a bug in the code. You should use xkl_engine_start_listen in order to initialize some internal state variables.
Comment 4 Landry Breuil 2013-06-04 22:40:22 UTC
Exact same behaviour if i call xkl_engine_start_listen in the test case, and the xfce4-xkb panel plugin already does the right thing and calls it too.

[1370385502,000,test_config.c:main/]    original layouts: fr 
xkl_engine_get_next_group returned 1
xkl_engine_get_num_groups returned 2
Comment 5 Sergey V. Udaltsov 2013-06-04 22:49:44 UTC
Could you attach the updated code pls?
Comment 6 Landry Breuil 2013-06-05 01:00:13 UTC
Created attachment 80316 [details]
test_config with start_listen call added
Comment 7 Sergey V. Udaltsov 2013-06-05 22:41:41 UTC
Just tried. Works fine for me:
xkl_engine_get_next_group returned 0
xkl_engine_get_num_groups returned 1

Would you pls execute before test_config:

export XKL_DEBUG=200
Comment 8 Landry Breuil 2013-06-08 16:48:41 UTC
renton:/usr/obj/ports/libxklavier-5.3/libxklavier-5.3/ $XKL_DEBUG=200 tests/test_config                                           
GLib-GObject-Message: g_type_init_with_debug_flags() is no longer supported.  Use the GOBJECT_DEBUG environment variable.
[1370710042,150,xklavier.c:xkl_engine_one_switch_to_secondary_group_performed/]         Resetting allow_one_switch_to_secondary_group flag
[1370710042,150,xklavier.c:xkl_engine_constructor/]     Trying all backends:
[1370710042,150,xklavier.c:xkl_engine_constructor/]     Trying XKB backend
[1370710042,160,xklavier_xkb.c:xkl_xkb_init/]   xkbEvenType: 61, xkbError: 9F, display: 0x148fc1039000, root: 7b
[1370710042,100,xklavier_config_xkb.c:xkl_xkb_multiple_layouts_supported/]      !!! Checking multiple layouts support
[1370710042,100,xklavier_config.c:xkl_engine_get_ruleset_name/]         Rules set: [base]
[1370710042,160,xklavier_config_xkb.c:xkl_rules_set_load/]      Loading rules from [/usr/X11R6/share/X11/xkb//rules/base]
[1370710042,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   keymap: (null)
[1370710042,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   keycodes: xfree86+aliases(qwerty)
[1370710042,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   compat: complete
[1370710042,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   types: complete
[1370710042,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   symbols: pc+us+inet(pc105)+terminate(ctrl_alt_bksp)+de:2
[1370710042,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   geometry: pc(pc105)
[1370710042,100,xklavier_config_xkb.c:xkl_xkb_multiple_layouts_supported/]      !!! Multiple layouts ARE supported
[1370710042,150,xklavier_xkb.c:xkl_xkb_init/]   XInputExtension found (142, 78, 151) version 2.2
[1370710042,200,xklavier_xkb.c:xkl_xkb_init/]   DevicePresence available
[1370710042,150,xklavier.c:xkl_engine_constructor/]     Actual backend: XKB
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  found 2 groups
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Group 1 has name [English (US)]
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Group 0 has name [-]
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[31] is Caps Lock
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[30] is Num Lock
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[29] is Scroll Lock
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[28] is Shift Lock
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[27] is Group 2
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[26] is Mouse Keys
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[25] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[24] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[23] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[22] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[21] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[20] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[19] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[18] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[17] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[16] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[15] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[14] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[13] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[12] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[11] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[10] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[9] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[8] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[7] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[6] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[5] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[4] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[3] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[2] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[1] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[0] is 
[1370710042,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Real indicators are 7
[1370710042,150,xklavier.c:xkl_engine_resume_listen/]   Resume listening, listenerType: (XKLL_TRACK_KEYBOARD_STATE )
[1370710042,160,xklavier.c:xkl_engine_select_input/]    Someone is looking for 480000 on root window ***
[1370710042,160,xklavier.c:xkl_engine_load_window_tree/]        initially focused: 1600005, 'NULL'
[1370710042,150,xklavier_toplevel.c:xkl_engine_get_toplevel_window_state/]      Appwin 1600004, '1 - landry@renton (ttyp0) - /usr' does not have state
[1370710042,160,xklavier.c:xkl_engine_load_window_tree/]        initial toplevel: 1600004, '1 - landry@renton (ttyp0) - /usr' without state -1/FFFFFFFF
[1370710042,000,test_config.c:main/]    original layouts: us 
xkl_engine_get_next_group returned 1
xkl_engine_get_num_groups returned 2

There indeed seems to be an empty broken '-' group ?
Comment 9 Sergey V. Udaltsov 2013-06-08 21:44:29 UTC
exactly. Something is wrong with your XKB initialization. Can you reproduce on some other OS?
Comment 10 Landry Breuil 2013-06-09 13:38:49 UTC
(In reply to comment #9)
> exactly. Something is wrong with your XKB initialization. Can you reproduce
> on some other OS?

I don't use other OSes..
Comment 11 Sergey V. Udaltsov 2013-06-09 13:41:42 UTC
Could you try any Linux Live CD?

For a moment it looks like OpenBSD-specific issue with X server, and I am not sure libxklavier is to blame...
Comment 12 Landry Breuil 2013-06-09 19:30:18 UTC
Just for the record on another machine (netbook with azerty kbd)

GLib-GObject-Message: g_type_init_with_debug_flags() is no longer supported.  Use the GOBJECT_DEBUG environment variable.
[1370806118,150,xklavier.c:xkl_engine_one_switch_to_secondary_group_performed/]         Resetting allow_one_switch_to_secondary
_group flag
[1370806118,150,xklavier.c:xkl_engine_constructor/]     Trying all backends:
[1370806118,150,xklavier.c:xkl_engine_constructor/]     Trying XKB backend
[1370806118,160,xklavier_xkb.c:xkl_xkb_init/]   xkbEvenType: 55, xkbError: 89, display: 0x887c46b0, root: ab
[1370806118,100,xklavier_config_xkb.c:xkl_xkb_multiple_layouts_supported/]      !!! Checking multiple layouts support
[1370806118,100,xklavier_config.c:xkl_engine_get_ruleset_name/]         Rules set: [base]
[1370806118,160,xklavier_config_xkb.c:xkl_rules_set_load/]      Loading rules from [/usr/X11R6/share/X11/xkb//rules/base]
[1370806118,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   keymap: (null)
[1370806118,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   keycodes: xfree86+aliases(qwerty)
[1370806118,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   compat: complete
[1370806118,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   types: complete
[1370806118,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   symbols: pc+us+inet(pc105)+terminate(ctrl_alt_bksp)+de:
2
[1370806118,200,xklavier_config_xkb.c:xkl_xkb_config_native_prepare/]   geometry: pc(pc105)
[1370806118,100,xklavier_config_xkb.c:xkl_xkb_multiple_layouts_supported/]      !!! Multiple layouts ARE supported
[1370806118,150,xklavier_xkb.c:xkl_xkb_init/]   XInputExtension found (131, 66, 129) version 2.3
[1370806118,200,xklavier_xkb.c:xkl_xkb_init/]   DevicePresence available
[1370806118,150,xklavier.c:xkl_engine_constructor/]     Actual backend: XKB
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  found 2 groups
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Group 1 has name [French]
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Group 0 has name [-]
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[31] is Caps Lock
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[30] is Num Lock
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[29] is Scroll Lock
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[28] is Shift Lock
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[27] is Group 2
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[26] is Mouse Keys
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[25] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[24] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[23] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[22] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[21] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[20] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[19] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[18] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[17] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[16] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[15] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[14] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[13] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[12] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[11] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[10] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[9] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[8] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[7] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[6] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[5] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[4] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[3] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[2] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[1] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Indicator[0] is 
[1370806118,200,xklavier_xkb.c:xkl_xkb_load_all_info/]  Real indicators are 7
[1370806118,150,xklavier.c:xkl_engine_resume_listen/]   Resume listening, listenerType: (XKLL_TRACK_KEYBOARD_STATE )
[1370806118,160,xklavier.c:xkl_engine_select_input/]    Someone is looking for 480000 on root window ***
[1370806118,160,xklavier.c:xkl_engine_load_window_tree/]        initially focused: 1c00005, 'NULL'
[1370806118,150,xklavier_toplevel.c:xkl_engine_get_toplevel_window_state/]      Appwin 1c00004, 'begbie:2:test_config - begbie.
ho' does not have state
[1370806118,160,xklavier.c:xkl_engine_load_window_tree/]        initial toplevel: 1c00004, 'begbie:2:test_config - begbie.ho' w
ithout state -1/FFFFFFFF
[1370806118,000,test_config.c:main/]    original layouts: fr 
xkl_engine_get_next_group returned 1
xkl_engine_get_num_groups returned 2

I have someone looking into our x keyboard stuff to see what local problem might be the cause.
Comment 13 Landry Breuil 2013-06-17 08:48:08 UTC
There was indeed an issue in our xkeyboard-config which got fixed here : http://anoncvs.estpak.ee/cgi-bin/cgit/openbsd-xenocara/commit/?id=2f8d51879902baee2bf0746167f352d4dc1f2c08


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.