GNU bug report logs - #58721
28.2; dired with delete-by-moving-to-trash can't trash directory twice

Previous Next

Package: emacs;

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


Message #56 received at 58721 <at> debbugs.gnu.org (full text, mbox):

From: Gustavo Barros <gusbrs.2016 <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 58721 <at> debbugs.gnu.org
Subject: Re: bug#58721: 28.2; dired with delete-by-moving-to-trash can't trash
 directory twice
Date: Fri, 28 Oct 2022 13:06:14 -0300
Hi Stefan,

On Fri, 28 Oct 2022 at 12:26, Stefan Kangas <stefankangas <at> gmail.com> wrote:

> I get the same result.  But I think this is expected, as the
> `rename-file' docstring says:
>
>     For NEWNAME to be recognized as a directory name, it should
>     end in a slash.
>
> So this function seems to be working as documented.

Thanks for trying! I'm glad I'm not mad. :-)

I had missed this bit of the docstring, and you're right, of course.
So, it seems we are back to `move-file-to-trash', and how it calls
`rename-file'.

I've redefined `move-file-to-trash' to message `new-fn` right before
`rename-file' is being called. And tested both:

    (move-file-to-trash "/path/to/orig/barbaz")
    (move-file-to-trash "/path/to/orig/barbaz/")

And both cases output things like:

Back to top level
/home/<username>/.local/share/Trash/files/barbazOfwLav
Entering debugger...
Back to top level
/home/<username>/.local/share/Trash/files/barbazVICScf
Entering debugger...
Back to top level
/home/<username>/.local/share/Trash/files/barbazVd4241
Entering debugger...
Back to top level
/home/<username>/.local/share/Trash/files/barbaz04EjUm
Entering debugger...
Back to top level

That is, no end slash appended to the directory at
`move-file-to-trash'. So, it appears we have a good suspect. Why it
works when the filesystem is the same still beats me.




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.