Bug #253
closedrm -rf and recursive nothing
0%
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
Updated by pavalos over 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
Updated by justin over 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 systemSounds 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.
Updated by olli over 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
Updated by swildner over 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
Updated by dillon over 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
<dillon@backplane.com>
Updated by erik-wikstrom over 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.
:
:SaschaYah. 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
<dillon@backplane.com>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.
Updated by corecode over 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
Updated by wbh over 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... ;-)
Updated by pavalos over 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
Updated by jontro over 18 years ago
On 7/22/06, Peter Avalos <pavalos@theshell.com> 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
Updated by dillon over 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