IBM Support

Compare utilities cleardiff and cleartool diff fail to note differences between binary files

Troubleshooting


Problem

This technote explains why the IBM Rational ClearCase cleardiff or cleartool diff commands attempt to start the text_file manager when comparing binary files.

Symptom


Attempts to perform a comparison of binary files using cleardiff or cleartool diff results in the following:

In ClearCase 2003.06.xx and later

The cleardiff or cleartool diff silently fails.



In ClearCase versions prior to 2003.06.xx

It incorrectly starts the text_file type manager to note the differences and reports errors such as the following:

  • With cleartool diff the error is:

    compare: Error: "M:\view\vob\binary@@\main\1" is not a 'text file': it contains a '\000'.
    This object's type does not support diff/merge of binary data.

  • With cleartool diff -graphical the error is:



  • With cleardiff the error is:

    cleardiff: Error: "binary" is not a 'text file': it contains a '\000'.
    cleardiff does not support diff/merge of binary data.

  • Using the compare utility from the GUI (Compare with Previous Version) which uses the cleardiffmrg.exe executable results in the error:

Cause

The compare utilities are only designed to compare text files, and the above errors are expected when attempting to compare (or merge) binary files.

Diagnosing The Problem


For ClearCase 2003.06.xx and later:

  1. Create 2 non identical versions of a Microsoft Word document under source control
  2. cleartool diff -pred word.doc
  3. The command line will return nothing
  4. When the 2 files are identical, the command line works properly and returns:
    M:\deplace\Main_Comp1\Merge\alex_test>more alex.doc                    
    Now the 2 files are identical                                                                                                                
    M:\deplace\Main_Comp1\Merge\alex_test>more alex2.doc                  
    Now the 2 files are identical  


    M:\deplace\Main_Comp1\Merge\alex_test>cleartool diff alex.doc alex2.doc
    Files are identical

Resolving The Problem

Even though when performing cleardiff or cleartool diff on binary files, differences can be noted, this is not the intended operation of the cleardiff or cleartool diff command.

For example, if there is no difference between two binary files, the message "Files are identical" is displayed from the command line giving the illusion that these utilities can compare binary files if there is a difference.

Example:

M:\view\vob\testdir>cleartool diff a.ppt@@\main\1 a.ppt@@\main\2


Files are identical

Basically the comparison method relies on a byte by byte comparison, hence files with all outward appearances of being identical (time, size, other) can still be noted for differences.

Now if the binary files are different, then the aforementioned error messages are displayed because ClearCase knows it can only compare text files and assumes that the files being compared are text; therefore ClearCase calls the text_file type manager to show the differences.

Refer to the whitepaper About the Rational ClearCase Type Manager for further details.

Binary files cannot be compared by ClearCase tools. Only the vendor which creates the binary file can provide comparison tools.

For example, Microsoft® Word files are binary and cannot be compared by the text_file type manager. Only Microsoft tools can compare Word differences. ClearCase is now able to compare Microsoft Word files because a special type manager (ms_word) was created to manage these files.


Note: Review technote 1237236 for details about a defect regarding the compare utility where Microsoft Office files that are compared appear identical and output binary data instead of failing with the errors above.

[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Cleartool","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2002.05.00;2003.06.00;2003.06.16;7.0;7.0.1;7.1;7.1.1;7.1.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Cleartool","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"GUI: Diff","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"GUI: Diff","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21149498