bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Paul Eggert
Subject: bug#13149: 24.3.50; Emacs thinks file was changed outside Emacs, but it was not
Date: Thu, 17 Jan 2013 21:01:37 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

On 01/17/2013 08:36 PM, Dmitry Gutov wrote:
> The time stamps were identical in all combinations:

Did vboxsf and/or cifs report time stamps that
were not on 100-ns boundaries?  That would be a bug.

How about the following program?  What does it output?

#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;
  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;
  interval.tv_sec = 0;
  interval.tv_nsec = 10000000;
  if (nanosleep (&interval, 0) != 0)
    return perror ("nanosleep"), 1;
  if (write (fd, file, sizeof file - 1) != sizeof file - 1)
    return perror ("write"), 1;
  if (report_times (fd, file) != 0)
    return 1;
  return 0;
}






reply via email to

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