[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16669: inconsistent 'rm -ir' prompting behavior

From: Pádraig Brady
Subject: bug#16669: inconsistent 'rm -ir' prompting behavior
Date: Thu, 06 Feb 2014 17:44:11 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 02/06/2014 04:39 PM, Eric Blake wrote:
> On today's Austin Group call, we discussed
> http://austingroupbugs.net/view.php?id=802 regarding 'rm' behavior.
> They pointed out that GNU has an optimization not allowed by a strict
> reading of the current standard:
> $ mkdir foo
> $ rm -ir foo
> rm: remove directory ‘foo’?
> Whether you answer yes or no, the point remains: rm only prompted once
> about removing the empty directory


> Conversely, consider:
> $ rm -ir foo
> rm: descend into directory ‘foo’? y
> rm: remove regular empty file ‘foo/bar’? n
> rm: remove directory ‘foo’? y
> rm: cannot remove ‘foo’: Directory not empty
> Why on earth are we prompting to remove 'foo' when we KNOW it is
> non-empty because the user specifically asked to not remove foo/bar?  If
> we can optimize from two prompts down to one for the empty directory
> case, why are we not optimizing and avoiding asking a useless prompt for
> a known non-empty directory?

The different handling could be useful I think.

When we determine there are no files in a dir,
then only one prompt is necessary.

If we determine files are present a separate prompt
is useful to cater for the following sequence
in terminal 1 and terminal 2.

1> $ rm -ir foo
1> rm: descend into directory ‘foo’? y
1> rm: remove regular empty file ‘foo/bar’? n
1> rm: remove directory ‘foo’?

2> mv foo/bar /safe/foo  # Handle this unknown file _independently_

1> y


reply via email to

[Prev in Thread] Current Thread [Next in Thread]