This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Wrong/ inconsistent responses from diff


On 23 August 2010 14:57, Fergus wrote:
> (Very sorry if this arrives twice: one sent 3H ago seems not to have made it
> and I think maybe a AV induced signature was the cause: not provided with
> this despatch.)
>
> Ouch, this is weird and inexplicable.
>
> Somehow diff identifies differences in two identical binary files. In the
> following example two duplicate files are located (i) in my home directory
> (/m/home/user) and (ii) at the root of a different drive (D:).
>
> But this is just an example. The spurious differences are identified for all
> binary files. (As I found when comparing two identical trees, containing
> many binaries, using diff -rqs.)
>
> First, confirm they are identical. Notice the 5 different ways I may use to
> identify the file in my home directory. Using md5sum confirms they are
> identical (so does cmp -bl, say).
>
> ~> md5sum INTERVAL.pdf /d/INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf *INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf */d/INTERVAL.pdf
> ~> md5sum ./INTERVAL.pdf /d/INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf *./INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf */d/INTERVAL.pdf
> ~> md5sum ~/INTERVAL.pdf /d/INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf */home/user/INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf */d/INTERVAL.pdf
> ~> md5sum /home/user/INTERVAL.pdf /d/INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf */home/user/INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf */d/INTERVAL.pdf
> ~> md5sum /m/home/user/INTERVAL.pdf /d/INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf */m/home/user/INTERVAL.pdf
> 5f6ac8c4882f4804805ff41291a665bf */d/INTERVAL.pdf
>
> Now test for differences in the files (there are none, of course). Only the
> 5th of the 5 different ways by which I may identify the file in my home
> directory demonstrates that the two files are the same. Otherwise they are
> reported as being different.
>
> ~> diff -s INTERVAL.pdf /d/INTERVAL.pdf
> Files INTERVAL.pdf and /d/INTERVAL.pdf differ
> ~> diff -s ./INTERVAL.pdf /d/INTERVAL.pdf
> Files ./INTERVAL.pdf and /d/INTERVAL.pdf differ
> ~> diff -s ~/INTERVAL.pdf /d/INTERVAL.pdf
> Files /home/user/INTERVAL.pdf and /d/INTERVAL.pdf differ
> ~> diff -s /home/user/INTERVAL.pdf /d/INTERVAL.pdf
> Files /home/user/INTERVAL.pdf and /d/INTERVAL.pdf differ
> ~> diff -s /m/home/user/INTERVAL.pdf /d/INTERVAL.pdf
> Files /m/home/user/INTERVAL.pdf and /d/INTERVAL.pdf are identical

I'd suspect that /m and /d are on text mounts and your home directory
is on a binary mount, or vice versa. It may be that md5sum explicitly
opens files in binary mode, in which case the mount type does not
matter, whereas diff opens the files in without specifying mode.

Your cygcheck output does not confirm that suspicion, but then again,
the mount points shown there do not fit the paths shown above:

M:               /          system  binary,auto
M:\bin           /usr/bin   system  binary,auto
M:\lib           /usr/lib   system  binary,auto
cygdrive prefix  /cygdrive  user    binary,auto

In particular, the /d and /m paths suggest that the cygdrive prefix is
/ rather than /cygdrive.

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]