Bug 42122 - Deleting entries from user-defined dictionaries does not work properly
Summary: Deleting entries from user-defined dictionaries does not work properly
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Linguistic (show other bugs)
Version:
(earliest affected)
3.4.3 release
Hardware: x86 (IA32) All
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:4.1.0
Keywords:
: 61058 65992 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-23 01:38 UTC by Nico Dorn
Modified: 2013-07-04 22:25 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
user-defined dictionary to reproduce the bug (4.54 KB, application/octet-stream)
2011-10-23 01:38 UTC, Nico Dorn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Dorn 2011-10-23 01:38:34 UTC
Created attachment 52646 [details]
user-defined dictionary to reproduce the bug

The deletion of words from a user-defined dictionary does not work properly using the UI given at Tools > Options > Language Settings > Writinge Aids.

STEPS TO REPRODUCE
1) Go to "Writing Aids"
2) Create a new Dictionary (e.g. with the name "test", all languages)
3) Edit "test"
4) Add the words "zappy" and "xappy"
5) Hit "Close", hit "OK". test.dic now looks this way:

OOoUserDict1
lang: <none>
type: positive
---
xappy
zappy

6) Reopen "Writing Aids"
7) Remove xappy
8) Hit "Close", hit "OK". test.dic now looks this way:

OOoUserDict1
lang: <none>
type: positive
---
zappy
zappy

ANOTHER EXAMPLE
This bug also applies to already existing user dictionaries. Deleting a randaom word from the attached dictionary ends at some confusion around the last few lines. Before:
   ...
   Özdogan
   Özdogans
   äsopische
After deleting the entry "Agamben" (hit "Close" and "OK") the file ending looks like this:
   ...
   Özdogan
   Özdogans
   äsopische
   opische
After deleting another entry (for this example "Ahasveros"; hit "Close" and "OK") seems to corrupt the file totally. After that, for some reasons my plain text editor does not recognize anymore that the file is UTF8-encoded (also another line has been added):
   ...
   Ãzdogan
   Ãzdogans
   Àsopische
   €sopische
   opische
Comment 1 manj_k 2011-10-24 13:44:17 UTC
I can confirm that behavior (the described 'STEPS TO REPRODUCE': xappy/zappy) with LibO 3.4.3 release on WinXP.

Another test with an existing user-defined dictionary (Language: German(Germany))
resulted in messed up entries at the end of the dictionary.

Sample: lines 220–229

ungebeugt
unterfinanziert
wortübergreifende
zitierbar
nziert
wegsortieren
wortübergreifende
zitierbar

zitierbar
Comment 2 Tino Didriksen 2013-01-18 13:30:23 UTC
I just noticed the same broken behavior in LO 3.6.4.3 on Windows 7 x64, so instead of filing a new bug I'm updating the version on this one to that release.
Comment 3 manj_k 2013-01-18 14:03:20 UTC
Version reset to '3.4.3 release'.

@ Tino Didriksen
Thanks for your verification.
Please have a look at 
https://wiki.documentfoundation.org/BugReport_Details#Version .
Comment 4 manj_k 2013-02-19 18:27:29 UTC
*** Bug 61058 has been marked as a duplicate of this bug. ***
Comment 5 Urmas 2013-02-19 19:25:06 UTC
Apparently caused by commit 7e01bc8d28ffefd4539a5eae2587e1f7da0999e7
Comment 6 Michael Meeks 2013-02-20 15:45:26 UTC
I have a prototype fix on my machine that needs some testing; doing it right is > a 1 line fix.
Thanks for the commit hash Urmas ! - nice to know the bug was there since 2009 ;-)
Comment 7 Michael Meeks 2013-02-20 16:24:21 UTC
re-written to write the dictionary to a .dic.tmp file and ~atomically move it over the .dic file IFF we write it correctly - this avoids several potentials for corruption / loss of the existing data if out-of-space etc.

It also fixes the truncation issue pretty categorically.

If people can test and verify that that works in a master build - I'll try to find someone to pick it for 4.0.2.

Thanks for reporting !
Comment 8 Not Assigned 2013-02-20 16:26:30 UTC
Michael Meeks committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=28300209604ee1bb8e5050322b29e95a07f679d8

fdo#42122 - truncate files that shrink to avoid dictionary corruption.



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 Nico Dorn 2013-02-20 16:53:53 UTC
@Michael: I'll check the upcoming daily build and give you a hint whether the patch works for me or not. Thank's for fixing it!
Comment 10 Nico Dorn 2013-02-23 11:58:40 UTC
Unfortunately, I'm not able to start the current master build (it terminates with a shared library error). So I guess we'll have to wait until 4.1 to enjoy the working fix. :(
Comment 11 tommy27 2013-06-23 11:14:13 UTC
@Nico Dorn
4.1 RC1 is available and should have that fix.
http://www.libreoffice.org/download/pre-releases/

please test it, and if it works ask for backporting into 4.0.5
Comment 12 tommy27 2013-06-23 11:15:42 UTC
*** Bug 65992 has been marked as a duplicate of this bug. ***
Comment 13 Nico Dorn 2013-06-24 07:57:23 UTC
Your wish is my command :)

I tested the examples posted by me in the first comment and the cases in Bug 65992 with LO 4.1.0.1. Works like a charm, good work Michael!

Please backport the fix to 4.0.5. Thanks!
Comment 14 santiago473 2013-06-30 13:35:26 UTC
(In reply to comment #11)
> @Nico Dorn
> 4.1 RC1 is available and should have that fix.
> http://www.libreoffice.org/download/pre-releases/
> 
> please test it, and if it works ask for backporting into 4.0.5

I can also confirm this bug. Additionally to the corruption it also prohibits the last word from the user-dictionary to be removed.

Although I cannot confirm the fix since the current beta of LibreOffice 4.1.0.1.0 from 27.06.2013 (Build ID: 8a1cc1449c26b7b5a46f258aabf13c28a9dbebb) crashes after closing if you have created an user-dictionary by adding a new word (like "xappy") after a clean installation. OS is Windows XP SP3. The crashes might be related to the fix.
Comment 15 Nico Dorn 2013-06-30 15:51:11 UTC
(In reply to comment #14)
> Although I cannot confirm the fix since the current beta of LibreOffice
> 4.1.0.1.0 from 27.06.2013 (Build ID:
> 8a1cc1449c26b7b5a46f258aabf13c28a9dbebb) crashes after closing if you have
> created an user-dictionary by adding a new word (like "xappy") after a clean
> installation. OS is Windows XP SP3. The crashes might be related to the fix.

I'm not facing any crash at all (Kubuntu 12.10, LO 4.1.0.1
Build ID: 1b3956717a60d6ac35b133d7b0a0f5eb55e9155). I think you should open a new bug and link to this one.
Comment 16 santiago473 2013-06-30 22:30:16 UTC
(In reply to comment #15)
> (In reply to comment #14)
>
> > Although I cannot confirm the fix since the current beta of LibreOffice
> > 4.1.0.1.0 from 27.06.2013 (Build ID:
> > 8a1cc1449c26b7b5a46f258aabf13c28a9dbebb) crashes after closing if you have
> > created an user-dictionary by adding a new word (like "xappy") after a clean
> > installation. OS is Windows XP SP3. The crashes might be related to the fix.
> 
> I'm not facing any crash at all (Kubuntu 12.10, LO 4.1.0.1
> Build ID: 1b3956717a60d6ac35b133d7b0a0f5eb55e9155). I think you should open
> a new bug and link to this one.

Done: https://www.libreoffice.org/bugzilla/show_bug.cgi?id=66420
Comment 17 Michael Stahl (allotropia) 2013-07-04 22:25:57 UTC
the fix for this bug introduced bug 66420