Subject: bug#23950: [bug-diffutils] bug#23950: An enhancement request

From: Dave Gordon <[email-masked]>
Date: Wed, 13 Jul 2016 13:16:02 +0100

On 11/07/16 23:41, Dr. Randall Fisher wrote:
> Hi,
>
> I use "diff -r" when comparing a directory tree to a copy that I have made
> when the storage media is questionable.  There are often broken symlinks in
> the original (usually a backup from some defunct machine).  When I do the
> diff, I get thousands of messages along the lines of :
>
> diff: gecko-clone-100714/var/X11R6/lib/xkb/xkbcomp: No such file or
> directory
> diff: /home2/Backups/gecko-clone-100714/var/X11R6/lib/xkb/xkbcomp: No such
> file or directory
>
> There are also messages along the lines of:
>
> X/afifo is a fifo while Y/afifo is a fifo
> ... or a socket or a character special, etc.
>
> ​These aren't really useful in this context and bury any really important
> errors.​
>
> Could you add switches to :
>      1. Not dereference symlinks, but compare the symlink itself (i.e. no
> message if they point to the same non-existant place)?
>      2. Not report the "this is an orange while that is an orange" messages?
>
> ​Thank you,
> Randy Fisher​

Maybe diff(1) isn't the right tool? Have you considered using rsync(1) 
with the -vn options (verbose reporting, no actual transfers) to see 
what differs between the two trees? If you doubt the integrity of the 
storage medium, you might want to add "-C" (use checksums) as well, thus

$ rsync -aHvCn src/ dest/
sending incremental file list
./
bxt_dmc_ver1.bin -> bxt_dmc_ver1_07.bin

sent 510 bytes  received 22 bytes  1,064.00 bytes/sec
total size is 404,951  speedup is 761.19 (DRY RUN)

The output should list every directory checked (lines ending /) plus 
those nondirectory objects which differ between src and dest (lines not 
ending /) -- the latter are presumably what you're interested in.

HTH,
.Dave.