The LINK Database

To establish dependencies with symbolic links, the LINK database must be used.

This section assumes that are familiar with the "symbolic link" in a UNIX file system. For information about symbolic links, you can use the UNIX command man ln.

For example, the tool "ln" can be used to create a link. In FDL, write:
# Create a link called 'bar' for to a file called 'foo'
#   bar → foo
R "unix"
T vw ln -s foo bar
O -db LINK bar

Notice that the file foo in the example above does not even need to exist, and therefore it is not considered an input to "ln". The link bar → foo is created whether foo exists or not. The job ln -s ... can be run at any time, even before foo exists, but not before the jobs that use the symbolic link bar.

The timestamp of the link is not the same as the timestamp of the file. You can have an old link that points to a young file. Recreating the link will normally change the timestamp of the link.

It is possible to create automatic dependencies for all links used in path expansion. If you are using the VIL tools, you can use the option -links at runtime:
### ---- in the middle of a script ....

### All symbolic links used to expand foobar and abc will be declared
### as inputs to the current job.
VovOutput -links foobar || exit 1

VovInput -links abc  || exit 1

All symbolic links are declared as input dependencies. (The only tool that has a LINK as output is "ln" or some other application that call the symlink() system call. )

Alternatively, you can set the environment variable VOV_VW_TRACK_LINKS before you invoke the tool to track all symbolic links.
setenv VOV_VW_TRACK_LINKS 1
vw cp aa bb

Examples

In the following examples, the following structure are assumed (links shown in bold):
/project/ivy/releases/current      -> milestoneA
/project/ivy/releases/milestoneA   -> serials/00014
/project/ivy/releases/serials/0014/file.txt
Focus on runtime declarations using the VIL-Tools VovInput and VovOutput. Assume you are in directory /project/ivy/releases:
  • VovInput current/file.txt
    VovInput -db FILE current/file.txt 

    These commands are equivalent, because FILE is the default database. They both create an input dependency with FILE serials/0014/file.txt, because the links "current" and "milestoneA" are both traversed.

  • VovInput -db LINK -quote current

    This creates an input dependency for the symbolic link current → milestoneA. The path "current" is not expanded because it is quoted by the option -quote.

  • VovInput -links current/file.txt
    This command creates three dependencies: one for FILE serials/0014/file.txt and two for the links that have been traversed. This is equivalent to these three lines:
    VovInput -db FILE        /project/ivy/releases/serials/0014/file.txt
    VovInput -db LINK -quote /project/ivy/releases/serials/current
    VovInput -db LINK -quote /project/ivy/releases/serials/milestoneA
  • VovInput -db LINK  current

    Without the -quote option, this creates an input dependency for the directory serials/0014, but in the "LINK" database, which is actually a silly thing to do. Behaviorally, this is not much different from having a dependency on a "FILE" serials/0014.

  • VovInput  -links -db LINK  current

    This is the same as above, but in addition we also have dependencies on the two links that have been traversed.

  • VovInput  -links -db FILE  current

    This is better than above, because the expanded path "current" is actually a directory, and not a link.

Option -links in FDL

The option -links is available also in the procedures I and O in FDL, but they have no effect. The symbolic links are only added as inputs when the jobs are actually run.
## This is legitimate FDL. 
T vw cp aa bb
O -links bb
I -links aa
# More useful is to use -links in  a capsule-on-the-fly
T vw ./myjob aa bb
CAPSULE {
   I -links aa
   O -links bb
}

Debugging symlinks

If you want to get more verbose information about handling of symlinks, you need to add the following statement in the equiv.tcl file:
# This goes in the equiv.tcl file.
# It activates debugging for both the equivalence subsystem
# and the symlink subsystem
vtk_equivalences_debug 1

This change will have an effect when you run another job. Remember to revert the change after you are done debugging.

Links into the DesignSync Caches

Some links in particular need not be traversed. One example of this are the links into the DesignSync caches. To define which caches to ignore, use the variable VOV_SYNC_CACHE_DIR, which is a colon-separated list of paths.
##
## Avoid expanding links into the DesignSync caches.
## This is normally set in the setup.tcl file.
W#
setenv VOV_SYNC_CACHE_DIR /some/location/sync1/cache:/other/location/sync33/cache