Bug 64081 - Shows warning "file modified on disc" whenever I save a file
Summary: Shows warning "file modified on disc" whenever I save a file
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: editor integration (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
: 64116 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-09-11 16:14 UTC by kstars
Modified: 2008-08-23 22:54 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kstars 2003-09-11 16:14:50 UTC
Version:           CVS (11 Sep 2003) (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.1 
OS:          Linux

Whenever I save a file in KDevelop, a messagebox appears with the text "File modified on disc by another program", but of course it's KDevelop that has modified the file.

The first time a file is saved, the message does not appear, it's only on subsequent saves.  This has been the case in CVS for at least a week (most recent update was 11 September).  

It's possible that the bug is in the katepart, not kdevelop.  It seems like the program doesn't recognize itself as the changer of the file, so whichever code is supposed to handle that part is probably responsible.
Comment 1 F Fracassi 2003-09-11 16:28:18 UTC
Same here, and as a addition, because i think its related, when one chooses Edit -> Reformat Source the 
whole contents of the file get deleted, but may be restored with undo.  
Comment 2 Amilcar do Carmo Lucas 2003-09-11 18:30:14 UTC
This is most probaly a KDE HEAD issue 
Comment 3 Amilcar do Carmo Lucas 2003-09-12 20:27:46 UTC
*** Bug 64116 has been marked as a duplicate of this bug. ***
Comment 4 mutlaqja 2003-09-14 20:58:25 UTC
I have the same problem and I compiled KDevelop from CVS HEAD on Sep 12th. 
 
It's very annoying, please fix this issue. Appreciate it! 
 
 
Comment 5 Mario Scalas 2003-09-14 21:10:16 UTC
I can confirm that it happens with KDE HEAD: katepart HEAD related, as roberto 
said in IRC. 
Comment 6 rcm 2003-09-14 23:27:15 UTC
Subject: Re:  Shows warning "file modified on disc" whenever I save a file

On Sunday 14 September 2003 01:58 pm, you wrote:
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
>
> http://bugs.kde.org/show_bug.cgi?id=64081
>
>
>
>
> ------- Additional Comments From mutlaqja@ku.edu  2003-09-14 20:58 -------
> I have the same problem and I compiled KDevelop from CVS HEAD on Sep 12th.
>
> It's very annoying, please fix this issue. Appreciate it!

	it seems it only happens with the KAte plugin, with the qeditor plugin it 
doesnt....


	Cheers...

Comment 7 tim 2003-09-15 18:11:56 UTC
Kate removes the file from the watch list before saving and adds it again afterwards. This is 
its strategy for trying not to get change notifications for changes it caused itself. In 
standalone kate, it works. 
 
However, there is somebody else watching it at that point (kdevelop/src/partcontroller.cpp 
line 437) so kdirwatch never actually removes it from the watch list. 
 
This means it doesn't get statted on re-adding because it's already there, and there's now a 
race. Kate removes-writes-adds before FAM gets around to checking, and lo and behold, 
when it does check, the file has changed. 
 
Observe some debug output from gideon immediately following a save: 
 
kio (KDirWatch): Added already watched Entry /home/tim/cvs/taskmaster/src/
taskmastermainwidget.h (now 2 clients) [KDirWatch-3] 
 
kdevelop (core): MainWindowIDEAl::slotPartJobCompleted() 
gideon: BookmarksPart::reload() 
 
kdevelop (core): dcop emitting savedFile /home/tim/cvs/taskmaster/src/
taskmastermainwidget.h 
 
kio (KDirWatch): Processing FAM event (FAMChanged, /home/tim/cvs/taskmaster/src/
taskmastermainwidget.h, Req 3) 
 
kio (KDirWatch): KDirWatch-1 emitting dirty /home/tim/cvs/taskmaster/src/
taskmastermainwidget.h 
 
kio (KDirWatch): KDirWatch-3 emitting dirty /home/tim/cvs/taskmaster/src/
taskmastermainwidget.h 
 
 
Note how the FAM event comes in *after* the "adding already watched entry". 
 
KDirWatch could fix this problem by forcing a recheck of a file's status whenever something 
adds an already monitored file, just before adding the requestor to the list of interested 
parties. 
 
 
 
Comment 8 Amilcar do Carmo Lucas 2003-09-19 18:57:53 UTC
Somebody just submited a patch to fix KDirWatch to the kde-devel mailing list 
Comment 9 András Manţia 2003-09-20 19:55:25 UTC
A similar problem is present in Quanta (+ another one caused by the same new katepart feature). 
I've just sent a mail to the Kate developers about this. 
 
Andras 
Comment 10 Jason Keirstead 2003-10-09 14:31:10 UTC
Same problem here :P

On another note: Why has the file modified behaviour changed in KDE head? for
the worse?

In Kate up until a few weeks ago, if a file was modified by another process
while you were editing it, a box appeared telling you this and asking you if you
want to re-load the modified file.

Now, it just puts this red X in the task list, and offers you *no way* to
re-load it. All you can do is close it and re-open it, which is a huge PITA when
working with large numbers of files. 

Also, when you go to save a modified file, it says "this file has been modified
on disk, do you want ot cancel the save or overwrite". But without being able to
re-load or diff, how am I supposed to know what I want to do?

My suggestion is to bring back the old file modified behaviour with the reload
option. Also add a new option to diff the two files. The diff program could be
chosen in a config, or use kdiff, or whatever. Anything so that you can make an
intelligent decision as to if you should keep your changes.
Comment 11 Amilcar do Carmo Lucas 2003-11-01 17:59:22 UTC
This works fine with KDE 3.1 and AFAIK KDE HEAD too.
Closing, fell free to reopen if problem presists with KDevelop HEAD and KDE HEAD