Bug 319679 - File corruption when editing URXVT sources files (.C)
Summary: File corruption when editing URXVT sources files (.C)
Status: RESOLVED DUPLICATE of bug 323693
Alias: None
Product: kate
Classification: Unclassified
Component: part (show other bugs)
Version: Git
Platform: Other Linux
: NOR grave (vote)
Target Milestone: ---
Assignee: KWrite Developers
Depends on:
Reported: 2013-05-11 18:08 UTC by Emmanuel Lepage Vallée
Modified: 2014-01-01 21:46 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Emmanuel Lepage Vallée 2013-05-11 18:08:08 UTC
I just got this very bad bug. I cannot use kate to edit some files in the urxvt sources like scrollbar-rxvt.C

If I do, Kate add some garbage at the end of the file. This garbage is visible in other editors like Vi or Nano, but not in Kate unless F5 is pressed. If I delete the garbage and save, it come back and more garbage is added. Could it be a missing \0 somewhere?

Example file:

  return 1;
/*----------------------- end-of-file (C source) -----------------------*/

Turn into:

  return 1;
/*----------------------- end-of-file (C source) -----------------------*/

Of course this doesn't compile and corrupt the file.

Reproducible: Always

Steps to Reproduce:
1. Download rxvt-unicode (urxvt) sources
2. Open that file in Kate
3. Make edits
4. Save
6. Press F5
Actual Results:  
Corrupted data

Expected Results:  
File correctly saved

I can reproduce with latest Git sources. Setting priority to "Grave" because the app is unusable for editing those files and there is corruption.
Comment 1 Dominik Haumann 2013-08-12 12:28:52 UTC
For me, the file is loaded with codec "ISO-8859-15" without encoding errors (see console output).

Editing and saving the file works. Reloading the file shows the correct contents. So I cannot reproduce. Please attach the file you are encountering problems with. Please also specify the enconding the file is loaded with.
Comment 2 Emmanuel Lepage Vallée 2013-12-20 04:58:56 UTC
This still happen with many files. It eventually add some garbage, usually part of the last few lines. I have to remove them in vi then reload kate. It works for 5 minute then it happen again. Is there a way to valgrind kate? It SEGFAULT when I try. Given the randomness, it may by a stack corruption or something.
Comment 3 Michal Humpula 2013-12-20 19:22:03 UTC
HI Emmanuel,

valgrind casues segfault, because (most likely) of the bug in JS library the Qt4 is using. So to make kate run under valgrind you have to edit a source a little bit. Commenting out the KateScriptActionMenu::repopulate does the trick for me.

Just a wild hunch... do you have static word wrap turned on?
Comment 4 Emmanuel Lepage Vallée 2014-01-01 21:24:17 UTC
Look like the same bug

*** This bug has been marked as a duplicate of bug 323693 ***
Comment 5 Michal Humpula 2014-01-01 21:36:33 UTC
Hi Emmanuel,

did you tried the current version (which has the patch)? Is the problem gone?
Comment 6 Emmanuel Lepage Vallée 2014-01-01 21:46:38 UTC
I did. As for the bug, time will tell, so far so good!