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 409374 - GEdit misinforms the user a file has been modified when it has not
GEdit misinforms the user a file has been modified when it has not
Status: RESOLVED NOTABUG
Product: gedit
Classification: Applications
Component: general
2.16.x
Other All
: Normal minor
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2007-02-18 19:00 UTC by Jason Switzer
Modified: 2014-02-22 10:54 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16



Description Jason Switzer 2007-02-18 19:00:29 UTC
Please describe the problem:
When saving a file, if the access time on the file changes and the uses tries to save, the user is informed the file has been modified since being read. The file doesn't have to actually be modified for this, only accessed, which is is misleading and incorrect to tell the user it has been modified.

Steps to reproduce:
1. Open a file with gedit
2. Access the file (command-line: touch file)
3. Save the file with gedit


Actual results:
Prompted to save even though the file has been modified since being read.

Expected results:
No prompt since the file was not actually modified.

Does this happen every time?
Yes.

Other information:
None.
Comment 1 Paolo Borelli 2007-02-19 09:06:07 UTC
touch file is not "acessing a file" is _modifying_ a file: it changes the mtime (modification time) attribute of the file, not the atime (access time attribute).

This is exactly what touch and the mtime attribute are there for.
Comment 2 Jason Switzer 2007-02-20 00:06:26 UTC
Okay, that was a bad example, here's what I did to reproduce it.

Opened a file (Game.pm)
stat the file
Executed a perl script that included the module (Game.pm)
stat the file
save the file with gedit

Here's the stat on the command-line:

s1n@citadel $ stat Morris/Game.pm 
  File: `Morris/Game.pm'
  Size: 1462            Blocks: 8          IO Block: 4096   regular file
Device: 11h/17d Inode: 2246        Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/     s1n)   Gid: (  100/   users)
Access: 2007-02-19 17:59:06.000000000 -0600
Modify: 2007-02-19 17:59:06.000000000 -0600
Change: 2007-02-19 23:53:39.000000000 -0600
s1n@citadel $ time ./MiniMaxOpening.pl -v -i board1.txt 
Calculating static estimation B, W: xxBBxxWxxWxxWxxxBxxxx
Static Estimation Value: -2
Neighbors of 17: 1016

real    0m0.014s
user    0m0.004s
sys     0m0.004s
s1n@citadel $ stat Morris/Game.pm 
  File: `Morris/Game.pm'
  Size: 1462            Blocks: 8          IO Block: 4096   regular file
Device: 11h/17d Inode: 2246        Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/     s1n)   Gid: (  100/   users)
Access: 2007-02-19 17:59:06.000000000 -0600
Modify: 2007-02-19 17:59:06.000000000 -0600
Change: 2007-02-19 23:53:46.000000000 -0600
s1n@citadel $ stat Morris/Game.pm 
  File: `Morris/Game.pm'
  Size: 1462            Blocks: 8          IO Block: 4096   regular file
Device: 11h/17d Inode: 2246        Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/     s1n)   Gid: (  100/   users)
Access: 2007-02-19 17:59:06.000000000 -0600
Modify: 2007-02-19 17:59:06.000000000 -0600
Change: 2007-02-19 23:53:55.000000000 -0600


Note that before the last stat call, I attempted to save the file in gedit. Note that the file was not changed and the Modification time did not change but off the top of my head I cannot remember the difference between change and modification times. Either way, the file was not modified in any way, as per the modification time.

This is an extremely annoying behavior and if gedit is not responsible, then I will file a bug for the appropriate application.
Comment 3 Johannes Buchner 2010-04-10 03:16:10 UTC
I can not reproduce the bug with gedit 2.26.3. Granted, with touch the msg occurs.

But I also experience that the message pops up when I did not edit the file with another program, but just read it (e.g. with make). 

I don't have a reliable procedure to reproduce, I'll post one when I have. I'm on fat32,noatime.

Maybe comparing the disk version with the display version (e.g. file length + hash) would avoid such false positives.
Comment 4 Paolo Borelli 2014-02-22 10:54:03 UTC
I am closing this, we did not have any similar complains in years.

Sure, the mtime is an heuristic and can fail, but it exists more or less for this specific reason to have a quick way to check without reading and comparing the content which can be very expensive