Troubleshooting
Problem
This technote provides a method to confirm the existence of a corrupt source container in an IBM® Rational® ClearCase® VOB based on a checkin error related to text files being referenced as a binary file along with steps to try and fix the container.
Symptom
Attempts to complete a checkin results in the following error:
Error checking in 'M:\View\VOB\dir1\dir2\foo.c' text_file_delta: Error: "foo.c" is not a 'text file': it contains a '\000'. This object's type does not support check-in of binary data.
Use a different type manager (such as compressed file). cleartool: Error: Type manager "text_file_delta" failed create_version operation. cleartool: Error: Unable to check in "foo.c".
Cause
- If this error arises the first time checking in a file (or during a file import process), the file likely has a file extension suffix the cc.magic file would consider a text_file element type or the opening block of the file is in text but there are other parts of the file which contain binary data.
To confirm whether a file contains a '\000' you can run the following test on the file using ccperl on Windows® or Perl on UNIX® or Linux®:
Example:
ccperl -e "print(@null=grep(/\000/,<>)?'Contains nulls':'No nulls found')" "foo.c"
- There may be a corrupt source container. Check for indicators of a corrupt source container:
- Confirm that the file in question is in fact a text file.
- Copy the file to the operating system (outside of ClearCase) and open with a text editor.
- Ensure there are no binary characters in the file.
- Attempt to change the element type using the cleartool chtype command and retry the checkin. If the same error occurs during checkin, there is a problem with the source container.
cleartool: Error Type manager "text_file_delta". failed create_version operation.
cleartool: Error: Unable to check in "testfile".
Resolving The Problem
The solution for Cause 1 has two different options. Choose the one that is right for your needs.
OPTION 1
Change the type manager of the file stored as text_file to a different type manager and checkin in the file.
- Run cleartool chtype compressed_file <filename> while the file is still checked out from /main/0
or
- Remove the element (or rmname the element if this is a UCM environment).
OPTION 2
Manually remove the null characters in the file.
- Linux and UNIX
- The following commands are examples of the kinds of methods which could be used to pull out the null characters in a file. They are not the only methods available.
Option #1
perl -pi -e 's/\x00//g' file_name
This command does a global replace on the null character and replaces it with nothing on the file specified.
Option #2
awk '{gsub("\000","");print}' file_name > file_name
This command will also replace all the null characters with nothing.
- Windows
- Open the file in a hex editor such as XVI32.
Note: XVI32 is a freeware hex editor.
- Click Search > Replace
- Enter 00 (two zeros) in the find Hex field.
- Leave the replace field empty.
- Click OK and save as original file name.
You will now be able to check the file in.
Solution 2
Replace the source container from backup following the appropriate technote for your environment:
Related Information
Was this topic helpful?
Document Information
Modified date:
29 September 2018
UID
swg21222072