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

From: Stefan Kangas <[email-masked]>
Date: Fri, 28 Oct 2022 08:26:15 -0700

Gustavo Barros <[email-masked]> writes:

> I've tried to isolate things from the Trash issue, and I could
> reproduce the problem with the following steps.
>
> I grabbed two USB sticks, formatted both of them with EXT4 (I used
> Mint's "USB Stick formatter" tool, I suppose it is pretty standard in
> what it does), labeled each "orig" and "dest". Mounted both.
>
> In the terminal, I did:
>
> $ cd /path/to/orig
> $ mkdir barbaz
> $ cd barbaz
> $ dd if=/dev/zero of=zero.file bs=1024 count=204800
> $ cd /path/to/dest
> $ mkdir barbaz-foobar
>
> I started "emacs -Q", and issued:
>
> (rename-file "/path/to/orig/barbaz" "/path/to/dest/barbaz-foobar" t)
>
> And got "(file-already-exists "File exists" "/path/to/dest/barbaz-foobar")"

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.