Symbolic links in snapshot views
Behavior of symbolic links in snapshot views differs between Linux and the UNIX system and the Windows system.
Behavior on Linux and the UNIX system
Snapshot views created from Linux or the UNIX system maintain standard symbolic link behavior. In the context of loading a snapshot view, links are treated as VOB links (those that point to objects inside the VOB) and non-VOB links (those that point outside the VOB). Hard VOB links are followed; symbolic links are copy-created. If a VOB link cannot be resolved, an error results. Non-VOB links are resolved, if possible, but it is not an error if they cannot be resolved.
On Linux or the UNIX system, if a load rule selects a symbolic link, the link and the link target are copied into the snapshot view (regardless of whether a load rule selects the link target). As with dynamic views, you cannot check out a symbolic link; you must check out the symbolic link target.
Each time a load rule selects a hard link in a snapshot view, the element is loaded in the view as a standard file instead of being created as a hard link.
Default behavior on Windows systems
- If a load rule selects a symbolic link, the link target is copied into
the view at the link path.
Do not load a linked directory more than once in your view unless it is necessary for build purposes. Although multiply-loaded elements are tracked accurately, you might become confused and modify the wrong copy of a file, losing information upon checkin.
When you are choosing elements to load, note the element icons displayed in the GUI. A diagonal arrow on the element icon indicates a symbolic link, as in the following example:
- You cannot check out a file element from a symbolic link path; you must
check out the link target.
In DevOps ClearCase Explorer, the shortcut menu for a symbolic link includes the Symlinks command, which changes your context to the directory containing the target (Warp to Symlink Target) or provides commands to perform DevOps Code ClearCase operations on the target without changing your context (Symlink Target Operations). Use one of these commands to find and check out the link target. When you check in the modified link target, all associated symbolic links loaded in your view are updated.
Unlike directory link targets, a file link target can be checked out only if it is loaded in your view.
- The Add to Source Control command (available from
DevOps Code ClearCase graphic user
interfaces) checks out, modifies, and checks in the link target directory whether you
issue the command from a directory symbolic link or from the link target (and whether or
not the target directory is loaded into the view).
If you issue the cleartool checkout command from a symbolic link directory, you must use the following syntax:
cleartool checkout .
A checkout command issued for the current directory checks out the link target whether the target directory is loaded into the view.
However, if you use the cleartool checkout dirname form of the command to check out a different directory, dirname must be a link target.
When either you explicitly check in a link target directory or a link target directory is implicitly checked in, the associated symbolic links that are loaded in your view are updated.
- If you hijack a file symbolic link, the Update Tool detects the hijack. However, you cannot check out the hijacked symbolic link. To add your hijacked changes to the VOB, you must check out and modify the link target.
Each time a load rule selects a hard link, the element is loaded in the view as a standard file. Be careful if you use hard links in snapshot views because you can lose data.
Enhanced symbolic link behavior on Windows systems
On Windows, use the -slink_mode use_slinks option to create the snapshot views. VOB symbolic links are created as Windows symbolic links on filesystems that support symbolic links.
The behavior of symbolic links in a Windows snapshot view is identical to the behavior on Linux and UNIX systems, as described in Default behavior on Windows systems.