CM wiki web
Base ClearCase FAQ 1.1.2: setview in scripts doesn't work
Running "setview" without the "-exec" flag starts a new shell. The following contents was found previously:- Generally, using "setview -exec" is a deprecated way of doing things. It will not work on NT, and it will not work in snapshot views. Instead, one should use view extended path names.
Using a view extended path to call a script will in turn not work on unix, in the general case. More precisely, it will fail as soon as the script attempts to access anything from a vob, with an absolute path without this same view extended path (which would work using a setview context). This could be an included script item (e.g. a perl library), or an other tool run from an absolute path (possibly via a soft link).
Theoretical insight
Whatsetview was meant to provide is an essential SCM feature: referential transparency,
and especially decoupling the identification of logical resources (configuration items),
from the selection of instances, out of sets of available ones, to represent those in the current software configuration.
The fact that this feature fails to work in every context, should not drive one to refrain from using it where it does work
(throw the baby with the bath water).
Retaining it is worth examining the options available.
The difference between NT and Unix is not so trivial, and must be understood: in unix, there is one single root, which chroot can change.
Not so on Windows, where the closest equivalent will only apply to one drive.
- When writing scripts, it is a good idea to normalize path names to the view root, which can be obtained by running "cleartool pwv -root". Note that this returns an empty string when run in a setview context. Therefore, you can safely append an absolute pathname beginning with the vob tag to the value returned by "cleartool pwv -root".
setview should work on unix in CtCmd and in ClearCase::Argv.
Without the former, the latter (v1.26) will hang on setview, due to a bug in cleartool interactive mode with the -status option
(reported to IBM: RFE 423).
This problem is worked around in a forthcoming version of ClearCase::Argv —1.34.
