After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 671250 - Gedit not seeing that file changed on disk when replaced by file with same name
Gedit not seeing that file changed on disk when replaced by file with same name
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: file loading and saving
3.13.x
Other Linux
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2012-03-03 12:35 UTC by Walter Garcia-Fontes
Modified: 2014-07-26 12:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GeditDocument: better externally modified check (979 bytes, patch)
2014-07-21 15:52 UTC, Sébastien Wilmet
committed Details | Review

Description Walter Garcia-Fontes 2012-03-03 12:35:18 UTC
1. make two test files with the same name, but in two different directories and with different content
2. make sure one of them is older than the other (in terms of creation and modification time, I didn't test which of those matters)
3. open the newer file in gedit (do NOT close gedit from this point on)
4. move the newer file to a different location
5. move the older file to be in the same directory where the newer file was in step 3
6. double click the older file in a file manager, the gedit window shows the contents of the newer file, i.e., it does not show the usual "File contents changed on disk, reload or cancel?" question.
Comment 1 Walter Garcia-Fontes 2012-03-03 12:39:27 UTC
See also:

https://bugs.launchpad.net/gedit/+bug/893521
Comment 2 Sébastien Wilmet 2013-11-07 22:56:08 UTC
I confirm this bug.
Comment 3 Andreas Eibach 2013-12-18 14:25:47 UTC
This also applies to files used with append ( >> ). (Got 3.8 here, which is latest available packaged for Ubuntu (AFAIK).

Reproduction:

- Have a text file text.txt
- Open this file in gedit
- Append some text in console
echo " mary had a little lamb " >> text.txt

(expected)
You should get prompted "file has changed on disk. Do you want to reload?"

(actual)
It works very unreliably. To me it looks that from a certain number of lines (i. e. when the file grows to some decent size) this doesn't work at all anymore.

(WORKAROUND)
Use tabs!

(case 1 - when no tabs except for the one with the file)
Create a pseudo tab just next to the tab where your file is edited. Switch to pseudo tab and then back to file, and you WILL get that prompt.

(case 2 when other tabs _are_ available)
Just switch to random tab and back to file you're editing.
Prompt will show up.

Currently it's about like you have to "kick gedit in the butt" so that it display the orange 'File has changed' infobox. :)
Comment 4 Sébastien Wilmet 2014-07-21 15:52:24 UTC
Created attachment 281324 [details] [review]
GeditDocument: better externally modified check
Comment 5 Sébastien Wilmet 2014-07-21 15:54:58 UTC
The bug is actually still in gedit. I think the patch will work fine, but I'm not 100% sure (maybe the mtime can slightly be modified without any modification, but I doubt it).
Comment 6 Paolo Borelli 2014-07-26 12:42:49 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 7 Paolo Borelli 2014-07-26 12:43:30 UTC
Review of attachment 281324 [details] [review]:

pushed