1

Using cleartool, when you cleartool setview, a subshell is opened apparently (you can exit it and leave the view). I was wondering - how can I get more commands to be executed, or settings made, when this subshell starts? Of course, I don't mean code which executes when any shell starts, just when cleartool starts one.

einpoklum
  • 118,144
  • 57
  • 340
  • 684

2 Answers2

0

A cleartool setview does not source anything (any shrc/bashrc) when spawning its subshell.

I have always advised against setview, precisely to avoid the subshell issue.

It would be easier to get a script which would:

  • execute/source additional commands
  • switch the full view path /view/AViewName/vobs/aVob/... instead of relying on the /vobs setview chroot trick.

Or, use the -exec option of setview to source settings and execute a script.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • By "chroot trick" you mean the fact that there's chrooting to `/view/AViewName`? Also, my shell could theoretically detect what the parent process was, and act accordingly if it ClearCase/Cleartool - couldn't it? – einpoklum Feb 02 '20 at 09:47
  • @einpoklum yes for chroot. And the subshell (https://www.tldp.org/LDP/abs/html/subshells.html) would not invoke anything. The script executed within that subshell might detect its parent shell indeed. That seems complex compared using the full view path directly within the *current* shell. – VonC Feb 02 '20 at 09:52
0

According to the man page for setview, it takes an -exec parameter.

https://www.ibm.com/support/knowledgecenter/SSSH27_9.0.1/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_setview.htm

That can be used to run a script if you wish. As @Vonc mentioned, setview is a chroot environment, and the root of a view (/view/myview) will show the / filesystem to transparently support the chroot.

If you're scripting things on Unix, and want to follow VonC's advice about not using setview, you would need to set/detect a view in the script. "cleartool pwv -wdview" will tell you the view context of the current working directory. (See https://www.ibm.com/support/knowledgecenter/SSSH27_9.0.1/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_pwv.htm)

From personal experience, it's usually not a good idea to reach between views during audited builds, if that is what your script does. But some people use a common view for trigger scripts under source control...

Brian Cowan
  • 1,048
  • 6
  • 7