Date: Friday, November 24, 2017 @ 09:51:10 Author: heftig Revision: 310774
2.1.2-2 Added: enchant/trunk/0001-voikko-Avoid-crashing-when-there-are-no-languages.patch Modified: enchant/trunk/PKGBUILD --------------------------------------------------------------+ 0001-voikko-Avoid-crashing-when-there-are-no-languages.patch | 46 ++++++++++ PKGBUILD | 12 +- 2 files changed, 55 insertions(+), 3 deletions(-) Added: 0001-voikko-Avoid-crashing-when-there-are-no-languages.patch =================================================================== --- 0001-voikko-Avoid-crashing-when-there-are-no-languages.patch (rev 0) +++ 0001-voikko-Avoid-crashing-when-there-are-no-languages.patch 2017-11-24 09:51:10 UTC (rev 310774) @@ -0,0 +1,46 @@ +From 5d1257041e6e84b16ee9adc8d1ec6495adc26103 Mon Sep 17 00:00:00 2001 +Message-Id: <5d1257041e6e84b16ee9adc8d1ec6495adc26103.1511516301.git.jan.steff...@gmail.com> +From: "Jan Alexander Steffens (heftig)" <jan.steff...@gmail.com> +Date: Fri, 24 Nov 2017 10:34:01 +0100 +Subject: [PATCH] voikko: Avoid crashing when there are no languages + +voikko_provider_list_dicts returned NULL in this case. Fix this and use +voikkoListSupportedSpellingLanguages directly, which always returns a +valid pointer and also avoids copying. +--- + providers/enchant_voikko.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/providers/enchant_voikko.c b/providers/enchant_voikko.c +index 7af9db4c18580872..d6df8baa9a49c859 100644 +--- a/providers/enchant_voikko.c ++++ b/providers/enchant_voikko.c +@@ -111,16 +111,19 @@ static int + voikko_provider_dictionary_exists (struct str_enchant_provider * me _GL_UNUSED_PARAMETER, + const char *const tag) + { +- size_t i, n_dicts; +- char ** existing_dicts = voikko_provider_list_dicts (NULL, &n_dicts); ++ size_t i; ++ int exists = 0; ++ char ** voikko_langs = voikkoListSupportedSpellingLanguages (NULL); + +- for (i = 0; existing_dicts[i] != NULL; i++) { +- if (strncmp (tag, existing_dicts[i], strlen (tag)) == 0) { +- return 1; ++ for (i = 0; voikko_langs[i] != NULL; i++) { ++ if (strncmp (tag, voikko_langs[i], strlen (tag)) == 0) { ++ exists = 1; ++ break; + } + } ++ voikkoFreeCstrArray(voikko_langs); + +- return 0; ++ return exists; + } + + static EnchantDict * +-- +2.15.0 + Modified: PKGBUILD =================================================================== --- PKGBUILD 2017-11-24 07:03:32 UTC (rev 310773) +++ PKGBUILD 2017-11-24 09:51:10 UTC (rev 310774) @@ -5,7 +5,7 @@ pkgname=enchant pkgver=2.1.2 -pkgrel=1 +pkgrel=2 pkgdesc="A wrapper library for generic spell checking" arch=('x86_64') url="https://abiword.github.io/enchant/" @@ -13,8 +13,10 @@ depends=('aspell' 'hunspell' 'hspell' 'libvoikko' 'glib2') makedepends=('git') _commit=9889e6350eb645feca2b0c061f719ca4188984d5 # tags/v2.1.2 -source=("git+https://github.com/AbiWord/enchant.git#commit=$_commit") -sha256sums=('SKIP') +source=("git+https://github.com/AbiWord/enchant.git#commit=$_commit" + 0001-voikko-Avoid-crashing-when-there-are-no-languages.patch) +sha256sums=('SKIP' + 'b30f9ff749a050515a4eb39686b2e3e5e7f2bc84eff26b3611fe3885785166ec') pkgver() { cd $pkgname @@ -23,6 +25,10 @@ prepare() { cd $pkgname + + # https://github.com/AbiWord/enchant/pull/161 + patch -Np1 -i ../0001-voikko-Avoid-crashing-when-there-are-no-languages.patch + ./bootstrap }