From: Richard Copley <rcopley@gmail.com>
To: 43535@debbugs.gnu.org
Subject: bug#43535: File locking on Windows
Date: Sun, 20 Sep 2020 16:54:56 +0100 [thread overview]
Message-ID: <CAPM58ojymTZqaBSFUFOSB7k7qX_AHVGcAxOy00ZTcGfOtjE5Sw@mail.gmail.com> (raw)
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.
next reply other threads:[~2020-09-20 15:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-20 15:54 Richard Copley [this message]
2020-09-20 16:03 ` bug#43535: File locking on Windows 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPM58ojymTZqaBSFUFOSB7k7qX_AHVGcAxOy00ZTcGfOtjE5Sw@mail.gmail.com \
--to=rcopley@gmail.com \
--cc=43535@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).