Until this morning, my emacs setup (running on Arch Linux as a VirtualBox guest) was working absolutely fine. Then for no obvious reason I started experiencing the following issue:
If I opened an existing file for edit and immediately typed C-x C-s
, I would receive the following message:
Wrote <filename>
and this would happen every time I typed C-x C-s
, without actually editing the file. Whereas it should simply say
(No files need saving)
After wasting nearly the whole day trying to fix the problem, including upgrading VirtualBox related packages, I narrowed it down to the operation of the emacs function file-exists-p
which is being called by save-buffer
-> basic-save-buffer
. The issue is that while file-exists-p
works correctly in that it returns t
for files which are on my Linux file system, it returns nil
for files which are on my Windows 10 host which are shared through VirtualBox, mounted using VirtualBox's mount.vboxsf
. This in turn is causing the following additional prompt to be displayed any time I actually modify a buffer of a file I have already opened:
<filename> has changed since visited or saved. Save anyway? (y or n)
which of course it hasn't, but the code believes it has since file-exists-p
is returning nil
.
My question is why is file-exists-p
behaving in this way? Is it a problem with the function itself, or some other problem perhaps with the way the mounting is working? Is there some way to determine where the problem actually lies, and most important of all, how to fix it?
I am running:
Windows 10 (as host)
VirtualBox 5.2.18 (with Virtual Guest Additions installed on guest)
Arch Linux (as guest, Kernel 4.18.14)
Emacs 26.1