To: Peter Jeremy
Cc: freebsd-fs@freebsd.org
Subject: Re: Different inodes

> On 2008-Nov-10 16:36:56 +0100, Attila Nagy wrote:


> It seems that symlinks are inconsistent then listing them with "ls -i"
> directly, but with "ls -Ri" shows no errors. Also, I didn't faced any
> problems so far when switching NFS servers.


When you do an `ls -i' of a directory, the `ls' command does a stat()
of the name, discovers that it is a directory, does a readdir of the
directory, and prints out the inode numbers listed for each entry in
the directory. For entries that are symbolic links, the inode number
in the directory is the inode number of the symbolic link.

When you do an `ls -i' of a name which is a symbolic link, `ls' does
a stat() of the name. When you do a stat() of a symbolic link, you
follow the link, so the stat infor that comes back is for the thing
to which the symbolic link points. Thus when it prints the inode
number, you get the inode number of the file to which the symbolic
link points. To get the inode number of the symbolic link, `ls'
would have to do an lstat() instead of a stat(). That would be a
rather drastic change of historic behavior.

Kirk McKusick
_______________________________________________
freebsd-fs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-fs
To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"