unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43535: File locking on Windows
@ 2020-09-20 15:54 Richard Copley
  2020-09-20 16:03 ` Eli Zaretskii
  2020-09-20 16:14 ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Richard Copley @ 2020-09-20 15:54 UTC (permalink / raw)
  To: 43535

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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-29 20:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-20 15:54 bug#43535: File locking on Windows Richard Copley
2020-09-20 16:03 ` Eli Zaretskii
2020-09-20 16:14 ` Eli Zaretskii
2020-09-20 17:32   ` Richard Copley
2021-07-31 13:05     ` Lars Ingebrigtsen
2021-07-31 13:36       ` Richard Copley
2021-07-31 14:15         ` Lars Ingebrigtsen
2021-08-29 20:17           ` Lars Ingebrigtsen

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).