diff -Nru libxkbcommon-1.3.1/debian/changelog libxkbcommon-1.4.0/debian/changelog --- libxkbcommon-1.3.1/debian/changelog 2021-10-20 09:27:11.000000000 +0000 +++ libxkbcommon-1.4.0/debian/changelog 2022-02-11 12:53:42.000000000 +0000 @@ -1,3 +1,10 @@ +libxkbcommon (1.4.0-1) unstable; urgency=medium + + * New upstream release. + * control: Bump debhelper-compat to 13, policy to 4.6.0. + + -- Timo Aaltonen Fri, 11 Feb 2022 14:53:42 +0200 + libxkbcommon (1.3.1-1) unstable; urgency=medium * New upstream release. diff -Nru libxkbcommon-1.3.1/debian/control libxkbcommon-1.4.0/debian/control --- libxkbcommon-1.3.1/debian/control 2021-10-20 09:24:40.000000000 +0000 +++ libxkbcommon-1.4.0/debian/control 2022-02-11 12:44:01.000000000 +0000 @@ -4,7 +4,7 @@ Maintainer: Debian X Strike Force Uploaders: Michael Stapelberg Build-Depends: - debhelper-compat (= 12), + debhelper-compat (= 13), bison, dh-exec, doxygen, @@ -21,7 +21,7 @@ x11proto-dev, xkb-data , xvfb , -Standards-Version: 4.5.0 +Standards-Version: 4.6.0 Homepage: http://www.xkbcommon.org/ Vcs-Git: https://salsa.debian.org/xorg-team/lib/libxkbcommon.git Vcs-Browser: https://salsa.debian.org/xorg-team/lib/libxkbcommon diff -Nru libxkbcommon-1.3.1/.github/workflows/github-release.yml libxkbcommon-1.4.0/.github/workflows/github-release.yml --- libxkbcommon-1.3.1/.github/workflows/github-release.yml 2021-09-10 19:53:38.533190300 +0000 +++ libxkbcommon-1.4.0/.github/workflows/github-release.yml 2022-02-04 10:41:50.000000000 +0000 @@ -29,4 +29,4 @@ body: | See the [NEWS](https://github.com/xkbcommon/libxkbcommon/blob/master/NEWS) file for the changes. - Official tarball: https://xkbcommon.org/download/lib${{ github.ref }}.tar.xz + Official tarball: https://xkbcommon.org/download/lib${GITHUB_REF#refs/tags/}.tar.xz diff -Nru libxkbcommon-1.3.1/.github/workflows/linux.yml libxkbcommon-1.4.0/.github/workflows/linux.yml --- libxkbcommon-1.3.1/.github/workflows/linux.yml 1970-01-01 00:00:00.000000000 +0000 +++ libxkbcommon-1.4.0/.github/workflows/linux.yml 2022-02-04 10:41:50.000000000 +0000 @@ -0,0 +1,39 @@ +name: linux + +on: [push, pull_request] + +# Set permissions at the job level. +permissions: {} + +jobs: + linux: + runs-on: ubuntu-20.04 + permissions: + contents: read + strategy: + matrix: + compiler: [clang, gcc] + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade meson + sudo apt install -y \ + doxygen libxcb-xkb-dev valgrind ninja-build \ + libwayland-dev wayland-protocols bison graphviz + - name: Setup + run: | + meson setup build + env: + CC: ${{ matrix.compiler }} + - name: Build + run: | + meson compile -C build + - name: Test + run: + meson test -C build --print-errorlogs --setup=valgrind --no-suite python-tests diff -Nru libxkbcommon-1.3.1/.github/workflows/macos.yml libxkbcommon-1.4.0/.github/workflows/macos.yml --- libxkbcommon-1.3.1/.github/workflows/macos.yml 1970-01-01 00:00:00.000000000 +0000 +++ libxkbcommon-1.4.0/.github/workflows/macos.yml 2022-02-04 10:41:50.000000000 +0000 @@ -0,0 +1,40 @@ +name: macos + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# Set permissions at the job level. +permissions: {} + +jobs: + macos: + runs-on: macos-10.15 + permissions: + contents: read + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade meson + brew install libxml2 doxygen bison ninja + brew link bison --force + env: + HOMEBREW_NO_AUTO_UPDATE: 1 + HOMEBREW_NO_INSTALL_CLEANUP: 1 + - name: Setup + run: | + PATH="/usr/local/opt/bison/bin:${PATH}" meson setup -Denable-wayland=false -Denable-x11=false build + - name: Build + run: | + PATH="/usr/local/opt/bison/bin:${PATH}" meson compile -C build + - name: Test + run: + meson test -C build --print-errorlogs diff -Nru libxkbcommon-1.3.1/.github/workflows/main.yml libxkbcommon-1.4.0/.github/workflows/main.yml --- libxkbcommon-1.3.1/.github/workflows/main.yml 2021-09-10 19:53:38.533190300 +0000 +++ libxkbcommon-1.4.0/.github/workflows/main.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -name: CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -# Set permissions at the job level. -permissions: {} - -jobs: - linux: - runs-on: ubuntu-20.04 - permissions: - contents: read - strategy: - matrix: - compiler: [clang, gcc] - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install dependencies - run: | - python -m pip install --upgrade meson - sudo apt install -y \ - doxygen libxcb-xkb-dev valgrind ninja-build \ - libwayland-dev wayland-protocols bison graphviz - - name: Setup - run: | - meson setup build - env: - CC: ${{ matrix.compiler }} - - name: Build - run: | - meson compile -C build - - name: Test - run: - meson test -C build --print-errorlogs --setup=valgrind --no-suite python-tests - - macos: - runs-on: macos-10.15 - permissions: - contents: read - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install dependencies - run: | - python -m pip install --upgrade meson - brew install libxml2 doxygen bison ninja - brew link bison --force - env: - HOMEBREW_NO_AUTO_UPDATE: 1 - HOMEBREW_NO_INSTALL_CLEANUP: 1 - - name: Setup - run: | - PATH="/usr/local/opt/bison/bin:${PATH}" meson setup -Denable-wayland=false -Denable-x11=false build - - name: Build - run: | - PATH="/usr/local/opt/bison/bin:${PATH}" meson compile -C build - - name: Test - run: - meson test -C build --print-errorlogs - - windows: - runs-on: windows-2019 - permissions: - contents: read - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - uses: actions/setup-python@v2 - with: - python-version: '3.9' - - name: Install dependencies - shell: powershell - run: | - python -m pip install --upgrade meson - Invoke-WebRequest -Uri https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-win.zip -OutFile ninja.zip - Invoke-WebRequest -Uri https://github.com/lexxmark/winflexbison/releases/download/v2.5.23/win_flex_bison-2.5.23.zip -OutFile win_flex_bison.zip - Expand-Archive -Path win_flex_bison.zip -DestinationPath bin - Expand-Archive -Path ninja.zip -DestinationPath bin - Write-Output ((Get-Location).ToString() + "./bin") | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - name: Setup - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - meson setup -Denable-wayland=false -Denable-x11=false -Denable-docs=false -Denable-xkbregistry=false build - env: - CC: cl - - name: Build - shell: cmd - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 - meson compile -C build - - name: Test - run: - meson test -C build --print-errorlogs diff -Nru libxkbcommon-1.3.1/.github/workflows/windows.yml libxkbcommon-1.4.0/.github/workflows/windows.yml --- libxkbcommon-1.3.1/.github/workflows/windows.yml 1970-01-01 00:00:00.000000000 +0000 +++ libxkbcommon-1.4.0/.github/workflows/windows.yml 2022-02-04 10:41:50.000000000 +0000 @@ -0,0 +1,47 @@ +name: windows + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# Set permissions at the job level. +permissions: {} + +jobs: + windows: + runs-on: windows-2019 + permissions: + contents: read + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install dependencies + shell: powershell + run: | + python -m pip install --upgrade meson + Invoke-WebRequest -Uri https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-win.zip -OutFile ninja.zip + Invoke-WebRequest -Uri https://github.com/lexxmark/winflexbison/releases/download/v2.5.23/win_flex_bison-2.5.23.zip -OutFile win_flex_bison.zip + Expand-Archive -Path win_flex_bison.zip -DestinationPath bin + Expand-Archive -Path ninja.zip -DestinationPath bin + Write-Output ((Get-Location).ToString() + "./bin") | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + - name: Setup + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + meson setup -Denable-wayland=false -Denable-x11=false -Denable-docs=false -Denable-xkbregistry=false build + env: + CC: cl + - name: Build + shell: cmd + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + meson compile -C build + - name: Test + run: + meson test -C build --print-errorlogs diff -Nru libxkbcommon-1.3.1/meson.build libxkbcommon-1.4.0/meson.build --- libxkbcommon-1.3.1/meson.build 2021-09-10 19:53:38.536523600 +0000 +++ libxkbcommon-1.4.0/meson.build 2022-02-04 10:41:50.000000000 +0000 @@ -1,7 +1,7 @@ project( 'libxkbcommon', 'c', - version: '1.3.1', + version: '1.4.0', default_options: [ 'c_std=c11', 'warning_level=2', @@ -125,8 +125,6 @@ else message('C library does not support secure_getenv, using getenv instead') endif -have_getopt_long = cc.has_header_symbol('getopt.h', 'getopt_long', - prefix: '#define _GNU_SOURCE') if not cc.has_header_symbol('limits.h', 'PATH_MAX', prefix: system_ext_define) if host_machine.system() == 'windows' # see https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation @@ -406,7 +404,7 @@ man_pages = [] # Tools -build_tools = have_getopt_long +build_tools = get_option('enable-tools') and cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE') if build_tools libxkbcommon_tools_internal = static_library( 'tools-internal', diff -Nru libxkbcommon-1.3.1/meson_options.txt libxkbcommon-1.4.0/meson_options.txt --- libxkbcommon-1.3.1/meson_options.txt 2021-09-10 19:53:38.536523600 +0000 +++ libxkbcommon-1.4.0/meson_options.txt 2022-02-04 10:41:50.000000000 +0000 @@ -44,6 +44,12 @@ description: 'Default XKB options', ) option( + 'enable-tools', + type: 'boolean', + value: true, + description: 'Enable building tools', +) +option( 'enable-x11', type: 'boolean', value: true, @@ -59,7 +65,7 @@ 'enable-wayland', type: 'boolean', value: true, - description: 'Enable support for Wayland utility programs', + description: 'Enable support for Wayland utility programs (requires enable-tools)', ) option( 'enable-xkbregistry', diff -Nru libxkbcommon-1.3.1/NEWS libxkbcommon-1.4.0/NEWS --- libxkbcommon-1.3.1/NEWS 2021-09-10 19:53:38.533190300 +0000 +++ libxkbcommon-1.4.0/NEWS 2022-02-04 10:41:50.000000000 +0000 @@ -1,3 +1,29 @@ +libxkbcommon 1.4.0 - 2022-02-04 +================== + +- Add `enable-tools` option to Meson build (on by default) to allow disabling + the `xkbcli` tools. + + Contributed by Alex Xu (Hello71). + +- In `xkbcli list`, fix "YAML Norway problem" in output. + + Contributed by Peter Hutterer. + +- In libxkbregistry, variants now inherit iso639, iso3166 and brief from parent + layout if omitted. + + Contributed by M Hickford. + +- In libxkbregistry, don't call `xmlCleanupParser()` - it's not supposed to + be called by libraries. + + Contributed by Peter Hutterer. + +- In libxkbregistry, skip over invalid ISO-639 or ISO-3166 entries. + + Contributed by Peter Hutterer. + libxkbcommon 1.3.1 - 2021-09-10 ================== diff -Nru libxkbcommon-1.3.1/README.md libxkbcommon-1.4.0/README.md --- libxkbcommon-1.3.1/README.md 2021-09-10 19:53:38.533190300 +0000 +++ libxkbcommon-1.4.0/README.md 2022-02-04 10:41:50.000000000 +0000 @@ -15,6 +15,7 @@ meson setup build ninja -C build + ninja -C build test # Run the tests. To build for use with Wayland, you can disable X11 support while still using the X11 keyboard configuration resource files thusly: diff -Nru libxkbcommon-1.3.1/src/registry.c libxkbcommon-1.4.0/src/registry.c --- libxkbcommon-1.3.1/src/registry.c 2021-09-10 19:53:38.543190200 +0000 +++ libxkbcommon-1.4.0/src/registry.c 2022-02-04 10:41:50.000000000 +0000 @@ -808,6 +808,11 @@ char *str = extract_text(node); struct rxkb_object *parent; + if (!str || strlen(str) != 3) { + free(str); + continue; + } + parent = &layout->base; code = rxkb_iso639_code_create(parent); code->code = str; @@ -827,6 +832,11 @@ char *str = extract_text(node); struct rxkb_object *parent; + if (!str || strlen(str) != 2) { + free(str); + continue; + } + parent = &layout->base; code = rxkb_iso3166_code_create(parent); code->code = str; @@ -860,7 +870,8 @@ v->name = strdup(l->name); v->variant = name; v->description = description; - v->brief = brief; + // if variant omits brief, inherit from parent layout. + v->brief = brief == NULL ? strdup_safe(l->brief) : brief; v->popularity = popularity; list_append(&ctx->layouts, &v->base.link); @@ -870,11 +881,35 @@ if (!is_node(ci, "configItem")) continue; + bool found_language_list = false; + bool found_country_list = false; for (node = ci->children; node; node = node->next) { - if (is_node(node, "languageList")) + if (is_node(node, "languageList")) { parse_language_list(node, v); - if (is_node(node, "countryList")) + found_language_list = true; + } + if (is_node(node, "countryList")) { parse_country_list(node, v); + found_country_list = true; + } + } + if (!found_language_list) { + // inherit from parent layout + struct rxkb_iso639_code* x; + list_for_each(x, &l->iso639s, base.link) { + struct rxkb_iso639_code* code = rxkb_iso639_code_create(&v->base); + code->code = strdup(x->code); + list_append(&v->iso639s, &code->base.link); + } + } + if (!found_country_list) { + // inherit from parent layout + struct rxkb_iso3166_code* x; + list_for_each(x, &l->iso3166s, base.link) { + struct rxkb_iso3166_code* code = rxkb_iso3166_code_create(&v->base); + code->code = strdup(x->code); + list_append(&v->iso3166s, &code->base.link); + } } } } else { @@ -1197,7 +1232,6 @@ success = true; error: xmlFreeDoc(doc); - xmlCleanupParser(); return success; } diff -Nru libxkbcommon-1.3.1/test/registry.c libxkbcommon-1.4.0/test/registry.c --- libxkbcommon-1.3.1/test/registry.c 2021-09-10 19:53:38.563190200 +0000 +++ libxkbcommon-1.4.0/test/registry.c 2022-02-04 10:41:50.000000000 +0000 @@ -56,6 +56,8 @@ const char *variant; const char *brief; const char *description; + const char *iso639[3]; /* language list (iso639 three letter codes), 3 is enough for our test */ + const char *iso3166[3]; /* country list (iso3166 two letter codes), 3 is enough for our tests */ }; struct test_option { @@ -76,7 +78,9 @@ const char *name, const char *vendor, const char *brief, - const char *description) + const char *description, + const char * const iso639[3], + const char * const iso3166[3]) { fprintf(fp, " \n" " %s\n", name); @@ -86,6 +90,27 @@ fprintf(fp, " %s\n", description); if (vendor) fprintf(fp, " %s\n", vendor); + if (iso3166 && iso3166[0]) { + fprintf(fp, " \n"); + for (int i = 0; i < 3; i++) { + const char *iso = iso3166[i]; + if (!iso) + break; + fprintf(fp, " %s\n", iso); + } + fprintf(fp, " \n"); + } + if (iso639 && iso639[0]) { + fprintf(fp, " \n"); + for (int i = 0; i < 3; i++) { + const char *iso = iso639[i]; + if (!iso) + break; + fprintf(fp, " %s\n", iso); + } + fprintf(fp, " \n"); + } + fprintf(fp, " \n"); } @@ -131,7 +156,7 @@ for (const struct test_model *m = test_models; m->name; m++) { fprintf(fp, "\n"); - fprint_config_item(fp, m->name, m->vendor, NULL, m->description); + fprint_config_item(fp, m->name, m->vendor, NULL, m->description, NULL, NULL); fprintf(fp, "\n"); } fprintf(fp, "\n"); @@ -149,14 +174,13 @@ while (l->name) { fprintf(fp, "\n"); - fprint_config_item(fp, l->name, NULL, l->brief, l->description); + fprint_config_item(fp, l->name, NULL, l->brief, l->description, l->iso639, l->iso3166); if (next->name && streq(next->name, l->name)) { fprintf(fp, "\n"); do { fprintf(fp, "\n"); - fprint_config_item(fp, next->variant, NULL, next->brief, - next->description); + fprint_config_item(fp, next->variant, NULL, next->brief, next->description, next->iso639, next->iso3166); fprintf(fp, "\n"); l = next; next++; @@ -175,10 +199,10 @@ for (const struct test_option_group *g = test_groups; g->name; g++) { fprintf(fp, "\n", g->allow_multiple_selection ? "true" : "false"); - fprint_config_item(fp, g->name, NULL, NULL, g->description); + fprint_config_item(fp, g->name, NULL, NULL, g->description, NULL, NULL); for (const struct test_option *o = g->options; o->name; o++) { fprintf(fp, " \n"); } fprintf(fp, "\n"); @@ -443,6 +467,9 @@ static bool cmp_layouts(struct test_layout *tl, struct rxkb_layout *l) { + struct rxkb_iso3166_code *iso3166 = NULL; + struct rxkb_iso639_code *iso639 = NULL; + if (!tl || !l) return false; @@ -458,6 +485,36 @@ if (!streq_null(tl->description, rxkb_layout_get_description(l))) return false; + iso3166 = rxkb_layout_get_iso3166_first(l); + for (size_t i = 0; i < sizeof(tl->iso3166); i++) { + const char *iso = tl->iso3166[i]; + if (iso == NULL && iso3166 == NULL) + break; + + if (!streq_null(iso, rxkb_iso3166_code_get_code(iso3166))) + return false; + + iso3166 = rxkb_iso3166_code_next(iso3166); + } + + if (iso3166 != NULL) + return false; + + iso639 = rxkb_layout_get_iso639_first(l); + for (size_t i = 0; i < sizeof(tl->iso639); i++) { + const char *iso = tl->iso639[i]; + if (iso == NULL && iso639 == NULL) + break; + + if (!streq_null(iso, rxkb_iso639_code_get_code(iso639))) + return false; + + iso639 = rxkb_iso639_code_next(iso639); + } + + if (iso639 != NULL) + return false; + return true; } @@ -563,6 +620,7 @@ struct test_layout system_layouts[] = { {"l1", NO_VARIANT, "lbrief1", "ldesc1"}, {"l1", "v1", "vbrief1", "vdesc1"}, + {"l1", "v2", NULL, "vdesc2"}, {NULL}, }; struct test_option_group system_groups[] = { @@ -597,6 +655,11 @@ assert(cmp_layouts(&system_layouts[1], l)); rxkb_layout_unref(l); + l = fetch_layout(ctx, "l1", "v2"); + struct test_layout expected = {"l1", "v2", "lbrief1", "vdesc2"}; + assert(cmp_layouts(&expected, l)); + rxkb_layout_unref(l); + g = fetch_option_group(ctx, "grp1"); assert(cmp_option_groups(&system_groups[0], g, CMP_EXACT)); rxkb_option_group_unref(g); @@ -609,6 +672,107 @@ } static void +test_load_languages(void) +{ + struct test_model system_models[] = { + {"m1", "vendor1", "desc1"}, + {NULL}, + }; + struct test_layout system_layouts[] = { + {"l1", NO_VARIANT, "lbrief1", "ldesc1", + .iso639 = { "abc", "def" }, + .iso3166 = { "uv", "wx" }}, + {"l1", "v1", "vbrief1", "vdesc1", + .iso639 = {"efg"}, + .iso3166 = {"yz"}}, + {"l2", NO_VARIANT, "lbrief1", "ldesc1", + .iso639 = { "hij", "klm" }, + .iso3166 = { "op", "qr" }}, + {"l2", "v2", "lbrief1", "ldesc1", + .iso639 = { NULL }, /* inherit from parent */ + .iso3166 = { NULL }}, /* inherit from parent */ + {NULL}, + }; + struct test_option_group system_groups[] = { + {"grp1", "gdesc1", true, + { {"grp1:1", "odesc11"}, {"grp1:2", "odesc12"} } }, + { NULL }, + }; + struct rxkb_context *ctx; + struct rxkb_layout *l; + struct rxkb_iso3166_code *iso3166; + struct rxkb_iso639_code *iso639; + + ctx = test_setup_context(system_models, NULL, + system_layouts, NULL, + system_groups, NULL); + + l = fetch_layout(ctx, "l1", NO_VARIANT); + assert(cmp_layouts(&system_layouts[0], l)); + rxkb_layout_unref(l); + + l = fetch_layout(ctx, "l1", "v1"); + assert(cmp_layouts(&system_layouts[1], l)); + rxkb_layout_unref(l); + + l = fetch_layout(ctx, "l2", "v2"); + iso3166 = rxkb_layout_get_iso3166_first(l); + assert(streq(rxkb_iso3166_code_get_code(iso3166), "op")); + iso3166 = rxkb_iso3166_code_next(iso3166); + assert(streq(rxkb_iso3166_code_get_code(iso3166), "qr")); + + iso639 = rxkb_layout_get_iso639_first(l); + assert(streq(rxkb_iso639_code_get_code(iso639), "hij")); + iso639 = rxkb_iso639_code_next(iso639); + assert(streq(rxkb_iso639_code_get_code(iso639), "klm")); + + rxkb_layout_unref(l); + rxkb_context_unref(ctx); +} + +static void +test_load_invalid_languages(void) +{ + struct test_model system_models[] = { + {"m1", "vendor1", "desc1"}, + {NULL}, + }; + struct test_layout system_layouts[] = { + {"l1", NO_VARIANT, "lbrief1", "ldesc1", + .iso639 = { "ab", "def" }, + .iso3166 = { "uvw", "xz" }}, + {NULL}, + }; + struct test_option_group system_groups[] = { + {"grp1", "gdesc1", true, + { {"grp1:1", "odesc11"}, {"grp1:2", "odesc12"} } }, + { NULL }, + }; + struct rxkb_context *ctx; + struct rxkb_layout *l; + struct rxkb_iso3166_code *iso3166; + struct rxkb_iso639_code *iso639; + + ctx = test_setup_context(system_models, NULL, + system_layouts, NULL, + system_groups, NULL); + + l = fetch_layout(ctx, "l1", NO_VARIANT); + /* uvw is invalid, we expect 2 letters, verify it was ignored */ + iso3166 = rxkb_layout_get_iso3166_first(l); + assert(streq(rxkb_iso3166_code_get_code(iso3166), "xz")); + assert(rxkb_iso3166_code_next(iso3166) == NULL); + + /* ab is invalid, we expect 3 letters, verify it was ignored */ + iso639 = rxkb_layout_get_iso639_first(l); + assert(streq(rxkb_iso639_code_get_code(iso639), "def")); + assert(rxkb_iso639_code_next(iso639) == NULL); + rxkb_layout_unref(l); + + rxkb_context_unref(ctx); +} + +static void test_popularity(void) { struct test_layout system_layouts[] = { @@ -849,6 +1013,8 @@ test_load_full(); test_load_merge(); test_load_merge_no_overwrite(); + test_load_languages(); + test_load_invalid_languages(); test_popularity(); return 0; diff -Nru libxkbcommon-1.3.1/test/tool-option-parsing.py libxkbcommon-1.4.0/test/tool-option-parsing.py --- libxkbcommon-1.3.1/test/tool-option-parsing.py 2021-09-10 19:53:38.566523600 +0000 +++ libxkbcommon-1.4.0/test/tool-option-parsing.py 2022-02-04 10:41:50.000000000 +0000 @@ -100,7 +100,7 @@ for testfunc, reason in self.skipError: if testfunc(rc, stdout, stderr): raise unittest.SkipTest(reason) - assert rc == 0, (stdout, stderr) + assert rc == 0, (rc, stdout, stderr) return stdout, stderr def run_command_invalid(self, args): diff -Nru libxkbcommon-1.3.1/tools/registry-list.c libxkbcommon-1.4.0/tools/registry-list.c --- libxkbcommon-1.3.1/tools/registry-list.c 2021-09-10 19:53:38.566523600 +0000 +++ libxkbcommon-1.4.0/tools/registry-list.c 2022-02-04 10:41:50.000000000 +0000 @@ -140,11 +140,12 @@ m = rxkb_model_first(ctx); assert(m); /* Empty model list is usually a bug or a bad xml file */ while (m) { + const char *vendor = rxkb_model_get_vendor(m); printf("- name: %s\n" " vendor: %s\n" " description: %s\n", rxkb_model_get_name(m), - rxkb_model_get_vendor(m), + vendor ? vendor : "''", rxkb_model_get_description(m)); m = rxkb_model_next(m); } @@ -159,12 +160,12 @@ const char *variant = rxkb_layout_get_variant(l); const char *brief = rxkb_layout_get_brief(l); - printf("- layout: %s\n" - " variant: %s\n" - " brief: %s\n" + printf("- layout: '%s'\n" + " variant: '%s'\n" + " brief: '%s'\n" " description: %s\n", rxkb_layout_get_name(l), - variant ? variant : "''", + variant ? variant : "", brief ? brief : "''", rxkb_layout_get_description(l)); @@ -173,7 +174,7 @@ if (iso639) { const char *sep = ""; while (iso639) { - printf("%s%s", sep, rxkb_iso639_code_get_code(iso639)); + printf("%s'%s'", sep, rxkb_iso639_code_get_code(iso639)); iso639 = rxkb_iso639_code_next(iso639); sep = ", "; } @@ -184,7 +185,7 @@ if (iso3166) { const char *sep = ""; while (iso3166) { - printf("%s%s", sep, rxkb_iso3166_code_get_code(iso3166)); + printf("%s'%s'", sep, rxkb_iso3166_code_get_code(iso3166)); iso3166 = rxkb_iso3166_code_next(iso3166); sep = ", "; } @@ -199,7 +200,7 @@ while (g) { struct rxkb_option *o; - printf("- name: %s\n" + printf("- name: '%s'\n" " description: %s\n" " allows_multiple: %s\n" " options:\n", diff -Nru libxkbcommon-1.3.1/tools/xkbcli-list.1 libxkbcommon-1.4.0/tools/xkbcli-list.1 --- libxkbcommon-1.3.1/tools/xkbcli-list.1 2021-09-10 19:53:38.569857000 +0000 +++ libxkbcommon-1.4.0/tools/xkbcli-list.1 2022-02-04 10:41:50.000000000 +0000 @@ -1,4 +1,4 @@ -.Dd July 27, 2020 +.Dd November 1, 2021 .Dt XKBCLI\-LIST 1 .Os . @@ -11,11 +11,11 @@ .Op Pa /path/to/xkbbase Oo Pa /path/to/xkbbase Oc ... . .Sh DESCRIPTION -.Nm -is a commandline tool to list available model, layout, variant and option (MLVO) values from the XKB registry. +List available model, layout, variant and option (MLVO) values from the XKB registry. +The output is in YAML 1.2 format. . .Pp -Positional arguments provided on the commandline are treated as XKB base directory installations. +Positional arguments are treated as XKB base directory installations. . .Bl -tag -width Ds .It Fl \-help