Bug 318452 - Issues with Disable swap file syncing
Summary: Issues with Disable swap file syncing
Status: RESOLVED DUPLICATE of bug 321135
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-16 14:33 UTC by Alex Pacini
Modified: 2013-09-12 08:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Pacini 2013-04-16 14:33:45 UTC
Since the last upgrade to KDE 4.10.1 I noticed that kwrite started to create a swap file even if it is disabled activating the option: Configure KWrite> Open/Save> Advanced> "Disable swap files syncing".
Now I upgraded to 4.10.2 and the bug persists.
I saw an another bug report on the KDE's bugzilla (Bug 309753) but, since it was marked as fixed, I decided to create a new report.
This bug makes programs as Dropbox to run crazy, since every letter it tries to sync the swap.
Maybe It could be useful also to add another option for running these swap files in a different location, for example a folder in the home directory (it could be: /home/user/.kde4/share/apps/katepart/swap/)

Thanks!

Reproducible: Always
Comment 1 Alex Pacini 2013-04-16 14:38:32 UTC
Sorry, I meant that Bug 258897
Comment 2 Dominik Haumann 2013-04-16 14:58:42 UTC
If you read "Disable swap file syncing" carefully, you'll notice that it's about disabling the syncing of the swap files. It's NOT about disabling swap files, see also https://bugs.kde.org/show_bug.cgi?id=317799.

Kate syncs all swap files each 15 seconds to disk. If you enable the option, it never forces syncing the swap files to disk.
Comment 3 Alex Pacini 2013-04-16 15:07:38 UTC
Well, ok I understood the option, nevertheless it syncs every character (more than every second) even with the option activated.
Comment 4 Dominik Haumann 2013-04-16 15:18:39 UTC
Then please follow http://kate-editor.org/get-it/ and try again :) Thanks!
Comment 5 Alex Pacini 2013-04-16 15:32:21 UTC
Do you mean I should recompile it from source?
I tried on an another pc, anyway it is again with Sabayon (Gentoo with binary packages), and I found the same behaviour: could this be a problem of the precompiled package?
Is there any log I can attach?
Comment 6 Dominik Haumann 2013-04-16 15:36:58 UTC
Yes, recompile from sources just as I said by following http://kate-editor.org/get-it/
Afterwards you can delete the ~/kde folder again and your system remains untouched.

No, there is no log.
Comment 7 Alex Pacini 2013-04-16 16:02:25 UTC
Did it. I have some problems running the final script (run.sh):

kbuildsycoca4 running...
kbuildsycoca4(17253) VFolderMenu::loadDoc: Parse error in  "/home/alex/.config/menus/applications-merged/xdg-desktop-menu-dummy.menu" , line  1 , col  1 :  "unexpected end of file" 
kbuildsycoca4(17253) parseLayoutNode: The menu spec file contains a Layout or DefaultLayout tag without the mandatory Merge tag inside. Please fix your file. 
kbuildsycoca4(17253) KConfigGroup::readXdgListEntry: List entry x-scheme-handler/webcal in "/home/alex/.local/share/applications/mimeapps.list" is not compliant with XDG standard (missing trailing semicolon).
Comment 8 Dominik Haumann 2013-04-16 16:04:08 UTC
You can ignore all the kbuildsycoca4 warnings.

So I assume kate starts? If so, does it work as expected?
Comment 9 Alex Pacini 2013-04-16 16:11:01 UTC
It does not start; 
alex@aspire7738G ~/kde $ ./run.sh kate
kbuildsycoca4 running...
kbuildsycoca4(19190) KConfigGroup::readXdgListEntry: List entry x-scheme-handler/webcal in "/home/alex/.local/share/applications/mimeapps.list" is not compliant with XDG standard (missing trailing semicolon). 
kate: error while loading shared libraries: libkdeinit4_kate.so: cannot open shared object file: No such file or directory

I am doing something wrong...
Comment 10 Alex Pacini 2013-04-16 16:18:45 UTC
I used this and it runs:
./run.sh kwrite

The swap "furious" syncing persist
Comment 11 Dominik Haumann 2013-04-17 19:50:23 UTC
If you relpace something with replace all, do you get a fading in and out animation of the replaced items? I'm just wondering whether the correct kate instance is started.
Comment 12 Alex Pacini 2013-04-17 20:04:59 UTC
I am not sure of this, but doing a replace all, i get a green banner that says: "n replacement have been made" and the things replaced become green. But I don't see any transition or animation.

But, is this option for syncing working properly on your side?
Comment 13 Dominik Haumann 2013-04-17 20:20:08 UTC
Is this in the view, or below the view?
Comment 14 Alex Pacini 2013-04-17 20:24:46 UTC
I tried to do a snapshot, but whenever I open knsapshot the green band goes out...
The green band is just under the text and over the replace window (it is on the text area)
Comment 15 Dominik Haumann 2013-04-17 20:31:42 UTC
Did you make install? It's the wrong Kate, I'm 100% sure: The text should say "N replacements made" and not "N replacements have been made". 

Either you forgot make install, or even make did not work...
Comment 16 Alex Pacini 2013-04-17 20:35:53 UTC
I did it.
I retry everything, maybe something will change...

And it says: "N replacements have been made"
Comment 17 Dominik Haumann 2013-04-17 20:44:10 UTC
It can't be. Does the file ~/kde/usr/bin/kwrite exist?
What does `./run.sh which kwrite` say?
Comment 18 Alex Pacini 2013-04-17 20:47:33 UTC
Does the file ~/kde/usr/bin/kwrite exist?
Yes, but in few minutes i will have the new one (i redid everything) and I will try
./run.sh which kwrite
Comment 19 Dominik Haumann 2013-04-17 20:56:26 UTC
Are you sure your run.sh is correct? Did you copy & paste it or write it manually?
What does ./run.sh echo $LD_LIBRARY_PATH say?
Comment 20 Alex Pacini 2013-04-17 21:00:55 UTC
Recompiled everything: the same behaviour.

alex@aspire7738G ~/kde $ ./run.sh which kwrite
kbuildsycoca4 running...
kbuildsycoca4(32135) KConfigGroup::readXdgListEntry: List entry x-scheme-handler/webcal in "/home/alex/.local/share/applications/mimeapps.list" is not compliant with XDG standard (missing trailing semicolon). 
/home/alex/kde/usr/bin/kwrite

I did Copy and paste:

#!/bin/bash
export KATE_DIR=~/kde/usr
export PATH=$KATE_DIR/bin:$PATH
export LD_LIBRARY_PATH=$KATE_DIR/lib:$LD_LIBRARY_PATH
export KDEDIR=$KATE_DIR
export KDEDIRS=$KDEDIR
export XDG_DATA_DIRS=$XDG_DATA_DIRS:$KATE_DIR/share
# update KDE's system configuration cache
kbuildsycoca4
# start app
$@ 

alex@aspire7738G ~/kde $ ./run.sh echo $LD_LIBRARY_PATH 
kbuildsycoca4 running...
kbuildsycoca4(32419) KConfigGroup::readXdgListEntry: List entry x-scheme-handler/webcal in "/home/alex/.local/share/applications/mimeapps.list" is not compliant with XDG standard (missing trailing semicolon). 

(It leaves a blank space)
Comment 21 Dominik Haumann 2013-04-17 21:06:56 UTC
Heh, for me it's also blank, so no idea whether this should say something.

Anyways, now replace all says "N replacements made"?
Comment 22 Alex Pacini 2013-04-17 21:09:38 UTC
Anyways, now replace all says "N replacements made"?

No: "N replacements have been made"

Phew...
Comment 23 Dominik Haumann 2013-04-17 21:14:22 UTC
Ok, I just got another idea. Where is your katepart.so file?
Maybe it's in ~/kde/usr/lib64 instead of ~/kde/usr/lib?
If so, you have to change run.sh to: LD_LIBRARY_PATH=$KATE_DIR/lib64
Comment 24 Alex Pacini 2013-04-17 21:19:46 UTC
That was the problem! 
Now kate works, but the swap problem persist.
Now I have to go, I'll look at tomorrow if there is something more.
Thanks!
Comment 25 Alex Pacini 2013-04-17 21:20:39 UTC
PS. There is"N replacement made"
Comment 26 Dominik Haumann 2013-09-10 23:24:56 UTC
Sorry, lost sight of this.
Back to the initial issue you had, does it now sync as expected?
Comment 27 Alex Pacini 2013-09-11 06:34:18 UTC
No, it still keeps the swap synced. Nothing changed there.
Comment 28 Dominik Haumann 2013-09-11 07:49:36 UTC
After each character or every 15 seconds? With what options did you mount your partition?
Comment 29 Dominik Haumann 2013-09-11 07:54:41 UTC
And, does it work if you modify part/swapfile/kateswapfile.cpp as follows:

void SwapFile::finishEditing ()
{
[...]
  // format: qint8
  m_stream << EA_FinishEditing;
//  m_swapfile.flush();           // <----------- comment this line
}

Then recompile in the build folder by invoking `make install` and then run kate/kwrite again?
Comment 30 Alex Pacini 2013-09-11 07:59:23 UTC
After each character and using the option "Disable swap files syncing" checked.
I mount the partition with: 
/dev/sda2               /media/disk             ntfs-3g noexec, noatime, defaults       0 0

I will try your edit, just a moment since I have to download the source ad patch it.
Comment 31 Alex Pacini 2013-09-11 08:40:47 UTC
Tried and it solves the problem only partially (well, more or less what I was asking).
With the option checked or not it behaves in the same way: 
the first character written creates the swap file and then the swap file it is never refreshed any more.

I think this behaviour could be good only with the check box set, while the previous when unset.
Comment 32 Dominik Haumann 2013-09-11 15:52:57 UTC
Ok. A bit of research results in the following theory: ntfs-3g supports caching but is known to lead to bugs or (interestingly) poor performance. I'm not sure of this, but may it be that caching is disabled by default for the ntfs-3g file system driver? In that case, each flush() always writes do disk.

Was the other system you encountered this issue also on ntfs-3g?
You could try with the mount option nosync, have no idea what happens then, though ;)

Bottom line is: I really do not think this is a Kate issue, therefore I'll soon close this issue as solved.
Comment 33 Alex Pacini 2013-09-11 16:46:56 UTC
The same happens on ext4, I checked the swap file using "tail -f"
Comment 34 Alex Pacini 2013-09-11 16:56:52 UTC
As a workaround, could you implement a checkbox to completely avoid the use of a swap file?
Comment 35 Dominik Haumann 2013-09-12 06:37:28 UTC
Ok, when writing to a file and listing the contents e.g. with tail -f, it does not necessarily mean that the file is already physically written to disk. Probably it's all cached, and therewith this is simply not really an issue. Or to put it differently: I can't add any valuable information here anymore.

This report grew too long for now, and it basically comes down to "add an option to disable swap files entirely". This is the same as bug #321135, which is by far shorter. So I'll close as duplicate.

*** This bug has been marked as a duplicate of bug 321135 ***
Comment 36 Alex Pacini 2013-09-12 08:11:21 UTC
Thank you for the time involved.
Fundamentally yes, at this point it is not really an issue of kate.

Well, so I will wait for that option.

Alex