bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58721: 28.2; dired with delete-by-moving-to-trash can't trash direct


From: Mike Kupfer
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

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]