[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it
From: |
Dmitry Gutov |
Subject: |
bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not |
Date: |
Fri, 18 Jan 2013 18:45:14 +0400 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
On 18.01.2013 11:56, Eli Zaretskii wrote:
Date: Thu, 17 Jan 2013 21:25:31 -0800
From: Paul Eggert <eggert@cs.ucla.edu>
CC: 13149@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
On 01/17/2013 09:10 PM, Dmitry Gutov wrote:
cifs:
1358485764.638001400 fstat
1358485764.638001400 lstat
1358485764.638001400 stat
*
1358485764.638001400 fstat
1358485764.638001400 lstat
1358485764.638001400 stat
That looks busted, since there's
a 10 ms sleep followed by a write at the two
points I marked "*" above, which means that
fstat, lstat, and stat are all wrong after the "*".
Who said anything was actually written to the file? You'd need
'fsync' to be sure, don't you?
Sticking fsync(fd) after the call to 'write' doesn't change anything.
If, however, I move the 'nanosleep' after the 'write' and set the
interval to 1 or 2 seconds, on vboxsf the numbers often become
different, but without guarantee. With 1 second, they usually the same,
with 2 second, they're mostly different, but still the same sometimes.
gutov@vbx:~/docs/Ruby$ ~/emacs-bzr/fs-test2
1358520180.757726300 fstat
1358520180.757726300 lstat
1358520180.757726300 stat
1358520181.689844700 fstat
1358520181.689844700 lstat
1358520181.689844700 stat
gutov@vbx:~/docs/Ruby$ ~/emacs-bzr/fs-test2
1358520183.414063600 fstat
1358520183.414063600 lstat
1358520183.414063600 stat
1358520183.414063600 fstat
1358520183.414063600 lstat
1358520183.414063600 stat
Adding another 'nanosleep' before the 'write' doesn't change that.
On cifs, the numbers are never different.
#include <fcntl.h>
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
static int
report_times (int fd, char const *file)
{
struct stat fst, lst, st;
if (fstat (fd, &fst) != 0)
return perror ("fstat"), -1;
if (lstat (file, &lst) != 0)
return perror ("lstat"), -1;
if (stat (file, &st) != 0)
return perror ("stat"), -1;
printf ("%ld.%09ld fstat\n", (long) fst.st_mtim.tv_sec,
fst.st_mtim.tv_nsec);
printf ("%ld.%09ld lstat\n", (long) lst.st_mtim.tv_sec,
lst.st_mtim.tv_nsec);
printf ("%ld.%09ld stat\n", (long) st.st_mtim.tv_sec,
st.st_mtim.tv_nsec);
printf ("\n");
return 0;
}
int
main (void)
{
static char const file[] = "foo";
struct timespec interval, bef_interval;
int fd;
unlink (file);
fd = open (file, O_CREAT | O_WRONLY, -1);
if (fd < 0)
return perror ("open"), 1;
if (report_times (fd, file) != 0)
return 1;
bef_interval.tv_sec = 0;
bef_interval.tv_nsec = 100000000;
interval.tv_sec = 2;
interval.tv_nsec = 0;
// if (nanosleep (&bef_interval, 0) != 0)
// return perror ("nanosleep"), 1;
if (write (fd, file, sizeof file - 1) != sizeof file - 1)
return perror ("write"), 1;
// fsync(fd);
if (nanosleep (&interval, 0) != 0)
return perror ("nanosleep"), 1;
if (report_times (fd, file) != 0)
return 1;
return 0;
}
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, (continued)
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Paul Eggert, 2013/01/17
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Dmitry Gutov, 2013/01/17
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Paul Eggert, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Dmitry Gutov, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Paul Eggert, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Dmitry Gutov, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Dmitry Gutov, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Eli Zaretskii, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not,
Dmitry Gutov <=
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Paul Eggert, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Dmitry Gutov, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Paul Eggert, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Dmitry Gutov, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Paul Eggert, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Dmitry Gutov, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Paul Eggert, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Drew Adams, 2013/01/19
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, Eli Zaretskii, 2013/01/18
- bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not, David Engster, 2013/01/17