Date: Tue, 11 Nov 2008 12:59:21 -0800 From: Kirk McKusick <mckusick@mckusick.com> To: Attila Nagy <bra@fsn.hu> Cc: freebsd-fs@freebsd.org Subject: Re: Different inodes Message-ID: <200811112059.mABKxL3Z068989@chez.mckusick.com>
next in thread | raw e-mail | index | archive | help
To: Peter Jeremy <peterjeremy@optushome.com.au> Cc: freebsd-fs@freebsd.org Subject: Re: Different inodes > On 2008-Nov-10 16:36:56 +0100, Attila Nagy <bra@fsn.hu> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811112059.mABKxL3Z068989>