From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#46397: 27.1; Cannot delete buffer pointing to a file in a path that includes a file Date: Wed, 10 Feb 2021 17:05:30 +0200 Message-ID: <83a6scj745.fsf@gnu.org> References: <87h7mllgin.fsf@nexoid.at> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8501"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46397@debbugs.gnu.org, eggert@cs.ucla.edu, craven@gmx.net To: Matt Armstrong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 10 16:06:30 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9r4Y-00025X-C2 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Feb 2021 16:06:30 +0100 Original-Received: from localhost ([::1]:56016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9r4X-000244-5f for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Feb 2021 10:06:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9r48-00023X-S0 for bug-gnu-emacs@gnu.org; Wed, 10 Feb 2021 10:06:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9r46-0007Tc-DD for bug-gnu-emacs@gnu.org; Wed, 10 Feb 2021 10:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l9r46-0004dm-7K for bug-gnu-emacs@gnu.org; Wed, 10 Feb 2021 10:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Feb 2021 15:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46397 X-GNU-PR-Package: emacs Original-Received: via spool by 46397-submit@debbugs.gnu.org id=B46397.161296954317812 (code B ref 46397); Wed, 10 Feb 2021 15:06:02 +0000 Original-Received: (at 46397) by debbugs.gnu.org; 10 Feb 2021 15:05:43 +0000 Original-Received: from localhost ([127.0.0.1]:56851 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9r3m-0004dE-LT for submit@debbugs.gnu.org; Wed, 10 Feb 2021 10:05:42 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9r3i-0004cz-VX for 46397@debbugs.gnu.org; Wed, 10 Feb 2021 10:05:41 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44892) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9r3c-0007IG-J4; Wed, 10 Feb 2021 10:05:32 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3269 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l9r3b-0002K8-05; Wed, 10 Feb 2021 10:05:31 -0500 In-Reply-To: (message from Matt Armstrong on Tue, 09 Feb 2021 16:23:09 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199778 Archived-At: > From: Matt Armstrong > Date: Tue, 09 Feb 2021 16:23:09 -0800 > Cc: 46397@debbugs.gnu.org, Paul Eggert > > > 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." I think instead of ignoring some errors, we should allow the user to get out of these situations, after showing the error. That is, instead of silently ignoring the error on some low level, we should propagate it to userlock.el and allow the user to decide whether he/she wants to ignore the error or do something about that. These errors could mean something innocent, or they could mean something more serious, and we shouldn't second-guess which one is it. Letting the user decide will also seamlessly solve any other type of error that could happen when we try to delete the lock file. So how about coming up with a patch that shows the error message to the users and asks them whether or not to ignore that and kill the buffer? Thanks.