[PATCH 1/1] diff: the_same file checking fix
Denys Vlasenko
vda.linux at googlemail.com
Sun Mar 27 21:25:22 UTC 2011
On Friday 25 March 2011 10:31, Roman Borisov wrote:
> Fixed the bug with checking physically the same file; for example:
> 'mount --bind parent parent/child' command makes 'parent' mount point which
> physically is 'parent/child';
> If we are trying to 'diff parent parent/child' we must get '0' because
> files (dirs) are physically the same;
> That means we need to check stats of files and return '0' in this case.
>
> There is the comment in diff-utils: src/system.h which is describing
> why isn't comparing only st_dev and st_ino sufficient:
> /* Do struct stat *S, *T have the same file attributes?
>
> POSIX says that two files are identical if st_ino and st_dev are
> the same, but many file systems incorrectly assign the same (device,
> inode) pair to two distinct files, including:
>
> GNU/Linux NFS servers that export all local file systems as a
> single NFS file system, if a local device number (st_dev) exceeds
> 255, or if a local inode number (st_ino) exceeds 16777215.
>
> ...
>
> It's ppossible for two distinct files on a buggy file system to have
> the same attributes, but it's not worth slowing down all
> implementations (or complicating the configuration) to cater to
> these rare cases in buggy implementations. */
Applied, thanks!
--
vda
More information about the busybox
mailing list