Bug 2051360

Summary: hunspell %post creates myspell symlink too late (was: python3-enchant does not work anymore except for English)
Product: [Fedora] Fedora Reporter: Mike FABIAN <mfabian>
Component: hunspellAssignee: Jens Petersen <petersen>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 36CC: caillon+fedoraproject, caolanm, cstratak, gnome-sig, jamatos, mclasen, mfabian, petersen, pnemade, rhughes, rstrode, sandmann
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hunspell-1.7.0-16.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-07 06:15:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike FABIAN 2022-02-07 06:12:19 UTC
In rawhide install:

hunspell-en
hunspell-de
python3-enchant

Then:

bash-5.1# python3
Python 3.10.2 (main, Feb  1 2022, 00:00:00) [GCC 12.0.1 20220129 (Red Hat 12.0.1-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import enchant
>>> d = enchant.Dict('de_DE')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/enchant/__init__.py", line 542, in __init__
    super().__init__()
  File "/usr/lib/python3.10/site-packages/enchant/__init__.py", line 144, in __init__
    self._init_this()
  File "/usr/lib/python3.10/site-packages/enchant/__init__.py", line 549, in _init_this
    this = self._broker._request_dict_data(self.tag)
  File "/usr/lib/python3.10/site-packages/enchant/__init__.py", line 287, in _request_dict_dat
a
    self._raise_error(e_str % (tag,), DictNotFoundError)
  File "/usr/lib/python3.10/site-packages/enchant/__init__.py", line 234, in _raise_error
    raise eclass(err.decode())
enchant.errors.DictNotFoundError: No word lists can be found for the language "de".
>>> 

The reason is that the German dictionaries from hunspell-de are still in /usr/share/myspell:

bash-5.1# rpm -ql hunspell-de
/usr/share/doc/hunspell-de
/usr/share/doc/hunspell-de/README_de_AT.txt
/usr/share/doc/hunspell-de/README_de_CH.txt
/usr/share/doc/hunspell-de/README_de_DE.txt
/usr/share/licenses/hunspell-de
/usr/share/licenses/hunspell-de/COPYING_GPLv2
/usr/share/licenses/hunspell-de/COPYING_GPLv3
/usr/share/licenses/hunspell-de/Copyright
/usr/share/myspell/de_AT.aff
/usr/share/myspell/de_AT.dic
/usr/share/myspell/de_BE.aff
/usr/share/myspell/de_BE.dic
/usr/share/myspell/de_CH.aff
/usr/share/myspell/de_CH.dic
/usr/share/myspell/de_DE.aff
/usr/share/myspell/de_DE.dic
/usr/share/myspell/de_LI.aff
/usr/share/myspell/de_LI.dic
/usr/share/myspell/de_LU.aff
/usr/share/myspell/de_LU.dic
bash-5.1#

and they are not symlinked into /usr/share/hunspell, only the english dictionaries are there:

bash-5.1# ls /usr/share/hunspell/
en_AG.aff  en_BW.aff  en_DK.aff  en_HK.aff  en_JM.aff  en_NG.aff  en_SG.aff  en_ZA.aff
en_AG.dic  en_BW.dic  en_DK.dic  en_HK.dic  en_JM.dic  en_NG.dic  en_SG.dic  en_ZA.dic
en_AU.aff  en_BZ.aff  en_GB.aff  en_IE.aff  en_MW.aff  en_NZ.aff  en_TT.aff  en_ZM.aff
en_AU.dic  en_BZ.dic  en_GB.dic  en_IE.dic  en_MW.dic  en_NZ.dic  en_TT.dic  en_ZM.dic
en_BS.aff  en_CA.aff  en_GH.aff  en_IN.aff  en_NA.aff  en_PH.aff  en_US.aff  en_ZW.aff
en_BS.dic  en_CA.dic  en_GH.dic  en_IN.dic  en_NA.dic  en_PH.dic  en_US.dic  en_ZW.dic
bash-5.1# 

Therefore, python3-enchant works only for the English dictionaries.

bash-5.1# python3
Python 3.10.2 (main, Feb  1 2022, 00:00:00) [GCC 12.0.1 20220129 (Red Hat 12.0.1-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import enchant
>>> d = enchant.Dict('en_US')
>>> type(d)
<class 'enchant.Dict'>
>>>

Comment 1 Jens Petersen 2022-02-07 06:31:39 UTC
I think we need to understand the system package state and environment before and after installing those packages.
The myspell/ directory should no longer exist (it gets replaced by a symlink).
eg I can't reproduce in a Rawhide Live instance.

(I don't think this is a python-enchant issue)

Comment 2 Mike FABIAN 2022-02-07 06:34:02 UTC
This scratch build of ibus-typing-booster from today fails because python3-enchant doesn't work for non-English dictionaries:

https://koji.fedoraproject.org/koji/taskinfo?taskID=82489127

Comment 4 Jens Petersen 2022-02-07 07:59:21 UTC
I believe this is due to %post being mistakenly on hunspell instead of hunspell-filesystem.

I will push a fix shortly.

Comment 5 Jens Petersen 2022-02-07 08:16:46 UTC
This is how the dnf transaction in mock looked:

Running transaction
  Running scriptlet: hunspell-1.7.0-15.fc36.x86_64                    1/1 
  Preparing        :                                                  1/1 
  Installing       : dbus-libs-1:1.13.20-3.fc36.x86_64              1/219 
  :
  Installing       : hunspell-filesystem-1.7.0-15.fc36.x86_64      10/219 
  Installing       : hunspell-en-GB-0.20140811.1-22.fc36.noarch    11/219 
  Installing       : hunspell-en-0.20140811.1-22.fc36.noarch       12/219 
  Installing       : hunspell-en-US-0.20140811.1-22.fc36.noarch    13/219 
  Installing       : hunspell-es-AR-1:2.3-10.fc36.noarch           14/219 
  Installing       : hunspell-es-BO-1:2.3-10.fc36.noarch           15/219 
  Installing       : hunspell-es-CL-1:2.3-10.fc36.noarch           16/219 
  Installing       : hunspell-es-CO-1:2.3-10.fc36.noarch           17/219 
  Installing       : hunspell-es-CR-1:2.3-10.fc36.noarch           18/219 
  Installing       : hunspell-es-CU-1:2.3-10.fc36.noarch           19/219 
  Installing       : hunspell-es-DO-1:2.3-10.fc36.noarch           20/219 
  Installing       : hunspell-es-EC-1:2.3-10.fc36.noarch           21/219 
  Installing       : hunspell-es-ES-1:2.3-10.fc36.noarch           22/219 
  Installing       : hunspell-es-GT-1:2.3-10.fc36.noarch           23/219 
  Installing       : hunspell-es-HN-1:2.3-10.fc36.noarch           24/219 
  Installing       : hunspell-es-MX-1:2.3-10.fc36.noarch           25/219 
  Installing       : hunspell-es-NI-1:2.3-10.fc36.noarch           26/219 
  Installing       : hunspell-es-PA-1:2.3-10.fc36.noarch           27/219 
  Installing       : hunspell-es-PE-1:2.3-10.fc36.noarch           28/219 
  Installing       : hunspell-es-PR-1:2.3-10.fc36.noarch           29/219 
  Installing       : hunspell-es-PY-1:2.3-10.fc36.noarch           30/219 
  Installing       : hunspell-es-SV-1:2.3-10.fc36.noarch           31/219 
  Installing       : hunspell-es-US-1:2.3-10.fc36.noarch           32/219 
  Installing       : hunspell-es-UY-1:2.3-10.fc36.noarch           33/219 
  Installing       : hunspell-es-1:2.3-10.fc36.noarch              34/219 
  Installing       : hunspell-1.7.0-15.fc36.x86_64                 35/219 
  Running scriptlet: hunspell-1.7.0-15.fc36.x86_64                 35/219 
  Installing       : hunspell-es-VE-1:2.3-10.fc36.noarch           36/219 

where clearly the %post is run too late from hunspell.

Comment 6 Jens Petersen 2022-02-07 08:18:58 UTC
Hopefully hunspell-1.7.0-16.fc36 will fix this.

Comment 7 Ben Cotton 2022-02-08 20:09:50 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.