From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gustavo Barros Newsgroups: gmane.emacs.bugs Subject: bug#58721: 28.2; dired with delete-by-moving-to-trash can't trash directory twice Date: Thu, 27 Oct 2022 19:01:27 -0300 Message-ID: References: <83r0ytl042.fsf@gnu.org> <83bkpxkwcd.fsf@gnu.org> <838rl1ku1b.fsf@gnu.org> <837d0lks02.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33616"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58721@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 28 00:02:17 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 1ooAx6-0008aH-US for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Oct 2022 00:02:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooAwv-0004TP-Vk; Thu, 27 Oct 2022 18:02:06 -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 1ooAws-0004Rw-Mr for bug-gnu-emacs@gnu.org; Thu, 27 Oct 2022 18:02:03 -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 1ooAws-0002Hb-EO for bug-gnu-emacs@gnu.org; Thu, 27 Oct 2022 18:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ooAws-0004aA-03 for bug-gnu-emacs@gnu.org; Thu, 27 Oct 2022 18:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gustavo Barros Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Oct 2022 22:02: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.166690810817585 (code B ref 58721); Thu, 27 Oct 2022 22:02:01 +0000 Original-Received: (at 58721) by debbugs.gnu.org; 27 Oct 2022 22:01:48 +0000 Original-Received: from localhost ([127.0.0.1]:59581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ooAwd-0004ZZ-Nv for submit@debbugs.gnu.org; Thu, 27 Oct 2022 18:01:48 -0400 Original-Received: from mail-pl1-f173.google.com ([209.85.214.173]:41595) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ooAwb-0004ZH-6N for 58721@debbugs.gnu.org; Thu, 27 Oct 2022 18:01:45 -0400 Original-Received: by mail-pl1-f173.google.com with SMTP id io19so3056346plb.8 for <58721@debbugs.gnu.org>; Thu, 27 Oct 2022 15:01:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=e/eShk6GgLfEpcKHYugtpfCEdvkiV9sZXRTRO/IIgSQ=; b=U3inat6gZzg2R8Gu+eElKWPV4HqLMGwVa6J+NKlarRtaaRD9DWMDZrIR3zDnqSREWO BvP80P0cR4QXgNgaXzW1ad8Z6GLH1MI2q7OyfLZHUmcguqk+uhR7BSJlLKZM0wn6Traj lk13utlvYxp5Jzw81l6x73rs4ZkMANXbwgufMSCFqSVXAfO7IiiKR2QQPtSi/jjVM59Y Qqb7Oct4zj+FqaSV9QREVHGmm2NYFBNtP9bg+vQwFRUAf6RD+t9nDgTac4sAGAL9Dhci SmNYucyzBnZhPRdoBS7pGUvb7FmUuPIYW/1zsxvbn7qmae+cWxizpS1jGU396VJKaVIY TOfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=e/eShk6GgLfEpcKHYugtpfCEdvkiV9sZXRTRO/IIgSQ=; b=eYTvSSLZsLgXk+EF4FUhdBYVR8vZ9zfk6MEJ8Yte6txrgMGWTiuwr0AYMyQkMpKBgc dcOUbKAoaKKL6dTj7rKFYwlfAKpXiEbCK4LuvG/DzrECwRLlGS4W+uV3NTrmI00/Ee3h aU0d26t9WtZeRkh9uoTQomZNEB4oRERwbyL5jF6224dvrm7ehqPjDYTzoOzzMn6mOaAB dthmisXO/NyW6Jwpd+SgRkBnsZLDaIeOYkORLEcV4RF6B3i3m+WVrfFIzNUfOp+zP+V3 u8mZKFLu31WpyeZHP3q/B+HojRh0rC2ow4J14mjFIHoZWRXDS7me5jqTBiOlONcXoTIq LQDg== X-Gm-Message-State: ACrzQf2VM32+Y39ogGq3P5S/XtVBQWEHuc8kor9xC3+lCh1rPmSWwARU DbZ2U+lQizHjfDUY17CQ6lUuaHhv5VZ/NRvgJss= X-Google-Smtp-Source: AMsMyM5vhfiBPqlu2Pxoxo2+vST51iiwdpka0hInqukpl+tEOYNbaz5AG8Y8SjfLA8e8KliFsn7VdtPbAizRoiH7RzE= X-Received: by 2002:a17:90b:4b42:b0:20d:954e:28d with SMTP id mi2-20020a17090b4b4200b0020d954e028dmr12714725pjb.93.1666908099084; Thu, 27 Oct 2022 15:01:39 -0700 (PDT) In-Reply-To: <837d0lks02.fsf@gnu.org> 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@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246375 Archived-At: Hi Eli, On Thu, 27 Oct 2022 at 16:04, Eli Zaretskii wrote: > Perhaps step in Edebug through copy-directory, and see what's going on > there? AFAIU, the problem happens inside that function. I think I was able to narrow it down a little. The empty directory is indeed created, when the file already exists, by the call to `make-temp-file' at: (when (file-exists-p (file-name-concat trash-files-dir files-base)) (setq overwrite t files-base (file-name-nondirectory (make-temp-file (file-name-concat trash-files-dir files-base) is-directory)))) But, at the same time, the `overwrite' flag is set to t, in this case. I'm not sure why the file is actually created, I suppose that it is to "reserve" that name and ensure nothing else takes it in the meantime. At the end of the function, the call is done to: (rename-file fn new-fn overwrite) But, when the operation is crossing filesystems and the file is large enough, the `rename-file' will fail with "file exists", despite the `OK-IF-ALREADY-EXISTS' argument being `t'. You can try that with: (make-directory "~/.local/share/Trash/files/org-mode-foo-bar") (rename-file "/tmp/org-mode" "~/.local/share/Trash/files/org-mode-foo-bar" t) Provided "crossing filesystems" and "large enough" we get (I do, at least) "(file-already-exists "File exists" ..." WDYT? Can you reproduce this?