X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_YG,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <4C727E51.2060103@bonhard.uklinux.net> References: <4C727E51 DOT 2060103 AT bonhard DOT uklinux DOT net> Date: Mon, 23 Aug 2010 20:17:07 +0100 Message-ID: Subject: Re: Wrong/ inconsistent responses from diff From: Andy Koppe To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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