Gentoo Archives: gentoo-dev

From: Eamon Caddigan <ecaddiga@××××.edu>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: rm tragedies: was how to clean the "/tmp" dir
Date: Sun, 30 May 2004 16:27:34
Message-Id: c9d21h$32h$1@sea.gmane.org
In Reply to: Re: [gentoo-dev] Re: rm tragedies: was how to clean the "/tmp" dir by Josh Glover
1 Josh Glover <jmglov@g.o> wrote:
2 > Quoth Eamon Caddigan (Sun 2004-05-30 03:07:15PM +0000):
3 >> marduk <marduk@g.o> wrote:
4 >>
5 >> > Don't change rm's default behavior. There is nothing wrong with rm.
6 >> > There are many people who have for years (decades?) used rm and expect
7 >> > it to work a certain way, i.e. the Unix way, which is to (wrongly?)
8 >> > assume the user knows what she is doing and to quietly exit
9 >> > successfully. If you must have new behavior, have a new command, say
10 >> > gentoorm. Or if you must mess with rm, make sure by default it uses
11 >> > traditional Unix behavior unless you pass it
12 >> > --some-nonstandard-option-that-otherwise-breaks-rm. But please don't
13 >> > change the way most people expect rm to work.
14 >>
15 >> Argumentum ad antiquitam. I'm aware of many good arguments for keeping
16 >> 'rm' the way it is, but "because it's always been that way" isn't the
17 >> strongest. :)
18 >
19 > Sure it is. Have you noticed that the behaviour of basic Unix commands
20 > (cp, rm, mv, echo, cat, grep, sed... and so on, almost ad nauseum) has
21 > not changed since the days of yore?
22
23 Taking your example, 'echo' is often implemented as a shell built-in,
24 and it behaves *very* differently in, e.g. sh and csh. Moreover, the GNU
25 implementations of 'cp', 'mv', and 'cat' -- each a very important
26 system command -- have many non-POSIX options (just check out the man
27 pages).
28
29 > Sure, new behaviour has been added, and in the case of lots of the GNU
30 > stuff, the new behaviour is almost always used, but it has to be
31 > enabled somehow. The defaults have remained the same! This is
32 > important! Do you know how many shell scripts the average sysadmin has
33 > in his toolkit? Scripts that were written years ago, and have been
34 > honed to a razor-sharp point, scripts that might actually be bug-free?
35 > Now, what would happen if the *default* behaviour of 'rm' or 'mv'
36 > changed? Most likely, a catastrophe!
37 >
38 > This is why aliases like Red Hat sets up for rm, mv, and cp are a
39 > terrible idea in my opinion. Creating aliases like 'safe-rm' and so on
40 > would be much better, because then the conditioning would lead to
41 > 'bash: safe-rm: command not found', instead of 'rm' "failing" to
42 > prompt you and thus enabling you to do untold damage to a production
43 > system.
44
45 I do value the opinion of the folks here on -dev: I'd love to hear
46 feedback on my idea, but I'd rather not rehash old arguments with which
47 I mostly agree! I'm not advocating any changes to the default behavior
48 of 'rm'. Indeed, the solution I proposed -- while not perfect -- does
49 preserve full backward-compatability. Please read it, and let me know
50 what you think.
51
52 >> As for nonstandard options, that's exactly what I propose. Appealing
53 >> to tradition myself, I should point out that Linux has a rich history
54 >> of adding nonstandard options to ancient UNIX commands.
55 >
56 > I assume that, in this context, by "Linux", you actually mean "GNU",
57 > right?
58
59 I thought the distinction was pretty clear[1]. Let's save the
60 "GNU/Linux" flame-war for some other time. :)
61
62 But my point stands. The GNU project has been adding nonstandard options
63 to core UNIX commands since its inception. So why not 'rm'?
64
65 -Eamon
66
67 [1] It would be cool to make file-unlinking "safer" in kernel space, but
68 I digress.
69
70
71
72 --
73 gentoo-dev@g.o mailing list

Replies