Ugly file name

Joe Dellinger joe at hanauma.stanford.edu
Sat May 13 01:58:56 AEST 1989


Even "rm -i *" used to be dangerous. There is the famous case where
somebody accidentally created a file name "-f", and decided to remove
it by doing "rm -i *". The csh dutifully expanded this to
"rm -i -f [files...]", and at that time "-f" overrode "-i" in rm.
Result: everything in the directory deleted EXCEPT the file "-f"!
Now -i overrides -f in rm, at least, but rm still interprets files
beginning with a "-" as options instead of file names, even when expanded
by the csh. I guess poor rm has no way of knowing.

In another similar vein, I have a friend that recently had a junk directory
created by some sort of nasty low-level software error on a Sun 3. It was
like a black hole in the file system; you could cd into it but "cd .." would
then just leave you there. If you did "rmdir" it would complain the directory
wasn't empty. If you did "rm -r" it would go into an infinite loop trying to
work down to the bottom of the infinite pit, and would finally core dump.
"fsck" thought there was nothing wrong with the directory. We were really
puzzled with this one, but finally the little-used "clear inode" command
followed by a fsck did the trick. It was such a wonderful unique object,
it was almost a shame to kill it.
\    /\    /\    /\/\/\/\/\/\/\.-.-.-.-.......___________
 \  /  \  /  \  /Dept of Geophysics, Stanford University \/\/\.-.-....___
  \/    \/    \/Joe Dellinger joe at hanauma.stanford.edu  apple!hanauma!joe\/\.-._



More information about the Comp.unix.wizards mailing list