unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mike Kupfer <mkupfer@alum.berkeley.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 58721@debbugs.gnu.org, Gustavo Barros <gusbrs.2016@gmail.com>
Subject: bug#58721: 28.2; dired with delete-by-moving-to-trash can't trash directory twice
Date: Fri, 28 Oct 2022 22:25:16 -0700	[thread overview]
Message-ID: <189664.1667021116@alto> (raw)
In-Reply-To: Your message of "Fri, 28 Oct 2022 14:44:29 +0300." <83edusjhpe.fsf@gnu.org>

Eli Zaretskii wrote:

> > From: Gustavo Barros <gusbrs.2016@gmail.com>
[...]
> > Can anyone else reproduce this, or is it really just me?
> 
> Yes, if someone else could reproduce, it could help.

I can reproduce it (Emacs 28.2, Debian 11).  I copied my ~/src/emacs-git
tree to various directories and then tried trashing it.

The failure only happened when trashing a tree that was on a separate
filesystem from $HOME, and then it happened reliably.  The type of
filesystem that contained the copy didn't seem to matter--I saw the
problem with both ext4 and vfat.  My $HOME is ext4.

When trashing a directory tree on the same filesystem, it's sufficient
to rename the top-level directory into the trash hierarchy.  But Unix
doesn't support that across filesystems, so the directory tree needs to
be copied into the trash hierarchy and then deleted at the original
location.  Since we see an empty directory after the error, I assume
that something is going wrong with the copy phase.

I set a breakpoint in #'copy-directory and got this stack:

* copy-directory("/tmp/emacs-git" "/home/kupfer/.local/share/Trash/files/emacs-gitH0l..." t nil)
  rename-file("/tmp/emacs-git" "/home/kupfer/.local/share/Trash/files/emacs-gitH0l..." t)
  move-file-to-trash("/tmp/emacs-git")
  delete-directory("/tmp/emacs-git" always t)
  dired-delete-file("/tmp/emacs-git" top t)
  dired-internal-do-deletions((("/tmp/emacs-git" . #<marker at 233 in tmp<>>)) nil t)
  dired-do-flagged-delete()
  funcall-interactively(dired-do-flagged-delete)
  call-interactively(dired-do-flagged-delete nil nil)
  command-execute(dired-do-flagged-delete)

The target directory (emacs-gitH0lx1e) already exists.

In fact, it looks like the target directory already exists when
#'rename-file is called.  But I think that's expected.

I clicked on the "..." in the backtrace to see whether the new name ends
with a "/", and it does not.

Hrm.  Shouldn't the call to copy-directory look like

  copy-directory("/tmp/emacs-git" "/home/kupfer/.local/share/Trash/files/emacs-gitH0l..." t nil t)
            ^^^

?

mike





  parent reply	other threads:[~2022-10-29  5:25 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22 18:23 bug#58721: 28.2; dired with delete-by-moving-to-trash can't trash directory twice Gustavo Barros
2022-10-27 16:09 ` Eli Zaretskii
2022-10-27 17:07   ` Gustavo Barros
2022-10-27 17:22     ` Gustavo Barros
2022-10-27 17:30     ` Eli Zaretskii
2022-10-27 17:51       ` Gustavo Barros
2022-10-27 18:20         ` Eli Zaretskii
2022-10-27 18:41           ` Gustavo Barros
2022-10-27 19:04             ` Eli Zaretskii
2022-10-27 19:13               ` Gustavo Barros
2022-10-27 22:01               ` Gustavo Barros
2022-10-28  7:46                 ` Eli Zaretskii
2022-10-28 10:43                   ` Gustavo Barros
2022-10-28 11:44                     ` Eli Zaretskii
2022-10-28 12:35                       ` Gustavo Barros
2022-10-28 15:26                         ` Stefan Kangas
2022-10-28 16:06                           ` Gustavo Barros
2022-10-28 19:07                             ` Gustavo Barros
2022-10-29  5:25                       ` Mike Kupfer [this message]
2022-10-29 10:35                         ` Gustavo Barros
2022-10-29 15:24                         ` Mike Kupfer
2022-10-29 15:48                           ` Eli Zaretskii
2022-10-29 16:32                             ` Mike Kupfer
2022-10-29 16:56                               ` Eli Zaretskii
2022-10-30  0:09                                 ` Mike Kupfer
2022-10-30  6:41                                   ` Eli Zaretskii
2022-10-30 17:40                                     ` Mike Kupfer
2022-10-30 18:02                                       ` Eli Zaretskii
2022-10-30 18:18                                         ` Mike Kupfer
2022-10-30 19:51                                           ` Eli Zaretskii
2022-10-30 22:20                                             ` Mike Kupfer
2022-10-30 23:10                                               ` Gustavo Barros
2022-10-31  0:01                                                 ` Mike Kupfer
2022-10-31  0:23                                                   ` Gustavo Barros
2022-10-31 12:49                                                   ` Eli Zaretskii
2022-10-31 13:16                                                     ` Gustavo Barros
2022-11-21  1:08                                                       ` Mike Kupfer
2022-11-21  1:45                                                         ` Gustavo Barros
2022-11-21  1:52                                                           ` Mike Kupfer
2022-11-24 11:19                                                         ` Eli Zaretskii
2022-11-24 11:28                                                           ` Gustavo Barros
2022-10-27 19:07             ` Gustavo Barros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=189664.1667021116@alto \
    --to=mkupfer@alum.berkeley.edu \
    --cc=58721@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gusbrs.2016@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).