Initial add of defaria.com
[clearscm.git] / defaria.com / blogs / Status / archives / 000246.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
4 <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6    <meta name="generator" content="Movable Type 5.2.3" />
7
8    <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles-site.css" type="text/css" />
9    <link rel="alternate" type="application/atom+xml" title="Atom" href="http://defaria.com/blogs/Status/atom.xml" />
10    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://defaria.com/blogs/Status/index.xml" />
11
12    <title>Status for Andrew DeFaria: Env var problems</title>
13
14    <link rel="start" href="http://defaria.com/blogs/Status/" title="Home" />
15    <link rel="prev" href="http://defaria.com/blogs/Status/archives/000244.html" title="Server Heap Size/Comment PINE code" />
16    <link rel="next" href="http://defaria.com/blogs/Status/archives/000245.html" title="Code complete for cmconfig.vbs" />
17
18    
19
20    
21
22    <script type="text/javascript" src="http://defaria.com/blogs/Status/mt-site.js"></script>
23 </head>
24 <body class="layout-one-column" onload="individualArchivesOnLoad(commenter_name)">
25    <div id="container">
26       <div id="container-inner" class="pkg">
27
28          <div id="banner">
29             <div id="banner-inner" class="pkg">
30                <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
31                <h2 id="banner-description">Searchable status reports and work log</h2>
32             </div>
33          </div>
34
35          <div id="pagebody">
36             <div id="pagebody-inner" class="pkg">
37                <div id="alpha">
38                   <div id="alpha-inner" class="pkg">
39
40                      <p class="content-nav">
41                         <a href="http://defaria.com/blogs/Status/archives/000244.html">&laquo; Server Heap Size/Comment PINE code</a> |
42                         <a href="http://defaria.com/blogs/Status/">Main</a>
43                         | <a href="http://defaria.com/blogs/Status/archives/000245.html">Code complete for cmconfig.vbs &raquo;</a>
44                      </p>
45
46                      <a id="a000246"></a>
47                      <div class="entry" id="entry-246">
48                         <h3 class="entry-header">Env var problems</h3>
49                         <div class="entry-content">
50                            <div class="entry-body">
51                               <p>There is a slight problem with the "set everything and verify it" script cmconfig.cmd. The idea was that that one script would perform 3 separate actions:</p>
52
53 <ol>
54   <li>Set up Clearquest configuration parameters (installutil)</li>
55
56   <li>Set up Clearcase configuration parameters (as per the logged in user) (setccconf.vbs)</li>
57
58   <li>Verify the installation (cmverify.cmd)</li>
59 </ol>
60
61 <p>The problem is with #2 being VBScript and #3 happening as a result of executing from the cmconfig.cmd script. While setccconf.vbs does indeed set the proper configuration environment variables as soon as it ends those settings are no longer set anymore by the evoking script only. All other (new) processes know about the change to the environment variables. To illustrate this odd phenomena:</p>
62
63 <div class="code">
64 <pre>
65 $ <u>type setenv_var.vbs</u>
66 Set sh  = WScript.CreateObject ("WScript.Shell")
67 Set env = sh.Environment ("USER")
68
69 env ("foo") = "bar"
70 $ <u>type senenv_var.cmd</u>
71 @echo off
72 set foo=bar
73 $ <u>echo foo = %foo%</u>
74 foo = %foo%
75 $ <u>cscript setenv_var.vbs</u>
76 $ <u>echo foo = %foo%</u>
77 foo = %foo%
78 $ <u>call setenv_var.cmd</u>
79 $ <u>echo foo = %foo%</u>
80 foo = bar
81 $ <u>cmd /c echo foo = %foo%</u>
82 foo = bar
83 </pre>
84 </div>
85
86 <p>Why it works for a .cmd script but not for a .vbs script I don't know.</p>
87
88 <p>So I will change cmconfig.cmd to do #1 and #2 above but skip #3. This means two things:</p>
89
90 <ol>
91   <li>Customers will have to run cmconfig.cmd first, then cmverify.cmd second</li>
92
93   <li>The running of cmverify.cmd must be done in a separate, new cmd session</li>
94 </ol>
95
96 <p>The reason for #2 is that even after cmconfig.cmd is run environment variables such as CLEARCASE_PRIMARY_GROUP and CLEARCASE_GROUPS will not have been "exported" into that cmd's environment (unless somebody can tell me how to set the parent's environment variables from VBScript...).</p>
97
98 <p>For the point and click crowd this should be OK. The email message you send the customer should have two links: one to cmconfig.cmd and one to cmverify.cmd. If the customer clicks the cmconfig.cmd link then cmconfig.cmd should run, in it's own process, and go away. Subsequently if the user clicks on cmverify.cmd that will run in it's own cmd process and it should pick up the appropriate environment variable settings.</p>
99
100 <p>There have been many requests for enhancements to the configuration scripts including updating the TOOLS database on successful verification and performing additional checks such as "is this user really in the AD group". I believe I will only be able to solve the above problem by having the setccconf.vbs script actually envoke the cmverify.cmd directly so that the environment variables that setccconf.vbs just set are exported into the cmverify.cmd's environment.</p>
101                            </div>
102                            <div id="more" class="entry-more">
103                               
104                            </div>
105                         </div>
106                         <p class="entry-footer">
107                            <span class="post-footers">Posted by  on September 13, 2004  6:07 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000246.html">Permalink</a>
108                         </p>
109                      </div>
110
111                      
112
113                      
114                   </div>
115                </div>
116             </div>
117          </div>
118       </div>
119    </div>
120 </body>
121 </html>