[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27864: [request] safety to prevent `rm -rf ~`
From: |
Reuti |
Subject: |
bug#27864: [request] safety to prevent `rm -rf ~` |
Date: |
Fri, 28 Jul 2017 19:02:50 +0200 |
Hi,
> Am 28.07.2017 um 18:28 schrieb R0b0t1 <address@hidden>:
>
> I recently had a script create a file named "~" when I passed it a
> value for an installation directory.
Most likely as the input was taken literally and not expanded.
> Without thinking the next command
> I typed was the one in the title. Luckily this was not my main
> computer and was a virtual machine.
>
> It does not seem likely a user will ever intentionally type `rm -rf
> ~`. Deletion of home directories usually takes place as another user.
> Most of the arguments used for the addition of --no-preserve-roots and
> the `rm -rf /` safeties also seem to apply in this case, as just as
> one could erroneously type `rm -rf / directory` one could type `rm -rf
> ~ /directory` (or even the impressive yet redundant `rm -rf ~ /
> directory`).
Doesn't the Bash expand ~ with /home/your_user or whatever was set as home
directory? The `rm` will never see the plain ~, unless one writes ./~ or alike.
-- Reuti