[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rm feature: don't attempt to remove the same file twice
From: |
Pádraig Brady |
Subject: |
Re: rm feature: don't attempt to remove the same file twice |
Date: |
Sat, 3 Sep 2016 18:06:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 01/09/16 11:00, Ed Avis wrote:
> % touch a
> % rm a a
> rm: cannot remove 'a': No such file or directory
>
> It might be better for rm to remember that it has seen the filename 'a'
> before, and just warn rather than check the filesystem again.
> This would be a bit more user-friendly and a bit faster, if you accept that
> filesystem operations are slower than doing user-space checking of seen
> filenames.
> It would not catch 'rm a ./a' and similar cases but it would be an
> improvement.
I'm inclined to leave this as is
as it's not a common issue, nor particularly confusing.
Also consider the following cases where you would want the warning:
$ bar=bar
$ touch foo foo$bar
$ rm foo foo$Bar
$ touch foo ../foo
$ rm foo ./foo
thanks,
Pádraig