emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111656: Fix timestamp bug when write


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111656: Fix timestamp bug when write-region appends nothing.
Date: Fri, 01 Feb 2013 12:51:12 -0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111656
fixes bug: http://debbugs.gnu.org/13149
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Fri 2013-02-01 12:51:12 -0800
message:
  Fix timestamp bug when write-region appends nothing.
  
  * fileio.c (Fwrite_region): When neither O_EXCL nor O_TRUNC is used,
  the file's time stamp doesn't change if Emacs happens to write nothing
  to the file, and on a buggy file system this could cause Emacs to
  incorrectly infer that the file system doesn't have the bug.
  Avoid this problem by inhibiting the inference in this case.
modified:
  src/ChangeLog
  src/fileio.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-02-01 07:23:18 +0000
+++ b/src/ChangeLog     2013-02-01 20:51:12 +0000
@@ -1,3 +1,12 @@
+2013-02-01  Paul Eggert  <address@hidden>
+
+       Fix timestamp bug when write-region appends nothing (Bug#13149).
+       * fileio.c (Fwrite_region): When neither O_EXCL nor O_TRUNC is used,
+       the file's time stamp doesn't change if Emacs happens to write nothing
+       to the file, and on a buggy file system this could cause Emacs to
+       incorrectly infer that the file system doesn't have the bug.
+       Avoid this problem by inhibiting the inference in this case.
+
 2013-02-01  Dmitry Antipov  <address@hidden>
 
        * window.h (struct window): Convert base_line_number, base_line_pos

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2013-02-01 06:30:51 +0000
+++ b/src/fileio.c      2013-02-01 20:51:12 +0000
@@ -5036,7 +5036,11 @@
              && st.st_dev == st1.st_dev && st.st_ino == st1.st_ino)
            {
              EMACS_TIME modtime1 = get_stat_mtime (&st1);
-             if (EMACS_TIME_EQ (modtime, modtime1)
+             /* If neither O_EXCL nor O_TRUNC is used, and Emacs happened to
+                write nothing to the file, the file's time stamp won't change
+                so it should not be used in this heuristic.  */
+             if ((open_flags & (O_EXCL | O_TRUNC)) != 0
+                 && EMACS_TIME_EQ (modtime, modtime1)
                  && st.st_size == st1.st_size)
                {
                  timestamp_file_system = st.st_dev;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]