aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-11-12 17:35:14 -0800
committerPaul Eggert2012-11-12 17:35:14 -0800
commitb95a9c0cba301ef8f1920a1d123ccd6873c14a63 (patch)
treecb96c62e6c09a18a9e499e5943ab530f67868ae5 /src
parent231d8498eb1a10fadf7a4cd860cc934e05516433 (diff)
downloademacs-b95a9c0cba301ef8f1920a1d123ccd6873c14a63.tar.gz
emacs-b95a9c0cba301ef8f1920a1d123ccd6873c14a63.zip
Fix a race with verify-visited-file-modtime.
Since at least 1991 Emacs has ignored an mtime difference of no more than one second, but my guess is that this was to work around file system bugs that were fixed long ago. Since the race is causing problems now, let's remove that code. * fileio.c (Fverify_visited_file_modtime): Do not accept a file whose time stamp is off by no more than a second. Insist that the file time stamps match exactly. Fixes: debbugs:12863
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/fileio.c10
2 files changed, 13 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e8ac547ff2a..5905c667852 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12012-11-13 Paul Eggert <eggert@cs.ucla.edu>
2
3 Fix a race with verify-visited-file-modtime (Bug#12863).
4 Since at least 1991 Emacs has ignored an mtime difference of no
5 more than one second, but my guess is that this was to work around
6 file system bugs that were fixed long ago. Since the race is
7 causing problems now, let's remove that code.
8 * fileio.c (Fverify_visited_file_modtime): Do not accept a file
9 whose time stamp is off by no more than a second. Insist that the
10 file time stamps match exactly.
11
12012-11-12 Dmitry Antipov <dmantipov@yandex.ru> 122012-11-12 Dmitry Antipov <dmantipov@yandex.ru>
2 13
3 * frame.h (struct frame): Convert external_tool_bar member to 14 * frame.h (struct frame): Convert external_tool_bar member to
diff --git a/src/fileio.c b/src/fileio.c
index d47d7dd9e0b..b9541e78838 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5076,7 +5076,7 @@ See Info node `(elisp)Modification Time' for more details. */)
5076 struct stat st; 5076 struct stat st;
5077 Lisp_Object handler; 5077 Lisp_Object handler;
5078 Lisp_Object filename; 5078 Lisp_Object filename;
5079 EMACS_TIME mtime, diff; 5079 EMACS_TIME mtime;
5080 5080
5081 if (NILP (buf)) 5081 if (NILP (buf))
5082 b = current_buffer; 5082 b = current_buffer;
@@ -5101,13 +5101,7 @@ See Info node `(elisp)Modification Time' for more details. */)
5101 mtime = (stat (SSDATA (filename), &st) == 0 5101 mtime = (stat (SSDATA (filename), &st) == 0
5102 ? get_stat_mtime (&st) 5102 ? get_stat_mtime (&st)
5103 : time_error_value (errno)); 5103 : time_error_value (errno));
5104 if ((EMACS_TIME_EQ (mtime, b->modtime) 5104 if (EMACS_TIME_EQ (mtime, b->modtime)
5105 /* If both exist, accept them if they are off by one second. */
5106 || (EMACS_TIME_VALID_P (mtime) && EMACS_TIME_VALID_P (b->modtime)
5107 && ((diff = (EMACS_TIME_LT (mtime, b->modtime)
5108 ? sub_emacs_time (b->modtime, mtime)
5109 : sub_emacs_time (mtime, b->modtime))),
5110 EMACS_TIME_LE (diff, make_emacs_time (1, 0)))))
5111 && (st.st_size == b->modtime_size 5105 && (st.st_size == b->modtime_size
5112 || b->modtime_size < 0)) 5106 || b->modtime_size < 0))
5113 return Qt; 5107 return Qt;