Two identical filenames in one directory!

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Sep 29 01:11:50 AEST 1989


In article <22 at minya.UUCP> jc at minya.UUCP (John Chambers) writes:
>On earlier versions of Unix, I'd know instantly what to do.  It's easy enough
>to write a program that runs thru a directory and extends each null byte to 
>the end of the entry.  But on Sys/V, this doesn't work, because nobody, not
>even root, can write a directory.  

For just this one entry, you should be able to patch the raw disk image.

>I might observe that this is a clear violation of the principle that sofware
>should be conservative in what it produces and liberal in what it accepts.

The root cause of the problem is that directory entries were designed
for all 14 allocated characters to be usable, so there may not be a
null-byte terminator.  That's why the kernel uses the funny strcmp
method that it does.  One hopes that this is fixed in the FSS-based
(or VFS-based) UNIX implementations.

There is a lesson there..

>Does anyone know a solution to this problem, ...

Other than patching the raw disk, you could move all the other files
to a new directory, unlink whatever you can from the broken directory,
then use fsck to discard what's left (here's hoping fsck doesn't
insist on reconstructing the links you removed).



More information about the Comp.unix.wizards mailing list