CC Type manager text_file_delta failed create_version operation
Problem(Abstract) 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 chtypecommand and retry the checkin. If the same error occurs during checkin, there is a problem with the source container.
Note: Some type manager errors on Windows are reported in the Windows Application Log (Source:ClearCase, Category:Debug). Therefore, when performing the checkin operation on Windows the error below will be displayed and the more detailed message as noted above will be reported in the Application Log.
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_nameThis 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_nameThis 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.
- Open the file in a hex editor such as XVI32 .
You will now be able to check the file in.
如果是windows 的话可能是如下原因:
- 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.
确保你的文件里没有二进制的文件。