PDA

View Full Version : SFTP folder diff initially reports some identical files as different


johnm
09-Apr-2009, 03:51 PM
I'm using BC 3.0.15 Pro on Windows to diff folders on two CentOS 5 servers. I'm connecting with SFTP, and BC's log window reports the following info for both servers:

09/04/2009 21:35:59 Server software: OpenSSH_4.3
09/04/2009 21:35:59 Using SFTP version 3.
09/04/2009 21:35:59 Compression: none
09/04/2009 21:35:59 Encryption: aes256-ctr
09/04/2009 21:35:59 MAC algorithm: hmac-md5
09/04/2009 21:35:59 Server information:

My comparison settings are:

Compare file size
Compare timestamps
Compare contents
- CRC comparison
Override quick test results

When the folder view completes its compare, several lines show file pairs being different, with the =/= symbol in the central column.

Yet when I double-click on these to open in file view, that view reports (correctly) that the files are identical.

I get the same result if I change the "Compare contents" setting to "Binary".

And if I add the CRC column to the folder view, the left and right sides show different CRCs, even though I know the files are identical (and that's confirmed when file viewer opens them).

Using WinSCP I can see that my SFTP servers don't support calculation of file checksums, so presumably BC is computing these itself. But why does folder viewer believe these files are different when they're actually identical when file viewer examines them?

John

Chris
10-Apr-2009, 03:12 PM
Is it possible the files have different line terminator styles (Windows on one side, Unix/Linux on the other)? It might help to turn on "View > Show Whitespace" to see if the line terminators are different. You can also try comparing the files in the Hex Compare to see if there is a non-text difference in the files.

johnm
15-Apr-2009, 05:02 AM
That was it Chris. When BC transferred some of the files from one side to the other it changed the line terminators from UNIX to PC, even though both sides were on the same OS. Looking in FTP Profiles I discovered that the destination side was using the defaults on its Transfer tab (i.e. Transfer Type = Auto), but the source side was set to use Binary. Overriding the destination's setting and making it Binary too, then re-transferring the file, I now have UNIX terminators on both sides.

In a situation like this where an FTP Profile applies to both sides of the folder view, how does BC decide whose Transfer settings to use when copying a file from one side to the other?

John

Michael Bulgrien
15-Apr-2009, 07:23 AM
FYI - If you use a rules-based comparison instead of a binary comparison in your folder compare sessions, line-endings and encoding differences will not cause files to be considered different...although the CRC columm will still reflect that there is a formatting difference.

Craig
15-Apr-2009, 07:40 AM
BC doesn't support transferring directly from one server to the other (FXP), so it uses both FTP profiles when doing the copy. One to do the conversion when downloading it to your computer and the other to do the upload to the other server.