20 Welcome, New User! Automatic file versioning, which gives new versions of files new names or numbered extensions, would preserve previous versions of files. This would prevent new versions of files from overwriting old versions. Overwriting happens all the time in Unix. 2. Unix programmers have a criminally lax attitude toward error reporting and checking. Many programs don’t bother to see if all of the bytes in their output file can be written to disk. Some don’t even bother to see if their output file has been created. Nevertheless, these programs are sure to delete their input files when they are finished. 3. The Unix shell, not its clients, expands “*”. Having the shell expand “*” prevents the client program, such as rm, from doing a sanity check to prevent murder and mayhem. Even DOS verifies potentially dangerous commands such as “del *.*”. Under Unix, however, the file deletion program cannot determine whether the user typed: % rm * or: % rm file1 file2 file3 ... This situation could be alleviated somewhat if the original com- mand line was somehow saved and passed on to the invoked client command. Perhaps it could be stuffed into one of those handy envi- ronment variables. 4. File deletion is forever. Unix has no “undelete” command. With other, safer operating sys- tems, deleting a file marks the blocks used by that file as “available for use” and moves the directory entry for that file into a special directory of “deleted files.” If the disk fills up, the space taken by deleted files is reclaimed. Most operating systems use the two-step, delete-and-purge idea to return the disk blocks used by files to the operating system. This isn’t rocket science even the Macintosh, back in 1984, separated “throwing things into the trash” from “emptying the trash.” Tenex had it back in 1974.
Accidents Will Happen 21 DOS and Windows give you something more like a sewage line with a trap than a wastebasket. It simply deletes the file, but if you want to stick your hand in to get it back, at least there are utilities you can buy to do the job. They work—some of the time. These four problems operate synergistically, causing needless but predict- able and daily file deletion. Better techniques were understood and in wide- spread use before Unix came along. They’re being lost now with the acceptance of Unix as the world’s “standard” operating system. Welcome to the future. “rm” Is Forever The principles above combine into real-life horror stories. 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. 2Forwarded to UNIX-HATERS by Chris Garrigues.
Previous Page Next Page