GNOME Bugzilla – Bug 156085
Document autosave overwrites file modified externally
Last modified: 2005-12-15 16:02:53 UTC
Distribution: Debian 3.1 Package: gedit Severity: major Version: GNOME2.8.1 2.8.x Gnome-Distributor: Debian Synopsis: Document autosave overwrites file modified externally Bugzilla-Product: gedit Bugzilla-Component: general Bugzilla-Version: 2.8.x Description: Description of Problem: I occasionally open a file in gedit to check a problem, and then modify the file with another tool (Perl, sed, whatever). With autosave turned on, gedit will save the file without checking that it's been externally modified -- overwriting my external changes. Steps to reproduce the problem: 1. Turn on autosave in Preferences. 2. Open a file in gedit. 3. In another window, change the file with another tool (and possibly another gedit instance...?) 4. Wait N minutes. 5. Check the file. Actual Results: The version in the gedit window will have been autowritten to the file. Expected Results: gedit wouldn't write to the file if it has been modified since the last gedit save. How often does this happen? Every time. Additional Information: Lots of text editors check the last mod time of a file against a recorded last save time. It might be a good idea to do this globally. ------- Bug moved to this database by unknown@bugzilla.gnome.org 2004-10-21 14:57 ------- Unknown platform unknown. Setting to default platform "Other". Unknown milestone "unknown" in product "gedit". Setting to default milestone for this product, '---' Setting to default status "UNCONFIRMED". Setting qa contact to the default for this product. This bug either had no qa contact or an invalid one.
I agree with you. We should fix this problem.
This is not an AutoSave problem. I don't use autosave and get bitten by this bug when I'm editing stuff that's CVS controlled. I edit the file locally, and save and commit it to CVS. If I later on update the file from CVS and edit it again gedit won't notice the file changed from under it and will overwrite it. Emacs detects that the file has changed when it's being saved and asks if I want to overwrite. A better option would be to detect that it has changed just when it happens and ask the user if he wants to reload the file. libfam can be used for this but doing both things is probably best, so that correct behaviour is maintained when fam/gamin isn't working.
yep, monitoring files it is something that we should take into consideration again at some point, see also http://bugzilla.gnome.org/show_bug.cgi?id=75861. However, beside monitors, we should check the mtime of the file when saving.
yes, mtime checking was what I meant when I said that emacs checks if the file has changed when saving.
We do mtime checking in 2.13.0... autosave is still a bit under work, but since the actual saving is done in the document-saver and it takes mtime into account, I think we can declare this fixed.