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: Sat, 20 Feb 2021 11:09:35 +0200 Message-ID: <838s7j14xc.fsf@gnu.org> References: <83sg5r276b.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6442"; 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 Sat Feb 20 10:11:16 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 1lDOIG-0001a6-6h for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Feb 2021 10:11:16 +0100 Original-Received: from localhost ([::1]:36148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lDOIF-0008Hv-0o for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Feb 2021 04:11:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lDOI2-0008Ho-HI for bug-gnu-emacs@gnu.org; Sat, 20 Feb 2021 04:11:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39454) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lDOI2-0004Tq-8j for bug-gnu-emacs@gnu.org; Sat, 20 Feb 2021 04:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lDOI2-0006w3-3Z for bug-gnu-emacs@gnu.org; Sat, 20 Feb 2021 04:11: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: Sat, 20 Feb 2021 09:11: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.161381220226568 (code B ref 46397); Sat, 20 Feb 2021 09:11:02 +0000 Original-Received: (at 46397) by debbugs.gnu.org; 20 Feb 2021 09:10:02 +0000 Original-Received: from localhost ([127.0.0.1]:51000 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lDOH3-0006uN-JA for submit@debbugs.gnu.org; Sat, 20 Feb 2021 04:10:02 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lDOH1-0006u2-Cr for 46397@debbugs.gnu.org; Sat, 20 Feb 2021 04:09:59 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40864) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lDOGu-0003w5-RI; Sat, 20 Feb 2021 04:09:52 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2453 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lDOGu-0004Rn-4U; Sat, 20 Feb 2021 04:09:52 -0500 In-Reply-To: (message from Matt Armstrong on Fri, 19 Feb 2021 13:46:27 -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:200407 Archived-At: > From: Matt Armstrong > Cc: 46397@debbugs.gnu.org, eggert@cs.ucla.edu, craven@gmx.net > Date: Fri, 19 Feb 2021 13:46:27 -0800 > > >> I'm coming to the opinion that issuing a prompt from `unlock-buffer' > >> itself is a bad idea, but I think prompting from `kill-buffer' is > >> okay. > > > > What do you propose to do for all the other users of unlock-buffer? > > They continue to signal errors. > > I would be happy to send a list of reasons why I think this is a safer > thing to do than prompting. (reasons that I admit I could be misguided) I think we should audit all the callers of unlock_buffer and unlock_file, and see if signaling an error there is really the best alternative. I still think that prompting the user for what to do, with one of the possible responses being "ignore", could be a better solution, at least in some of these cases, because signaling an error means the results of some operation are lost. For example, consider replace-buffer-contents, which is a command -- we could signal the error there after everything, all the heavy processing, has been done already. Is that reasonable? Or are you relying on the ability of unlock_file to silently ignore the errors where the user should choose "ignore"? Because I'd like to explicitly NOT rely on that. So yes, a list of callers and the reasons not to prompt the user there would be a good starting point, TIA. > >> (a) Modify `kill-buffer' to call `unlock-buffer' sooner, closer to the > >> point where it is already running hooks prompting the user. > > > > Why do we need to move the call? Can we leave it in its current > > place, and thus minimize potential unintended problems this could > > cause? > > In part because `kill-buffer' currently calls `unlock-buffer' after this > comment: > > /* We have no more questions to ask. Verify that it is valid > to kill the buffer. This must be done after the questions > since anything can happen within do_yes_or_no_p. */ OK, but then the call to unlock_buffer should have all the conditions tested later, under which we will NOT kill the buffer. Because otherwise we could pop the question for a buffer that we are not going to kill. > (This class of problem is also one of the reasons for my answer above.) When the alternative is worse than what could possibly happen inside do_yes_or_no_p, we may decide to ask the question anyway.