Subject: bug#49711: 27.2; Deleting a directory called ~ deletes home directory

From: Al Haji-Ali <[email-masked]>
Date: Fri, 23 Jul 2021 18:08:35 +0100

On 23/07/2021, Lars Ingebrigtsen wrote:

> Al Haji-Ali <[email-masked]> writes:
>
>> In dired, if I delete a directory called `~` (not related to home
>> directory, I created this directory by mistake) and delete it, dired
>> deletes the home directory instead.
>
> I'm unable to reproduce this in Emacs 27.2 or 28.  Here's my test case:
>
> touch '/tmp/~'
> emacs -Q /tmp/
>
> Then hit `D yes RET' on the ~ file.
>
> That deletes /tmp/~ for me, and not the home directory.
>
> Do you have a step-by-step recipe, starting from "emacs -Q" for how to
> reproduce the problem you're seeing?
Apologies, I should have specified that I have `delete-by-moving-to-trash` set to `t`.
Otherwise, the exact steps you mentioned reproduce this for me on 27.2

If I keep `delete-by-moving-to-trash` as the default nil, I don't see this behaviour.

-- Al