ugh.book

(singke) #1

34 Welcome, New User!


Of course, though, on this occasion I mistyped as my fingers go on
autopilot and prefer the word ‘indent’ to the non-word ‘ident:’

% indent foo

Now, it turns out that “indent” is the name of UNIX’s brain-damaged
idea of a prettyprinter for C. Did the bastard who wrote this abortion
consider checking to make sure that its input was a C file (like, oh
my god, checking for whether or not the name ended in “.c”)? I think
you know the answer. Further, Said Bastard decided that if you give
only one argument to indent then you must mean for the source code
to be prettyprinted in place, overwriting the old contents of the file.
But not to worry, SB knew you might be worried about the damage
this might do, so SB made sure to save a copy of your old contents in
foo.BAK. Did SB simply rename foo to foo.BAK? Of course not, far
better to copy all of the bits out of foo into foo.BAK, then truncate
the file foo, than to write out the new, prettyprinted file.^10 Bastard.

You may be understanding the point of this little story by now...

Now, when a Unix program is running and paging out of its execut-
able file, it gets really annoyed at you if you mess about with all its
little bits. In particular, it tends to crash, hard and without hope of
recovery. I lost 20 hours of my program’s state changes.

Naturally, the team of bastards who designed (cough) Unix weren’t
interested in such complexities as a versioned file system, which also
would have saved my bacon. And those bastards also couldn’t
imagine locking any file you're currently paging out of, right?

So many bastards to choose from; why not kill ’em all?

Pavel

Imagine if there was an exterior paint that emitted chlorine gas as it dried.
No problem using it outside, according to the directions, but use it to paint
your bedroom and you might wind up dead. How long do you think such a
paint would last on the market? Certainly not 20 years.

(^10) Doubtlessly, the programmer who wrote indent chose this behavior because he
wanted the output file to have the same name, he already had it open, and there was
originally no rename system call.

Free download pdf