[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#43535: File locking on Windows
From: |
Richard Copley |
Subject: |
bug#43535: File locking on Windows |
Date: |
Sun, 20 Sep 2020 16:54:56 +0100 |
Recipe from "emacs -Q", on Windows:
Visit a file "x.cpp". Modify the buffer and don't save.
M-! clang-format -i *.cpp RET
This has the effect of altering the contents of the lock file
".#x.cpp". Most Windows programs that accept wildcards and edit files
in place will do the same, since they don't usually skip dot files.
Now we are in a pickle:
M-x revert-buffer RET
yes RET
Error: Unlocking file: Invalid argument, c:/x.cpp
C-x k RET
yes RET
Error: Unlocking file: Invalid argument, c:/x.cpp
C-x C-c
n
yes RET
Emacs doesn't close or print an error but becomes unusable, having
apparently deleted all windows. You can still use the minibuffer.
Delete the lock file and kill Emacs:
M-! del .#x RET
C-x C-c
n
yes RET
This is quite a cruel punishment for an understandable mistake. I
assume it started happening when Paul fixed the error handling in
"filelock.c". It happens on master and Emacs 27.2, and not on Emacs
26.3.
There is more than one conceivable way to avoid this. E.g., use a
different lock file name, keep the lock file open in deny-share mode
to prevent accidents, ignore certain errors while unlocking. In fact
I'd like to have an option to permanently disable creating lock files.
- bug#43535: File locking on Windows,
Richard Copley <=