From 466781fc37754a2babe95ebd2c760b1f337f7b15 Mon Sep 17 00:00:00 2001 From: Michal Domonkos Date: Mon, 10 Jan 2022 16:45:32 +0100 Subject: [PATCH] Handle missing language error during spellcheck Previously, PyEnchant raised a DictNotFoundError from the SpellChecker constructor in case it didn't find the given language. This was recently[1] changed/fixed upstream to actually handle that error in the constructor and then raise a DefaultLanguageNotFoundError instead. Adapt our code to it but also keep handling the previous error, just in case. Note that this was never fixed in rpmlint upstream since that has moved on and rewritten quite a bit of the codebase, fixing this traceback in the process, hence a downstream-only patch here. [1] commit 5fc8ecc458b7b84d88ce629f74905549790141ee at: https://github.com/pyenchant/pyenchant/ Resolves: #1929210 --- ...1-spellcheck-handle-missing-language-error.patch | 13 +++++++++++++ rpmlint.spec | 5 +++++ 2 files changed, 18 insertions(+) create mode 100644 rpmlint-1.11-spellcheck-handle-missing-language-error.patch diff --git a/rpmlint-1.11-spellcheck-handle-missing-language-error.patch b/rpmlint-1.11-spellcheck-handle-missing-language-error.patch new file mode 100644 index 0000000..44d6ca0 --- /dev/null +++ b/rpmlint-1.11-spellcheck-handle-missing-language-error.patch @@ -0,0 +1,13 @@ +diff -up rpmlint-rpmlint-1.11/TagsCheck.py.orig rpmlint-rpmlint-1.11/TagsCheck.py +--- rpmlint-rpmlint-1.11/TagsCheck.py.orig 2022-01-11 16:49:18.424026182 +0100 ++++ rpmlint-rpmlint-1.11/TagsCheck.py 2022-01-11 16:50:05.774665734 +0100 +@@ -463,7 +463,8 @@ def spell_check(pkg, str, fmt, lang, ign + lang, filters=[enchant.tokenize.EmailFilter, + enchant.tokenize.URLFilter, + enchant.tokenize.WikiWordFilter]) +- except enchant.DictNotFoundError: ++ except (enchant.errors.DefaultLanguageNotFoundError, ++ enchant.DictNotFoundError): + printInfo(pkg, 'enchant-dictionary-not-found', lang) + pass + _enchant_checkers[lang] = checker diff --git a/rpmlint.spec b/rpmlint.spec index 8349ba5..2ec38ca 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -40,6 +40,9 @@ Patch213: rpmlint-1.11-libc-warnings.patch # See https://fedoraproject.org/wiki/Changes/PythonMacroError Patch214: rpmlint-1.11-no-python-macro.patch +# Downstream-only patches +Patch215: rpmlint-1.11-spellcheck-handle-missing-language-error.patch + BuildArch: noarch BuildRequires: make %if %{with python3} @@ -103,6 +106,7 @@ and source packages as well as spec files can be checked. %patch212 -p1 %patch213 -p1 %patch214 -p1 +%patch215 -p1 sed -i 's|1.10|%{version}|g' Makefile @@ -156,6 +160,7 @@ make check PYTHON=%{python} PYTEST=%{pytest} FLAKE8=%{flake8} %changelog * Mon Jan 10 2022 Michal Domonkos - 1.11-18 - Enable bash-completion (#1999654) +- Handle missing language error during spellcheck (#1929210) * Tue Aug 10 2021 Mohan Boddu - 1.11-17 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags