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

From: Andy Moreton <[email-masked]>
Date: Mon, 20 Jan 2020 15:36:53 +0000

On Mon 20 Jan 2020, Paul Eggert wrote:

>> 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
>
> Yes in theory. However, Emacs already does the EINTR check for open, read and
> write even on regular files where POSIX says it can't happen (but it does
> happen with NFS). If you've recently dealt with an NFS file then it'll be
> cached on the client and you won't get EINTR, so in practice the issue comes
> up only for syscalls that are applied to a file that hasn't been looked at
> lately. stat is one of these calls (hence the bug report) so we might as well
> do the EINTR check for it as well. I installed the attached patch to do that
> for stat and similar calls, and also for openat (which I think was overlooked
> when 'open' was done).
>
> The other part of this bug report (with ENOENT) is not something Emacs can
> work around and it's surely a bug in the Linux NFS client that was most likely
> fixed a while ago anyway <https://bugzilla.kernel.org/show_bug.cgi?id=14541>.
>
> As I think both issues in the bug report have been addressed, I'm boldly closing it.

This patch breaks the build for Windows, as it appears that MinGW does
not have openat:

  CCLD     temacs.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: sysdep.o: in function `emacs_openat':
C:/emacs/git/emacs/master/src/sysdep.c:2486: undefined reference to `openat'
C:/emacs/git/emacs/master/src/sysdep.c:2486:(.text+0x1359): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `openat'
collect2.exe: error: ld returned 1 exit status

Presumably this will need updates to w32.c to add the necessary support.

    AndyM