Summary of how to remove file with NULL names

Kevin Szabo ksbszabo at watvlsi.UUCP
Wed Apr 23 03:27:09 AEST 1986


>I had some programs blow on me and they opened a file with
>a null file name. Almost as if I had done a 'open("",O_READ)' or such.
>Now, I have a few files in my directory that show up with names like
>!wvwu or u!wv.  I tried a 'rm -i *' and I got a 'rm: !wvu non-existent'
>error.

We had null-named file trouble on our 4.1 BSD based work station; an
OD of the directory showed the names to really be the null string!
I think someone forgot to SYNC before shutting the machine down.
I hope my solution is applicable to you.

These are the steps I followed:

1) fsck the file system
2) find the Inode numbers of the weirdly named files. (ls -i)
3) use the program 'clri' to clear the inodes of the bad files.
4) run fsck again and let it clean up the directories, free list and
   reference counts. (you lose the files UNLESS you zap the parent directory,
   in which case you get a whole bunch of unreferenced inodes that go
   into lost+found).

Null file names can be tricky because many systems interpret "" as
equivalent to "." (i.e. the current directory).  We had some null-named
directories in our file system; it was a confusing mess to figure
out.  It looked like I had a directory linked to itself, but
really LS was just getting the wrong info when it opened up the directory
called "".  I found that 'od' on the directory was useful to find these
problems.

Another useful proceedure is using 'rm -i -r' on the directory.
This technique keeps the shell from seeing the file names and
mangling non-ascii characters (8th bit = 1, etc.).

	Kevin Szabo'
-- 
Kevin Szabo'  ihnp4!watmath!watvlsi!ksbszabo  (VLSI Group,U of Waterloo,Ont,Can)



More information about the Comp.unix.wizards mailing list