Project

General

Profile

Actions

Bug #253

closed

rm -rf and recursive nothing

Added by justin almost 18 years ago. Updated over 17 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

I noticed something strange. I unpacked the pkgsrc tarball to the wrong
directory, and moved the contents. After copying it up, I deleted the
directory, which was empty.

dev# ls -la pkgsrc/
total 3
drwxr-xr-x 2 root wheel 1024 Jul 20 22:27 .
drwxr-xr-x 54 root wheel 1536 Jul 20 22:27 ..
dev# rm pkgsrc
rm: pkgsrc: is a directory
dev# rm -rf pkgsrc
recursively remove pkgsrc?

However, I still got the "recursively remove <dirname>" warning that comes
from trying to delete more than 3 files. It lists a total of 3, but only
names 2. This was on a 1.4.4 system

Actions #1

Updated by pavalos almost 18 years ago

On Thu, Jul 20, 2006 at 11:13:42PM -0400, Justin C. Sherrill wrote:

I noticed something strange. I unpacked the pkgsrc tarball to the wrong
directory, and moved the contents. After copying it up, I deleted the
directory, which was empty.

dev# ls -la pkgsrc/
total 3
drwxr-xr-x 2 root wheel 1024 Jul 20 22:27 .
drwxr-xr-x 54 root wheel 1536 Jul 20 22:27 ..
dev# rm pkgsrc
rm: pkgsrc: is a directory
dev# rm -rf pkgsrc
recursively remove pkgsrc?

However, I still got the "recursively remove <dirname>" warning that comes
from trying to delete more than 3 files. It lists a total of 3, but only
names 2. This was on a 1.4.4 system

Sounds like you have an alias for rm that does rm -I.

--Peter

Actions #2

Updated by justin almost 18 years ago

On Thu, July 20, 2006 10:45 pm, Peter Avalos wrote:

However, I still got the "recursively remove <dirname>" warning that
comes
from trying to delete more than 3 files. It lists a total of 3, but
only
names 2. This was on a 1.4.4 system

Sounds like you have an alias for rm that does rm -I.

Yeah, it's default. The heat must be addling my brain. Mentally, I
didn't expect -I to do anything when removing a single directory.

Actions #3

Updated by olli almost 18 years ago

Justin C. Sherrill wrote:
> dev# ls -la pkgsrc/
> total 3
> drwxr-xr-x 2 root wheel 1024 Jul 20 22:27 .
> drwxr-xr-x 54 root wheel 1536 Jul 20 22:27 ..
> dev# rm pkgsrc
> rm: pkgsrc: is a directory
> dev# rm -rf pkgsrc
> recursively remove pkgsrc?

This might be a dumb question, but why don't you use rmdir?
rmdir is the UNIX command to remove (empty) directories.

Personally I have an alias rd=rmdir (and md=mkdir), which
is a left-over from my old DOS days. :-)

By the way, shouldn't -f override any previous -i or -I
option? At least that's what I would expect. You don't
type -f without a reason.

Best regards
Oliver

Actions #4

Updated by swildner almost 18 years ago

Oliver Fromme wrote:

Justin C. Sherrill wrote:

dev# ls -la pkgsrc/
total 3
drwxr-xr-x 2 root wheel 1024 Jul 20 22:27 .
drwxr-xr-x 54 root wheel 1536 Jul 20 22:27 ..
dev# rm pkgsrc
rm: pkgsrc: is a directory
dev# rm -rf pkgsrc
recursively remove pkgsrc?

This might be a dumb question, but why don't you use rmdir?
rmdir is the UNIX command to remove (empty) directories.

Personally I have an alias rd=rmdir (and md=mkdir), which
is a left-over from my old DOS days. :-)

By the way, shouldn't -f override any previous -i or -I
option? At least that's what I would expect. You don't
type -f without a reason.

This has been discussed (to death) before. I'd be all in for that, but
other people weren't.

Sascha

Actions #5

Updated by dillon almost 18 years ago

:...
:> Personally I have an alias rd=rmdir (and md=mkdir), which
:> is a left-over from my old DOS days. :-)
:>
:> By the way, shouldn't -f override any previous -i or -I
:> option? At least that's what I would expect. You don't
:> type -f without a reason.
:
:This has been discussed (to death) before. I'd be all in for that, but
:other people weren't.
:
:Sascha

Yah.  I've been going against popular opinion on this matter and I'm
going to continue going against it. -I is not overriden by -f. -I
does apply only to interactive shells, though, so it will not blow up
scripts.
-Matt
Matthew Dillon
&lt;&gt;
Actions #6

Updated by erik-wikstrom almost 18 years ago

On 2006-07-22 01:36, W B Hacker wrote:

Matthew Dillon wrote:

:...
:> Personally I have an alias rd=rmdir (and md=mkdir), which
:> is a left-over from my old DOS days. :-)
:>
:> By the way, shouldn't -f override any previous -i or -I
:> option? At least that's what I would expect. You don't
:> type -f without a reason.
:
:This has been discussed (to death) before. I'd be all in for that, but
:other people weren't.
:
:Sascha

Yah. I've been going against popular opinion on this matter and I'm
going to continue going against it. -I is not overriden by -f. -I
does apply only to interactive shells, though, so it will not blow up
scripts.

-Matt
Matthew Dillon
<>

Seems to me that -i / -I should indeed sit at the top of the food-chain. Always.

What one is saying in effect is "I may not have gotten all this right, or there
may be surprises, so I want to see and specifically approve each/some actions".

The problem arises when -i/-I us used with -f, which by the same
reasoning also should be at "the top of the food-chain". -f says that I
know what I'm doing so don't bother me with asking for confirmation. Not
that I don't approve of the way things are at the moment but I can see
why some might not agree.

Actions #7

Updated by corecode almost 18 years ago

Erik Wikström wrote:

What one is saying in effect is "I may not have gotten all this right,
or there may be surprises, so I want to see and specifically approve
each/some actions".

The problem arises when -i/-I us used with -f, which by the same
reasoning also should be at "the top of the food-chain". -f says that I
know what I'm doing so don't bother me with asking for confirmation. Not
that I don't approve of the way things are at the moment but I can see
why some might not agree.

I don't agree with the meaning. For me -f means "try to remove in every case and don't fail", i.e. also remove write-protected files and don't fail if the files didn't even exist.

cheers
simon

Actions #8

Updated by wbh almost 18 years ago

Simon 'corecode' Schubert wrote:

Erik Wikström wrote:

What one is saying in effect is "I may not have gotten all this
right, or there may be surprises, so I want to see and specifically
approve each/some actions".

The problem arises when -i/-I us used with -f, which by the same
reasoning also should be at "the top of the food-chain". -f says that
I know what I'm doing so don't bother me with asking for confirmation.
Not that I don't approve of the way things are at the moment but I can
see why some might not agree.

I don't agree with the meaning. For me -f means "try to remove in every
case and don't fail", i.e. also remove write-protected files and don't
fail if the files didn't even exist.

cheers
simon

Regardless of -f or any other command-tail's 'power' or absolutism, -i, -I are
different, they don't DO anything 'final', but rather insure at least the
opportunity to review other things that usually are. Parking on the <Return> key
is a separate matter.

-i / -I are safety-nets, not fs-modifier actions, hence if/as/when present, MUST
NOT be disregarded.

To do otherwise is tantamount to saying that the trigger should always over-ride
the safety-catch on a loaded firearm [1] AND that one MAY or MAY NOT even have
their eyes open or care in what direction it is pointing when pulling that trigger.

Or that a vehicle's steering may be disabled if the throttle is wide-open [2].

Good a way as any of seriously damaging oneself - or others.

Bill

[1] Some firearms are made that work that way. That doesn't make it a good idea.

[2] Characteristic of certain motorcycles... ;-)

Actions #9

Updated by pavalos almost 18 years ago

On Sat, Jul 22, 2006 at 03:36:59PM +0200, Simon 'corecode' Schubert wrote:

Erik Wikstr?m wrote:

What one is saying in effect is "I may not have gotten all this right,
or there may be surprises, so I want to see and specifically approve
each/some actions".

The problem arises when -i/-I us used with -f, which by the same
reasoning also should be at "the top of the food-chain". -f says that I
know what I'm doing so don't bother me with asking for confirmation. Not
that I don't approve of the way things are at the moment but I can see
why some might not agree.

I don't agree with the meaning. For me -f means "try to remove in every
case and don't fail", i.e. also remove write-protected files and don't fail
if the files didn't even exist.

I somewhat agree with this, but I understand both arguements. Perhaps a
good compromise would be 'rm -ff'.

--Peter

Actions #10

Updated by jontro almost 18 years ago

On 7/22/06, Peter Avalos <> wrote:

On Sat, Jul 22, 2006 at 03:36:59PM +0200, Simon 'corecode' Schubert wrote:

Erik Wikstr?m wrote:

What one is saying in effect is "I may not have gotten all this right,
or there may be surprises, so I want to see and specifically approve
each/some actions".

The problem arises when -i/-I us used with -f, which by the same
reasoning also should be at "the top of the food-chain". -f says that I
know what I'm doing so don't bother me with asking for confirmation. Not
that I don't approve of the way things are at the moment but I can see
why some might not agree.

I don't agree with the meaning. For me -f means "try to remove in every
case and don't fail", i.e. also remove write-protected files and don't fail
if the files didn't even exist.

I somewhat agree with this, but I understand both arguements. Perhaps a
good compromise would be 'rm -ff'.

--Peter

This would defeat the purpose of -l.
I really dont see the issue here. No one is forcing anyone to use -l,
users that do not wish this behaviour just needs to remove the alias

-Jonas

Actions #11

Updated by dillon almost 18 years ago

There's also this business about what the standard says with
regards to -f vs other options, but I consider the standard to be
intensely short-sighted and completely wrong in this case, even
worse then the POSIX locking standards (and those are pretty bad).
It's like some child just decided to take the status quo and turn
it into a law.

-I is designed to not be 'naggy' the way -i is.  That is, I
designed it to be usable by power users sysops and programmers and
not just UNIX beginners. Hence the default.
-Matt
Actions

Also available in: Atom PDF