GNU bug report logs -
#58721
28.2; dired with delete-by-moving-to-trash can't trash directory twice
Previous Next
Reported by: Gustavo Barros <gusbrs.2016 <at> gmail.com>
Date: Sat, 22 Oct 2022 18:24:01 UTC
Severity: normal
Found in version 28.2
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Eli Zaretskii wrote:
> > From: Gustavo Barros <gusbrs.2016 <at> 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
This bug report was last modified 2 years and 182 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.