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#58721: 28.2; dired with delete-by-moving-to-trash can't trash directory twice Date: Mon, 31 Oct 2022 14:49:08 +0200 Message-ID: <83y1swdupn.fsf@gnu.org> References: <58149.1667174501@alto> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3314"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58721@debbugs.gnu.org, gusbrs.2016@gmail.com To: Mike Kupfer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 31 13:50:43 2022 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 1opUFW-0000iD-DE for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Oct 2022 13:50:42 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opUF7-0008BU-Gc; Mon, 31 Oct 2022 08:50:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opUEv-00088a-FV for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 08:50:09 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opUEs-0001lM-AE for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 08:50:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opUEr-000501-SH for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 08:50:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Oct 2022 12:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58721 X-GNU-PR-Package: emacs Original-Received: via spool by 58721-submit@debbugs.gnu.org id=B58721.166722057219175 (code B ref 58721); Mon, 31 Oct 2022 12:50:01 +0000 Original-Received: (at 58721) by debbugs.gnu.org; 31 Oct 2022 12:49:32 +0000 Original-Received: from localhost ([127.0.0.1]:39732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opUEO-0004zD-9j for submit@debbugs.gnu.org; Mon, 31 Oct 2022 08:49:32 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52674) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opUEM-0004z1-DK for 58721@debbugs.gnu.org; Mon, 31 Oct 2022 08:49:31 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opUEG-0001Ub-Il; Mon, 31 Oct 2022 08:49:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=K2Vo6LwAk/qxMpKxeRhyQSQ/jAW2lSkYufcB+38b67w=; b=GiJ6vN+YNjXU vlNvQQMQPLQnMc9694EMIiUitjus5pQzgJ6cN/3MB3fOZb/vPBHI1iYf4ZIxqo4aZ6bUcc2lEwpRk IUrPFmncvkBENwrtQEguJka0WF7+Wr1XuAYRSbWrpUmGlWJTdT3Ly4uV3PL/yZZUhFMdN9HCuiEhB eS/6LeSTB1HdqGhq8WPilFnaTvrS1CuGQpn1lQSh40C29/oO2fOftez5kEQEzIajL/MS5YFwuiFzP tGmzf+yRBCWlEqwBYulDZt1mRsYR1IHFpF/rXTdnjADMNCtuL7py0QwF8R2ItIHA+BFjMY3fRgzFC CNKJkk/NRKWP/xLchL6/sQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opUEF-0003ox-Si; Mon, 31 Oct 2022 08:49:24 -0400 In-Reply-To: <58149.1667174501@alto> (message from Mike Kupfer on Sun, 30 Oct 2022 17:01:41 -0700) 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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246679 Archived-At: > From: Mike Kupfer > cc: Eli Zaretskii , 58721@debbugs.gnu.org > Date: Sun, 30 Oct 2022 17:01:41 -0700 > > Gustavo Barros wrote: > > > I may be wrong but, as far as my reading goes, I think this might > > misbehave if the "directory" is a symlink. `is-directory' is built as > > `(file-directory-p fn)' which returns t even if it is a symlink to a > > directory. > > Good point, thanks. I think this points out a pre-existing issue with > move-file-to-trash, in that the code to create a unique trash name will > create a directory, rather than a file. What is the expected semantics of moving a symlink to trashcan? Is it supposed to move the symlink or its target? (I'd think it's the former, but maybe my instincts are wrong.) If the expectations are that the symlink is moved, then all we need to do is to treat symlinks as regular files, by augmenting file-directory-p not to dupe us. > > Besides that, in general, imho I cannot think of this issue as > > something else other than a misbehavior of `rename-file', so that the > > patch in these terms feels like a workaround. > > I agree that it's an inconsistency in the behavior of rename-file. If > the thing being renamed is a file, the target gets replaced, whether or > not we're crossing filesystems. But if it's a directory, the target > gets replaced if it's in the same filesystem, but it's an error if the > target is in a different filesystem. If I understand Eli's concern, > it's a question of whether making the behavior more consistent is worth > the risk that it would break existing code--code that could assume the > current behavior. I'm okay with filing another bug report about rename-file, and discussing this there. But that's a separate issue, and fix of this bug should not depend on that.