Wednesday, October 25, 2006

rm -rf * :-O



Went home for diwali hols and the moment i entered my room , the first thing i did is to switch on the comp. I have already taken a resolution that no tech , no php , no linux for the next 5 days [ resolutions are meant be broken , you know :) ] . So instead of booting the comp in linux , i booted the comp in windows ( i had no clue what i was going to do in windows ) .

My sister had stored a few harry potter movies which i was in no mood to see.After some 5-10 minutes of arbit clicking , i decided windows is not for me :-). I noticed a folder called books which was the only useful thing for me in my comp apart from the linux. But reading a book will make me break the resolution. Though reluctant , i started with the "Unix Haters Book". When i started , i never had an idea how great the book will be .

The book will make anyone hate unix ( this includes linux also ) and i am not an exception. That too even after the first chapter , i started to realize the drawbacks [this is a better way to say hate :-) ] of shell , the most powerful and the tool which i liked the most in Unix or Linux.

So here is the details of the first chapter in short. It mostly blasted a singlr command "rm". Now i realise the deadliest command one can ever type is "rm".

The first thing i liked in the book is the way they described unix.
“ Who would have thought it: Unix, the hacker’s pornography.”
I have no clue why the author mentioned Unix as hacker's pornography , but i seriously liked the guts of the author to say something like this . I did realize that this book is good after reading the foreword ( very few books can do this ) . After reading the first chapter , the author made sure that whenever i type rm , i will surely remember this book.

The first chapter started with the quote saying
“Two of the most famous products of Berkeley are LSD and Unix. I
don’t think that this is a coincidence.”
—Anonymous

Another chapter said this
The most horrifying thing about Unix is that, no matter how many
times you hit yourself over the head with it, you never quite manage
to lose consciousness. It just goes on and on.
—Patrick Sobalvarro
The attack on “rm” gave many real life-horror stories .
“rm” Is Forever
A series of exchanges on the Usenet news group alt.folklore.computers illustrates our case:
Date: Wed, 10 Jan 90
From: djones@megatest.uucp (Dave Jones)
Subject: rm *
Newsgroups: alt.folklore.computers2
Anybody else ever intend to type:
% rm *.o
And type this by accident:
% rm *>o
Now you’ve got one new empty file called “o”, but plenty of room
for it!
Actually, you might not even get a file named “o” since the shell documen-
tation doesn’t specify if the output file “o” gets created before or after the
wildcard expansion takes place. The shell may be a programming lan-
guage, but it isn’t a very precise one.

In my comp i got a file named o , seems the output file gets created after the wild card expansion takes place.

Here is the next real life story
Date: Wed, 10 Jan 90 15:51 CST
From: ram@attcan.uucp
Subject: Re: rm *
Newsgroups: alt.folklore.computers
I too have had a similar disaster using rm. Once I was removing a file
system from my disk which was something like /usr/foo/bin. I was in /
usr/foo and had removed several parts of the system by:
% rm -r ./etc
% rm -r ./adm
…and so on. But when it came time to do ./bin, I missed the period.
System didn’t like that too much.
Unix wasn’t designed to live after the mortal blow of losing its /bin direc-
tory. An intelligent operating system would have given the user a chance to
recover (or at least confirm whether he really wanted to render the operat-
ing system inoperable).
The third case is really really important and a dangerous one .
Date: Wed, 10 Jan 90 10:40 CST
From: kgg@lfcs.ed.ac.uk (Kees Goossens)
Subject: Re: rm *
Newsgroups: alt.folklore.computers
Then there’s the story of the poor student who happened to have a
file called “-r” in his home directory. As he wanted to remove all his
non directory files (I presume) he typed:
% rm *
… And yes, it does remove everything except the beloved “-r” file…
Luckily our backup system was fairly good.

Now i stopped reading the book. I realised that i will surely start a Windows User Group , Trichy if i complete the book. :P .

No comments: