Matt Armstrong writes: > "Peter" writes: > >> The following steps reproduce this: >> - Make sure /tmp/tmp does not exist >> - Open a buffer /tmp/tmp/foo.txt >> - Make some changes to the buffer. >> - Do *not* save the buffer or create the directory /tmp/tmp/ >> - Create /tmp/tmp as a *file* (not a directory) >> - Try to kill the buffer. >> >> You will see the following error message: >> >> Unlocking file: Not a directory, /tmp/tmp/foo.txt >> >> I just want to kill the buffer, I don't want to save it. [...] > The backtrace is unsurprising: > > Debugger entered--Lisp error: (file-error "Unlocking file" "Not a directory" "/private/tmp/tmp/test.txt") > kill-buffer("test.txt") > funcall-interactively(kill-buffer "test.txt") > call-interactively(kill-buffer nil nil) > command-execute(kill-buffer) I found that this behavior was introduced by Paul Egger's commit 9dc306b1db0, discussed in Bug#37389. I've cc'd Paul. Paul's commit changed unlock_file() (from src/filelock.cc) to report errors from unlink(), excempting only ENOENT. This bug demonstrates a way to induce an ENOTDIR error. I've attached a patch that ignores ENOTDIR as well, which is the most conservative fix I can think of. It also seems in-line with Paul's original intent, since he was saying that both ENOENT and ENOTDIR are usually "tame."