unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Bertrand Brelier <bertrand.brelier@gmail.com>
Cc: 19607@debbugs.gnu.org
Subject: bug#19607: issue with Emacs 24.4.1 but not with 24.3.1 : changed on disk; really edit the buffer
Date: Fri, 23 Jan 2015 14:27:25 -0800	[thread overview]
Message-ID: <54C2CACD.3040700@cs.ucla.edu> (raw)
In-Reply-To: <CADF9JrjjxZkF5GOrDZZVs5kW674LVaJkCSBvbkjUwWX+TBa9YQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

Thanks, the key problem is the fourth time the breakpoint is hit, where 
the output in your log looks like this:

Breakpoint 3, Fverify_visited_file_modtime (buf=27021317) at fileio.c:5338
5338      if (timespec_cmp (mtime, b->modtime) == 0
(gdb) p mtime
$7 = {
   tv_sec = 1422018451,
   tv_nsec = 132061000
}
(gdb) p b->modtime
$8 = {
   tv_sec = 1422018451,
   tv_nsec = 40059000
}

The two time stamps should be the same, but the nanoseconds component 
differ (the tv_sec components are the same, which is why we don't 
observe any bugs in the strace output).

I suspect a bug in the file system.  Can you please try running the 
attached program, with the current directory being that file system?  It 
should take about 2 seconds.  You might try running it twice (it may 
depend on whether the file already exists).

[-- Attachment #2: test.c --]
[-- Type: text/plain, Size: 1004 bytes --]

#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>

int
main (void)
{
  char const *filename = "test.txt";
  int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666);
  if (fd < 0)
    return perror ("open"), 1;
  static char const message[] = "This is a test.\n";
  int messagelen = sizeof message - 1;
  if (write (fd, message, messagelen) != messagelen)
    return perror ("write"), 1;
  if (fsync (fd) != 0)
    return perror ("fsync"), 1;
  struct stat st1, st2;
  if (fstat (fd, &st1) != 0)
    return perror ("fstat"), 1;
  if (close (fd) != 0)
    return perror ("close"), 1;
  sleep (2);
  if (stat (filename, &st2) != 0)
    return perror ("stat"), 1;
  if (! (st1.st_mtim.tv_sec == st2.st_mtim.tv_sec
	 && st1.st_mtim.tv_nsec == st2.st_mtim.tv_nsec))
    {
      printf ("last-modified times do not conform to:\n"
	      "http://pubs.opengroup.org/onlinepubs/"
	      "9699919799/basedefs/V1_chap04.html#tag_04_08\n");
      return 1;
    }
  return 0;
}

  reply	other threads:[~2015-01-23 22:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 13:23 bug#19607: issue with Emacs 24.4.1 but not with 24.3.1 : changed on disk; really edit the buffer Bertrand Brelier
2015-01-20  9:39 ` Paul Eggert
2015-01-20 13:19   ` Bertrand Brelier
2015-01-21  0:21     ` Paul Eggert
2015-01-21 13:12       ` Bertrand Brelier
2015-01-22  2:20         ` Paul Eggert
2015-01-22 14:16           ` Bertrand Brelier
2015-01-22 20:55             ` Paul Eggert
2015-01-22 21:26               ` Bertrand Brelier
2015-01-22 22:42                 ` Paul Eggert
2015-01-23 13:15                   ` Bertrand Brelier
2015-01-23 22:27                     ` Paul Eggert [this message]
2015-01-26 13:08                       ` Bertrand Brelier
2015-01-26 19:43                         ` Paul Eggert
2015-01-27 22:29                         ` Paul Eggert
2015-01-27 23:04                           ` Jakob Unterwurzacher
2015-01-28  4:56                             ` Paul Eggert
2015-03-23 18:58                               ` Glenn Morris
2015-03-24  0:13                                 ` Paul Eggert
2015-01-28 13:11                           ` Bertrand Brelier
2015-01-26 23:08 ` Jakob Unterwurzacher
2015-01-27 21:30 ` bug#19607: issue with Emacs 24.4.1 but not with 24.3.1 : changed on disk; Jakob Unterwurzacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C2CACD.3040700@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=19607@debbugs.gnu.org \
    --cc=bertrand.brelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).