Subject: bug#9256: Erroneous output from "verify-visited-file-modtime" (fileio.c)

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 23 Nov 2019 14:44:04 +0100

Vivien Mallet <[email-masked]> writes:

> One reason is that stat can return an EINTR error. I am running
> Linux. According to the manpages, stat is not supposed to fail with
> EINTR under a Posix system (contrary to SVr4), but this is what I
> observe. I checked with a call to printf right after the error, and I
> got errno == 4 which is EINTR here. After exposing this on IRC #emacs, I
> was told it could be due to the NFS mount (with option "intr") as the
> files are on a network NFS volume.

(There was unfortunately no response to this bug report when it was
reported eight years ago.)

Hm.  I'm not sure you can expect things to work with a setup like that,
really: I'd expect things to bug out pretty regularly across the board,
since you'd have to check for EINTR in every single call to a bunch of
system calls, and basically do what you do here everywhere:

>    filename = ENCODE_FILE (BVAR (b, filename));
 
> -  if (stat (SSDATA (filename), &st) < 0)
> +  while ((stat_status = stat (SSDATA (filename), &st)) < 0 && errno == EINTR);
> +
> +  /* if (stat (SSDATA (filename), &st) < 0) */
> +  if (stat_status < 0)

> This solved only part of the problem. I still get a lot of false 'nil'
> from "(verify-visited-file-modtime (current-buffer))" because stat
> returns ENOENT. One may argue this comes from my network, but the
> problem appears only inside Emacs.

Indeed.  Does anybody have an opinion on whether this is a configuration
Emacs supports?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no