Bug 915448
| Summary: | Spell check problem (UTF8 conversion?) with Hunspell | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | igor.redhat <igor.redhat> | ||||
| Component: | hunspell | Assignee: | Caolan McNamara <caolanm> | ||||
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 19 | CC: | caolanm, emmanuel.kowalski, gc, i18n-bugs, jonathan.underwood, maciek.borzecki, mshao, rvokal, tagoh | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | hunspell-1.3.3-4.fc22 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | 725235 | Environment: | |||||
| Last Closed: | 2014-10-16 14:56:30 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
igor.redhat@gmail.com
2013-02-25 18:48:03 UTC
This still happens on F18 with emacs-24.2-6.fc18.x86_64 This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component. I have found that similar problem is solved in upstream http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-04/msg00330.html This bug seems to be a hunspell bug. Proposed patches are: http://sourceforge.net/p/hunspell/patches/57/ http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-04/msg00341.html I will reassign that into hunspell package. poked nemeth to have a look This message is a reminder that Fedora 18 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 18. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '18'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 18's end of life. Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 18 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 18's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Moving to F19 - I assume it is still affected. Can we add one of the two patches? I mean that the bug itself is like >2 years old, upstream does not seem to share the interest fix this anyway, while it does hurt users (such as emacs users :)). I know that Fedora's policy is not to bundle patches, but in this case we'll keep on having a broken hunspell in repositories. I can help and update the spec and bundle the patches if this is going to speed up the process. It'd be really awesome to get the patche in - as it stands, emacs' spell check is not operational for languages other than English. BTW, this issue still exists in F20. The bug is still in the rawhide version (normal, last update was in October 2013). As suggested Petr Hracek it suffices to apply a very simple patch: it takes 5 minutes and it works like a charm. For those that are desperate to wait and want to use emacs for languages other than English here you are how to do it. 1. download the hunspell src.rpm, for instance (or the version you find there) http://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/source/SRPMS/h/hunspell-1.3.2-15.fc21.src.rpm 2. install it as root rpm -ivh hunspell-1.3.2-15.fc21.src.rpm 3. save the following text in the file /root/rpmbuild/SOURCES/hunspell.emacs.patch --- src/tools/hunspell.cxx~0 2011-01-21 19:01:29.000000000 +0200 +++ src/tools/hunspell.cxx 2013-02-07 10:11:54.443610900 +0200 @@ -710,13 +748,22 @@ if (pos >= 0) { fflush(stdout); } else { char ** wlst = NULL; - int ns = pMS[d]->suggest(&wlst, token); + int byte_offset = parser->get_tokenpos() + pos; + int char_offset = 0; + if (strcmp(io_enc, "UTF-8") == 0) { + for (int i = 0; i < byte_offset; i++) { + if ((buf[i] & 0xc0) != 0x80) + char_offset++; + } + } else { + char_offset = byte_offset; + } + int ns = pMS[d]->suggest(&wlst, chenc(token, io_enc, dic_enc[d])); if (ns == 0) { - fprintf(stdout,"# %s %d", token, - parser->get_tokenpos() + pos); + fprintf(stdout,"# %s %d", token, char_offset); } else { fprintf(stdout,"& %s %d %d: ", token, ns, - parser->get_tokenpos() + pos); + char_offset); fprintf(stdout,"%s", chenc(wlst[0], dic_enc[d], io_enc)); } for (int j = 1; j < ns; j++) { @@ -745,13 +792,23 @@ if (pos >= 0) { if (root) free(root); } else { char ** wlst = NULL; + int byte_offset = parser->get_tokenpos() + pos; + int char_offset = 0; + if (strcmp(io_enc, "UTF-8") == 0) { + for (int i = 0; i < byte_offset; i++) { + if ((buf[i] & 0xc0) != 0x80) + char_offset++; + } + } else { + char_offset = byte_offset; + } int ns = pMS[d]->suggest(&wlst, chenc(token, io_enc, dic_enc[d])); if (ns == 0) { fprintf(stdout,"# %s %d", chenc(token, io_enc, ui_enc), - parser->get_tokenpos() + pos); + char_offset); } else { fprintf(stdout,"& %s %d %d: ", chenc(token, io_enc, ui_enc), ns, - parser->get_tokenpos() + pos); + char_offset); fprintf(stdout,"%s", chenc(wlst[0], dic_enc[d], ui_enc)); } for (int j = 1; j < ns; j++) { 4. edit the file /root/rpmbuild/SPECS/hunspell.spec - Add on line 25 Patch5: hunspell.emacs.patch - Add on line 48 %patch5 -p0 -b .emacs 5. rebuild the rpm files rpmbuild -ba SPECS/hunspell.spec 6. Install the rpm files you now have in /root/rpmbuild/RPMS/<arch> Enjoy! Actually, be careful that bugzilla added nasty line breaks to the patch file. Better take hunspell.emacs.patch from here http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7781#31 (In reply to Giuseppe Castagna from comment #11) > Actually, be careful that bugzilla added nasty line breaks to the patch > file. Better take hunspell.emacs.patch from here > > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7781#31 I did a koji build some time ago: http://koji.fedoraproject.org/koji/taskinfo?taskID=6861381 Although the patch was applied and spell checking seemed to work if I piped a file in the terminal, Emacs did not work as expected. Feel free to try the build, if you do so, please report back if it works for you. src.rpm is included there in case you want to rebuild Created attachment 899034 [details]
0001-Resolves-rhbz-915448-UTF-8-handling.patch
fedpkg patch
(In reply to Maciek Borzecki from comment #12) > Feel free to try the > build, if you do so, please report back if it works for you. src.rpm is > included there in case you want to rebuild Thank you a lot. I've just installed it on the 3 machines I use most and I am testing it. BTW, I have extensively used the solution I suggested in my post and it worked flawlessly for me. integrated upstream |