Bug 149175

Summary: file change notification does not work for symlinks
Product: [Applications] kate Reporter: Maciej Pilichowski <bluedzins>
Component: generalAssignee: Andre Heinecke <aheinecke>
Status: RESOLVED FIXED    
Severity: normal CC: aheinecke, faure, savagedamian
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.11
Sentry Crash Report:

Description Maciej Pilichowski 2007-08-24 19:29:38 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    SuSE RPMs

When you edit outside Kate a file, and get back to Kate you can see warning dialog about modification.

But if you do the same to symlink, it is completely transparent to Kate. I.e. Kate thinks there is no change.
Comment 1 Anders Lund 2007-08-24 21:01:16 UTC
On Friday 24 August 2007, Maciej Pilichowski wrote:

This is likely a problem of kdelibs (kdirwatcher) I believe.
Comment 2 Thomas Friedrichsmeier 2007-12-10 22:33:02 UTC
I think so, too, so re-assigning to kio.
Comment 3 David Faure 2009-02-10 23:44:19 UTC
There was a patch on kde-core-devel about this, I believe (not committed yet).
Comment 4 Flavio Castelli 2009-02-11 08:44:57 UTC
Yes, the patch is against kdirwatch. I have to review it.
Comment 5 Andre Heinecke 2013-01-22 16:48:12 UTC
I just retested this bug on KDE 4.9.97 and the behavior is still the same. It's kind of major as it usually leads to data loss in the instance of kate when you overwrite someone elses changes without noticing it.

I've tried my luck with google to find the mentioned patch and give it a try but I could not find it.

Does someone know which Patch was meant in comment 3 ?
Comment 6 Andre Heinecke 2013-01-22 18:03:34 UTC
Actually I've looked a bit more into this and I don't think that kdirwatch is the Problem here.
Kate asks to monitor the symlink and I think it's the correct behavior of kdirwatch that it then monitors the symlink and not the file the symlink points to.
For Kate it does not make sense to monitor the symlink in this case. So it should monitor the file the symlink points to instead.

I've opened a review request for kate to change it there. ( https://git.reviewboard.kde.org/r/108555/ )
Comment 7 Andre Heinecke 2013-01-23 08:40:33 UTC
Git commit 348b496d5c0f9c375b016d6c764593949bd73182 by Andre Heinecke.
Committed on 23/01/2013 at 09:34.
Pushed by aheinecke into branch 'master'.

Activate monitoring on symlinked files

    Previously kate would monitor the symlink for changes
    and ignored changes made to the actual data. This could
    cause data loss if changes were made to the file behind
    the symlink while editing in kate.
    REVIEW: 108555

M  +6    -0    part/document/katedocument.cpp

http://commits.kde.org/kate/348b496d5c0f9c375b016d6c764593949bd73182
Comment 8 Damian Savage 2014-02-25 08:44:09 UTC
Is there any workaround for this for older versions of kate (v2.5.4).

We are using an entreprise redhat distribution using KDE 3.5.4-25.el5_4.1
So it will require some work from IT to update this. 

Also we have a lot of symlinks which makes kate dangerous to use as the 
default editor...
Comment 9 Andre Heinecke 2014-02-26 13:42:14 UTC
The patch is quite simple and should be easy to backport for your distributor. If it helps the katepart lived in kdelibs in older versions. I did backport this for our company to debian squeeze. The source package containing this patch is available at:
http://files.kolab.org/apt/releases/dists/squeeze/stable/source/kde4libs/