Preventive Service Planning
Abstract
This technote explains what is meant by the term "Evil Twins" and provides guidance on how to identify and recover from evil twins in your IBM Rational ClearCase environment.
Content
A video demonstration of the material contained in this technote is available on the IBM Rational Support channel on You Tube under the topic of ClearCase Evil Twin Elements.
What is meant by the term "Evil Twins"?
"Evil Twins" is a commonly used phrase to describe a situation in which two elements, of the same name, are created in two different versions of the same directory element.
Example:
DIR1@@/main/1 ==> foo.c added
DIR1@@/main/2 ==> foo.c rmnamed
DIR1@@/main/3 ==> foo.c added
Evil Twins are often created when two people add the same file to source control at the same time. ClearCase allows this to happen because the element is actually referenced internally by its OID (Object ID) and not its name.
*******
Another kind of Evil Twins can occur on Microsoft® Windows®. The Windows operating system is case IN-sensitive (as opposed to UNIX® and Linux® which is case sensitive). This means that only one name regardless of case can exist in a single directory on Windows. To illustrate, open Windows Explorer and attempt to create the following files in a temp directory:
FOO.c
foo.c
You will be unable to do so due to how Windows manages file names.
The ClearCase MVFS can be configured to be case sensitive.
By setting the MVFS to be case sensitive, you can then create files in a VOB in the same directory that have the same name differing only by case.
For example, you can create the following files in the same directory:
FOO.c
foo.c
This is not a problem, so long as it is intentional and you are aware of the situation.
If you are not aware of the situation, it could be problematic.
For example, if you use a combination of Snapshot views and dynamic views on Windows and have a case sensitive MVFS setting, you could run into a problematic scenario:
For example:
dir1@@\main\1\FOO.c
dir1@@\main\1\foo.c
As Windows will only allow one of these files to exist in a directory space on Windows, ClearCase cannot load both into a snapshot view hosted on Windows.
Note: An eclipsed file is not the same as an evil twin, refer to technote 1132484 for more information about eclipsed files and ClearCase.
LOCATE EVIL TWINS
Now that you know what the identifying mark of an evil twin is, you can now takes steps to locate them in your VOB.
Use the cleartool find command to locate either FILE or DIRECTORY elements that "may be" evil twins.
Examples | ||||||
| ||||||
CONFIRM EVIL TWINS
The following steps need to be taken to confirm the existence of evil twins.
1. When two files are found with the same name in two different versions of the directory, you can run the cleartool dump command to see if the files are in fact different elements.
Example:
foo.c ==> DIR1@@/main/1
foo.c ==> DIR1@@/main/3
If you suspect foo.c may have an evil twin, run the cleartool dump <file@@> command for each file you suspect to obtain the object identifier (OID).
Example:
M:\dynamic_view\test_vob>cleartool dump foo.c@@
foo.c@@ (e7e4cd6a.e3f74b8f.b3ce.df:06:35:fe:a8:6c)
M:\dynamic_view\test_vob\foo.c@@
oid=e7e4cd6a.e3f74b8f.b3ce.df:06:35:fe:a8:6c dbid=177 (0xeb82ef)
mtype=file element type=12
stored fstat:
ino: 0; type: 2; mode: 0444
usid: NT:S-1-5-21-4179696171-2760821386-689065543-500
gsid: NT:S-1-5-21-4179696171-2760821386-689065543-1011
nlink: 1; size: 0
atime: Wed Dec 31 19:00:00 1969
mtime: Thu Oct 12 07:36:44 2006
ctime: Thu Oct 12 07:36:44 2006
returned fstat:
ino: 177; type: 2; mode: 0444
usid: NT:S-1-5-21-4179696171-2760821386-689065543-500
gsid: NT:S-1-5-21-4179696171-2760821386-689065543-1011
nlink: 1; size: 0
atime: Thu Oct 12 07:36:44 2006
mtime: Thu Oct 12 07:36:44 2006
ctime: Thu Oct 12 07:36:44 2006
master replica dbid=3
source pool=33 cleartext pool=35
Note: You can use the Windows findstr command or the UNIX or Linux grep command to sort the results more effectively.
M:\dynamic_view\test_vob>cleartool dump foo.c@@ | findstr oid
oid=e7e4cd6a.e3f74b8f.b3ce.df:06:35:fe:a8:6c dbid=177 (0xeb82ef)
/view/test_vob%>cleartool dump foo.c@@ | grep oid
oid=e7e4cd6a.e3f74b8f.b3ce.df:06:35:fe:a8:6c dbid=177 (0xeb82ef)
Alternative to dump | ||||||
|
2. Once you run the cleartool dump command for both files, compare the OIDs.
Note: Be sure you run the dump command using the @@ extension after the file name. This denotes you are dumping the element. If you leave off the @@, you will dump the version (as opposed to the element), thus affecting your output.
If the element OIDs are different but the names are the same, you have evil twins.
RECOVER FROM EVIL TWINS
If you discover evil twins in your configuration, it is important to address them as soon as possible.
You have two choices to resolve the problem.
1. Rename one of the elements using the cleartool mv command.
2. Remove one of the elements using the cleartool rmelem command.
Note: If in a UCM environment, you will need to first rename the element (using cleartool mv) and then remove the name using cleartool rmname. The reason is that removing elements in UCM using cleartool rmelem is not recommended as it can negatively affect your configuration. Review technote 1119222 for more information about removing elements in UCM.
PREVENTION TRIGGERS
The best solution used to control the creation of evil twins is to implement a pre-operational trigger during the mkelem/ add to source control operation.
The objective of the trigger would be to search the directory version tree for an element of the same name prior to creation of the new element.
In other words, the script used by the trigger will be required to look for two different files, with the same name, in two or more different versions of the same directory.
Note: Depending on the number of versions and branches on the directory, this could take some time, thus leading to potential performance degradation around the mkelem operation.
Update: Evil twin detection and prevention added to ClearCase 8.0
"Evil twins" are two elements of the same name that have been created in different versions of the same directory element. When the directory versions are merged, it is not clear which twin has been lost, nor even that the twins may have different versions that need to be merged. The evil twin detection and prevention feature enables you to detect evil twins and suppress their creation. It also enables you to detect and locate existing evil twins.
Related Information
Was this topic helpful?
Document Information
Modified date:
30 March 2020
UID
swg21125072