Subject: bug#13149: 24.3.50;Emacs thinks file was changed outside Emacs, but it was not

From: Paul Eggert <[email-masked]>
Date: Fri, 01 Feb 2013 14:22:00 -0800

On 02/01/13 14:14, Drew Adams wrote:

> No, sorry.  I don't build Emacs.  If there is a Lisp change I can test that, but
> not a C change.

I suppose I could install this patch into the trunk instead,
temporarily.  Eli, do you think it'd be a good idea?

=== modified file 'src/fileio.c'
--- src/fileio.c	2013-02-01 20:51:12 +0000
+++ src/fileio.c	2013-02-01 22:19:12 +0000
@@ -5051,6 +5051,26 @@ This calls `write-region-annotate-functi
 		  st.st_size = st1.st_size;
 		  modtime = modtime1;
 		}
+
+#ifdef DOS_NT
+	      /* Temporary hack to diagnose file time stamp bug.  */
+	      {
+		char format[sizeof "write-region ? .000000000 .000000000: %s"
+			    + 2 * INT_STRLEN_BOUND (long)];
+		if (valid_timestamp_file_system
+		    && st.st_dev == timestamp_file_system)
+		  sprintf (format, "write-region = %ld.%09d: %%s",
+			   (long) EMACS_SECS (modtime),
+			   (int) EMACS_NSECS (modtime));
+		else
+		  sprintf (format, "write-region ? %ld.%09d %ld.%09d: %%s",
+			   (long) EMACS_SECS (modtime),
+			   (int) EMACS_NSECS (modtime),
+			   (long) EMACS_SECS (modtime1),
+			   (int) EMACS_NSECS (modtime1));
+		add_to_log (format, filename, Qnil);
+	      }
+#endif
 	    }
 	  emacs_close (desc1);
 	}