. file question (bug?)

Chris Torek chris at mimsy.UUCP
Fri Aug 5 18:05:20 AEST 1988


In article <1670002 at hpcilzb.HP.COM> tedj at hpcilzb.HP.COM (Ted Johnson) writes:
>When does the "." file, which describes the current directory,
>get updated?

Whenever it gets updated.  `.' is a *link* to that directory.  Any
change to that directory is reflected immediately, because the name `.'
resolves to that directory.

>hpcillm(tedj) 279>strings .
>hpcillm(tedj) 280>touch file1
 ...
>hpcillm(tedj) 282>touch file2
>hpcillm(tedj) 283>strings .
>file1
>file2
>hpcillm(tedj) 284>rm file2
>hpcillm(tedj) 285>strings .
>file1
>file2
>hpcillm(tedj) 286>ls
>file1
>hpcillm(tedj) 287>exit

As the `ls' shows, file2 has been deleted.  The directory has been
rewritten so that the `inode number' associated with the entry for
file2 is zero: this marks a free slot.  A free slot can have any
sort of trash in its name field, which is why one reads directories
with `readdir' or `ls' (portable readdir implementations are available
for those whose vendors fail to supply them; e.g., Doug Gwyn has one).
It just happens that the Unix system you have leaves the old name
there.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list