You are not logged in.

#1 2017-07-30 19:36:02

doodoo
Member
Registered: 2017-01-13
Posts: 4

[SOLVED][i3lock] xkb_compose_table_new_from_locale failed

each time i run i3lock I get this error:
xkbcommon: ERROR: Couldn't read Compose file /usr/share/X11/locale/: No such device
[i3lock] xkb_compose_table_new_from_locale failed

i3lock works fine, but this messages are annoying


The directory exist and it owned by:

$ pacman -Qo /usr/share/X11/locale/
/usr/share/X11/locale/ is owned by libx11 1.6.5-1

Its content is:

$ ls /usr/share/X11/locale/
am_ET.UTF-8  compose.dir  en_US.UTF-8       georgian-ps  isiri-3342  iso8859-11  iso8859-15  iso8859-4  iso8859-7  iso8859-9e  ja_JP.UTF-8  ko      koi8-u        locale.dir        microsoft-cp1256  pt_BR.UTF-8  sr_CS.UTF-8  th_TH.UTF-8  vi_VN.viscii   zh_CN.gbk    zh_HK.big5hkscs  zh_TW.big5
armscii-8    cs_CZ.UTF-8  fi_FI.UTF-8       ibm-cp1133   iso8859-1   iso8859-13  iso8859-2   iso8859-5  iso8859-8  ja          ja.SJIS      koi8-c  ko_KR.UTF-8   microsoft-cp1251  mulelao-1         pt_PT.UTF-8  tatar-cyr    tscii-0      zh_CN          zh_CN.UTF-8  zh_HK.UTF-8      zh_TW.UTF-8
C            el_GR.UTF-8  georgian-academy  iscii-dev    iso8859-10  iso8859-14  iso8859-3   iso8859-6  iso8859-9  ja.JIS      km_KH.UTF-8  koi8-r  locale.alias  microsoft-cp1255  nokhchi-1         ru_RU.UTF-8  th_TH        vi_VN.tcvn   zh_CN.gb18030  zh_HK.big5   zh_TW

My locale is

$ echo $LANG
en_US.UTF-8

looking the i3lock source code

/*
 * Loads the XKB compose table from the given locale.
 *
 */
static bool load_compose_table(const char *locale) {
    xkb_compose_table_unref(xkb_compose_table);

    if ((xkb_compose_table = xkb_compose_table_new_from_locale(xkb_context, locale, 0)) == NULL) {
        fprintf(stderr, "[i3lock] xkb_compose_table_new_from_locale failed\n");
        return false;
    }

    struct xkb_compose_state *new_compose_state = xkb_compose_state_new(xkb_compose_table, 0);
    if (new_compose_state == NULL) {
        fprintf(stderr, "[i3lock] xkb_compose_state_new failed\n");
        return false;
    }

    xkb_compose_state_unref(xkb_compose_state);
    xkb_compose_state = new_compose_state;

    return true;
}

and xkb_compose_table_new_from_locale


What I understand is i3lock call xkb_compose_table_new_from_locale with en_US.UTF-8 and it fails but I can't understand why there is no such device


Some other infos

$ pacman -Ss xkbcommon
extra/libxkbcommon 0.7.1-1 [installed]
    Keymap handling library for toolkits and window systems
extra/libxkbcommon-x11 0.7.1-1 [installed]
$ locale
LANG=en_US.UTF-8
LC_CTYPE=
LC_NUMERIC=
LC_TIME=
LC_COLLATE=
LC_MONETARY=
LC_MESSAGES=
LC_PAPER=
LC_NAME=
LC_ADDRESS=
LC_TELEPHONE=
LC_MEASUREMENT=
LC_IDENTIFICATION=
LC_ALL=
$ localectl 
   System Locale: LANG=en_US.UTF-8
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc104
     X11 Variant: alt-intl
$ locale -a
C
en_US.utf8
it_IT.utf8
POSIX

Any suggestions?

thanks

Last edited by doodoo (2017-08-13 16:58:59)

Offline

#2 2017-08-04 18:29:33

bluetech
Member
Registered: 2007-10-26
Posts: 7

Re: [SOLVED][i3lock] xkb_compose_table_new_from_locale failed

What happens if you compile (gcc -lxkbcommon compose.c) and run (./a.out) this program?

#include <stdlib.h>
#include <assert.h>

#include <xkbcommon/xkbcommon-compose.h>


int main(void) {
    const char *locale = getenv("LC_ALL");
    if (!locale)
        locale = getenv("LC_CTYPE");
    if (!locale)
        locale = getenv("LANG");
    if (!locale) {
        locale = "C";
    }

    printf("locale: %s\n", locale);

    struct xkb_context *ctx = xkb_context_new(0);
    assert(ctx);
    struct xkb_compose_table *table = xkb_compose_table_new_from_locale(ctx, locale, 0);
    printf("table: %p\n", table);

    return 0;
}

Offline

#3 2017-08-13 11:54:53

doodoo
Member
Registered: 2017-01-13
Posts: 4

Re: [SOLVED][i3lock] xkb_compose_table_new_from_locale failed

I'm really sorry for the delay. Here the output of your program.

locale: 
xkbcommon: ERROR: Couldn't read Compose file /usr/share/X11/locale/: No such device
table: (nil)

thanks

Offline

#4 2017-08-13 12:42:48

bluetech
Member
Registered: 2007-10-26
Posts: 7

Re: [SOLVED][i3lock] xkb_compose_table_new_from_locale failed

It looks like one of the environment variables `LC_ALL`, `LC_CTYPE`, `LANG` is set to the empty string.

In the terminal from which you get this output above, what is the output of the command `env`?

Offline

#5 2017-08-13 12:44:23

bluetech
Member
Registered: 2007-10-26
Posts: 7

Re: [SOLVED][i3lock] xkb_compose_table_new_from_locale failed

Please note, the output may contain sensitive details, so maybe better not paste it here. I'm only interested in the lines containing the names I quoted above (or lack thereof).

Offline

#6 2017-08-13 13:24:33

doodoo
Member
Registered: 2017-01-13
Posts: 4

Re: [SOLVED][i3lock] xkb_compose_table_new_from_locale failed

bluetech wrote:

Please note, the output may contain sensitive details, so maybe better not paste it here. I'm only interested in the lines containing the names I quoted above (or lack thereof).

$ env
LC_MEASUREMENT=
LC_PAPER=
LC_MONETARY=
LANG=en_US.UTF-8
DISPLAY=:0
OLDPWD=/mnt/usb
COLORTERM=rxvt
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
XDG_VTNR=1
LC_NAME=
XDG_SESSION_ID=c1
LC_COLLATE=
LC_CTYPE=
LC_ADDRESS=
LC_NUMERIC=
DESKTOP_STARTUP_ID=i3/i3-sensible-terminal/1155-0-bishop_TIME1004280
_JAVA_OPTIONS=-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dsun.java2d.opengl=true
WINDOWPATH=1
TERM=rxvt-unicode-256color
SHELL=/bin/bash
LC_MESSAGES=
JAVA_FONTS=/usr/share/fonts/TTF
COLORFGBG=7;default
XDG_SEAT=seat0
SHLVL=4
LANGUAGE=
WINDOWID=10485771
LC_TELEPHONE=
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
XDG_RUNTIME_DIR=/run/user/1000
LC_IDENTIFICATION=
LC_TIME=
_=/usr/bin/env

Offline

#7 2017-08-13 14:54:47

bluetech
Member
Registered: 2007-10-26
Posts: 7

Re: [SOLVED][i3lock] xkb_compose_table_new_from_locale failed

LC_MEASUREMENT=
LC_PAPER=
LC_MONETARY=
LC_COLLATE=
LC_CTYPE=
LC_ADDRESS=
LC_NUMERIC=
LC_MESSAGES=
LC_TELEPHONE=
LC_IDENTIFICATION=
LC_TIME=

This is the problem; these environment variables should be set to `en_US.UTF-8`, or not be set at all.

A little research shows a recent bug in systemd which causes this:  https://github.com/systemd/systemd/issues/6407

Debian had reverted the commit in systemd which caused this: https://bugs.debian.org/cgi-bin/bugrepo … bug=868695

I hope it will be fixed in the next version of systemd.

I will also fix libxkbcommon so that it recommends to treat the empty string the same as unset.

In the mean time you can add `export LC_ALL=en_US.UTF-8` to your `.bashrc` and it will probably work.

Offline

#8 2017-08-13 15:58:34

doodoo
Member
Registered: 2017-01-13
Posts: 4

Re: [SOLVED][i3lock] xkb_compose_table_new_from_locale failed

thanks @bluetech your suggestion solved the problem.

Offline

Board footer

Powered by FluxBB