GNU bug report logs - #21715
feat req: an option to skip directory inode comparison

Previous Next

Package: diffutils;

Reported by: Aaron Davies <aaron.davies <at> gmail.com>

Date: Tue, 20 Oct 2015 02:28:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Aaron Davies <aaron.davies <at> gmail.com>
To: 21715 <at> debbugs.gnu.org
Subject: bug#21715: feat req: an option to skip directory inode comparison
Date: Mon, 19 Oct 2015 22:27:28 -0400
i have a situation where diff -r of two directories fails to report differences that diff of two files in those directories shows

i haven't dug into the code yet, but the directories involved are on an NFS mount of a netapp filer, one is the copy-on-write snapshot counterpart of the other, they show up as the same filesystem, and are the same inode

so my guess is that there's something in the recursive traversal that says that any two directories that are on the same fs and are the same inode must have identical descendent contents and can be skipped completely

this fs probably violates POSIX by doing this, but there's no easy way around it[1], so it would be very useful if diff had a command-line option to turn that optimization off

i've heard anecdotal reports of other filesystems that cause the same problem

here's a sample session:

$ mkdir foo
$ echo baz >foo/bar
$ # wait until the next snapshot is created
$ echo quux >foo/bar
$ diff -r .snapshot/nightly.0/foo foo
$ diff .snapshot/nightly.0/foo/bar foo/bar
1c1
< baz
---
> quux
$ stat -c %i .snapshot/nightly.0/foo foo
69403847
69403847
$ 
-- 
Aaron Davies
aaron.davies <at> gmail.com

[1] when i ran into this, i ended up using something like diff <(find .snapshot/nightly.0/foo -type f|sort|xargs cat) <(find foo -type f|sort|xargs cat) to do the comparison -- sufficient for my needs at the time, but cleaning it up for general purpose use would essentially be rewriting the -r part of diff from scratch



This bug report was last modified 9 years and 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.