Initial add of defaria.com
[clearscm.git] / defaria.com / blogs / Status / archives / 2005_12.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: December 2005 Archives</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/2005_11.html" title="November 2005" />
16    <link rel="next" href="http://defaria.com/blogs/Status/archives/2006_01.html" title="January 2006" />
17 </head>
18 <body class="layout-one-column">
19    <div id="container">
20       <div id="container-inner" class="pkg">
21
22          <div id="banner">
23             <div id="banner-inner" class="pkg">
24                <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
25                <h2 id="banner-description">Searchable status reports and work log</h2>
26             </div>
27          </div>
28
29          <div id="pagebody">
30             <div id="pagebody-inner" class="pkg">
31                <div id="alpha">
32                   <div id="alpha-inner" class="pkg">
33                      
34                      <p class="content-nav">
35                         <a href="http://defaria.com/blogs/Status/archives/2005_11.html">&laquo; November 2005</a> |
36                         <a href="http://defaria.com/blogs/Status/">Main</a>
37                         | <a href="http://defaria.com/blogs/Status/archives/2006_01.html">January 2006 &raquo;</a>
38                      </p>
39                      
40                      
41                      
42
43                      <h2 class="date-header">December 30, 2005</h2>
44                      <a id="a000507"></a>
45                      <div class="entry" id="entry-507">
46                         <h3 class="entry-header">pulse</h3>
47                         <div class="entry-content">
48                            <div class="entry-body">
49                               <ul>
50   <li>Added some functionality to Clearcase::Vob and Clearcase::View</li>
51
52   <li>Coded a pulse script which performs a pulse checking by checking out and in a file 10 times. If the pulse takes more than 60 seconds then an error is reported</li>
53 </ul>
54                               
55                               <h2>Pulse</h2>
56
57 <p>I decided to make the pulse script part of a larger project so I created a perf subdirectory under cc. The idea here is that pulse is a sort of performance test - a "sanity performance test" if you will. In general the script does the following:</p>
58
59 <ul>
60   <li>Creates a logfile (pulse.log)</li>
61
62   <li>Creates a new view (default) if required</li>
63
64   <li>Sets context to that view</li>
65
66   <li>Changes directory to the view to the vob (/vobs/adm by default)</li>
67
68   <li>Performs 10 checkouts and checkins of a relatively large file (a copy of firefox.exe which is ~7 Meg)</li>
69
70   <li>Compares the time that those checkouts and checkins took against a threshold (default 60) and reports an error if it took too long</li>
71 </ul>
72
73 <p>Here is a usage:</p>
74
75 <div class="code"><pre>
76 ccase-rmna-3:export SITE_PERL_LIBPATH=~/SCM/lib
77 ccase-rmna-3:pulse -u
78 Usage:  pulse (v1.0) [-u] [-v] [-d] [-view <viewtag>] [-vob <vobtag>]
79         [-element <element>] [-t <n>] [-i <n>]
80
81 Where:
82
83   -u:       Display usage
84   -v:       Turn on verbose mode
85   -d:       Turn on debug mode
86   -view:    View tag to create/use (Default: default)
87   -vob:     Vob tag to use (Default /vobs/adm)
88   -element: Vob relative path to element to checkout/in (Default: firefox.exe)
89   -t <n>:   Threshold of what is "too long" (Default 60 seconds)
90   -i <n>:   Number of iterations (default 10)
91 </pre></div>
92
93 <p>Here's an example of the log file produced:</p>
94
95 <div class="code"><pre>
96 pulse: 12/30/2005 @ 12:27: Performing 10 checkout/ins in view default vob /vobs/adm of element firefox.exe
97 pulse: 12/30/2005 @ 12:28: Finished in 36 seconds
98 pulse: 12/30/2005 @ 12:28: Performing 10 checkout/ins in view default vob /vobs/adm of element firefox.exe
99 pulse: 12/30/2005 @ 12:29: Finished in 35 seconds
100 </pre></div>
101 <p>Several issues came up when attempting to code this script. For example:</p>
102
103 <ul>
104   <li>Which view should this operate in?</li>
105
106   <li>Which vob should this operate in?</li>
107
108   <li>How will we assure that this vob exists at any site that we want to run pulse? Perhaps we should make a vob for performance testing only (e.g. /vobs/perf).</li>
109
110   <li>Checking out and in a single element creates many versions on the version tree. If this pulse script was run every hour then 240 versions would be created in only one day. It would be better to more properly "setup" and "teardown" the whole environment but this would be considerably more complex and time consuming. For example, pulse could create the view, create the vob, formulate some elements and do mkelems on them, do the checkouts and checkins, do rmelems and remove the vob and view, etc. That's a lot! Alternately it could simply do the mkelems, the checkouts and checkins, then do rmelems but that brings up the issue of where does the source come for the mkelems? Also, typically there's a trigger to prevent rmelem...</li>
111
112   <li>Currently the script is pretty Unix centric. For example, it uses cleartool lsview -stgloc -auto. This works on Unix but for some reason -stgloc doesn't work on Windows. I also suspect that at the various sites usage of -stgloc might not be that reliable.</li>
113
114   <li>Also the view used is a dynamic view. Should a snapshot version be coded?</li>
115
116   <li>Current the script uses /vobs/<vobname> for a vob tag. In fact it uses /vobs/adm. This is not a Windows vob tag so the script will not work on Windows</li>
117
118   <li>The script does sport paramaters to change things such as the view used, the vob used and the element to checkout and in. The defaults are great but then again we don't have a performance testing environment setup and replicated yet</li>
119
120   <li>Currently the script logs it's activity to a log file but it's not in a great format for analysis. The TimeUtils module I'm using only as 1 second resolution. I'm not sure how much analysis of this logfile is desired</li>
121
122   <li>There is no facility for emailing alerts when the script determines that things are taking too long</li>
123                               
124                               <p class="entry-footer">
125                                  <span class="post-footers">Posted by  at 10:57 AM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000507.html">Permalink</a>
126                                  
127                                  
128                               </p>
129                            </div>
130                         </div>
131                      </div>
132                      
133                      
134
135                      <h2 class="date-header">December 29, 2005</h2>
136                      <a id="a000506"></a>
137                      <div class="entry" id="entry-506">
138                         <h3 class="entry-header">Clearcase Modules/log_activity</h3>
139                         <div class="entry-content">
140                            <div class="entry-body">
141                               <ul>
142   <li>Worked on creating several Clearcase modules: Clearcase::Vobs, Clearcase:Vob and Clearcase::View</li>
143
144   <li>Updated log_activity to use new Clearcase modules</li>
145 </ul>
146                               
147                               <h2>Clearcase Modules</h2>
148
149 <p>It occurs to me that lots of repeatative Perl coding goes on with many people implementing functions for the same old commonly performed actions. For example, sending an email message, reading a file into an array and performing many Clearcase operations such as creating a view, checking to see if a view exists, mounting vobs, etc. I thought it's about time to have some Perl modules to offer these common tasks in a useful way. In particular, when writing log_activity I had to check to see if a particular view exists and create it if it doesn't, mount all the vobs, etc. Seems to me a set of Clearcase Perl modules would be useful to me, Broadcom and indeed others so I started coding them.</p>
150
151 <p>The idea here is to provide Perl objects for Clearcase objects that can be used and manipulated in a Perl manner. So a vob object would contain much of the registry information, in case you need it, as well as provide some common "actions" such a mount the vob represented by this object. The Vobs object would contain information about all vobs and things like itterrators and the like. A mount on a Vobs object would mean mount all vobs, etc. Similarly with a View object one could imagine methods such as exists which tells you if the view exists, create to create a view, remove to remove a view and so on.</p>
152
153 <p>Now these are not the only Clearcase oriented "objects" that need to be made into Perl objects nor do the current objects cover all of the access to the various functionality that they could - Clearcase is a huge system! But one must start somewhere...</p>
154
155 <p>Similarly I plan on making more modules for other things, like Utils.pm for things like reading in a whole file and returning an array or perhaps a string (wantarray would be useful here). The general idea is to start making more userful modules that are Perl like so that one can more quickly develop code and not slow themselves down reinventing the Perl wheel all the time. Combining this with hosting this code using CVS and my server should prove useful. The Clearcase object(s) may even be something that can be packaged up and perhaps put on CPAN (though I need to learn a lot more about things like POD and other things to make this comply better with any CPAN requirements), but all of this will be a "work in progress" for quite some time though. Remember though - "Every journey begins with the first step"...</p>
156                               
157                               <p class="entry-footer">
158                                  <span class="post-footers">Posted by  at  6:48 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000506.html">Permalink</a>
159                                  
160                                  
161                               </p>
162                            </div>
163                         </div>
164                      </div>
165                      
166                      
167
168                      <h2 class="date-header">December 28, 2005</h2>
169                      <a id="a000505"></a>
170                      <div class="entry" id="entry-505">
171                         <h3 class="entry-header">log_activity/create_dev_snapview.pl</h3>
172                         <div class="entry-content">
173                            <div class="entry-body">
174                               <ul>
175   <li>Worked on log_activity Perl script</li>
176
177   <li>Investigated issue with R/O components for create_dev_snapview.pl</li>
178 </ul>
179                               
180                               <h2>log_activity</h2>
181
182 <p>Ray Tran wrote:</p>
183
184 <blockquote type=cite>
185   <p>To summarize the three logging projects. The primary log directory is /projects/scm_tools_logs in San Jose. Please let me know if you have any input or suggestions</p>
186 </blockquote>
187
188 <p><b>We need a global area that's truly global!</b></p>
189
190 <p>Turns out that /projects/scm_tools_logs doesn't exist. I assume you meant /projects/IT_SCM/logs. However /projects/IT_SCM doesn't exist on either ccase-rmna-3 nor ccase-sj1-1... So running a script that requires Clearcase such as this I cannot access the directory where I need to deposit the log files! Additionally I cannot access /projects/IT_SCM/SCM/lib for my libraries nor /projects/IT_SCM/SCM/cc where the script would be residing...</p>
191
192 <blockquote type=cite>
193 <dl>
194   <dt>Activity logs</dt>
195     <dd><p>This is a log of who checked things out and into ClearCase and from what view. I think we can do this hourly and append to the log file so it doesn't take too long to run.</p></dd>
196 </dl>
197 </blockquote>
198
199 <p>Turns out lshistory is pretty flexible and efficient. One does not need to do a cleartool find on all elements and then call lshistory on individual elements, etc. The lshistory command supports a -recursive parameter. But we really want to report things across vobs. The lshistory command also supports a -avobs parameter. Two limitations here... First lshistory needs to work the context of a view. Secondly, -avobs only works on vobs that are mounted.</p>
200
201 <p>I've coded up a script called log_checkins which will create a view (named default &lt;- I can change this) if necessary and also mounts all vobs prior to calling lshistory. It also supports a -n parameter for number of days - thus -n 7 will produce a weeks worth of log files. Logfiles are named checkin.&lt;<i>date</i>&gt;.log where &lt;<i>date</i>&gt; is the date in YYYYMMDD format. So -n 1 (or not specifying -n) will produce a log file for the previous day (e.g. checkin.20051227.log) encompassing all activity on that day, while specifying -n 7 will produce 7 logfiles, one for each of the last 7 days properly dated.</p>
202
203 <p>The fields in the logfile (separated with ";") are:</p>
204
205 <ol>
206   <li>&lt;<i>date</i>&gt;.&lt;<i>time</i>&gt; (&lt;<i>date</i>&gt; is YYYYMMDD
207 and &lt;<i>time</i>&gt; is HHMMSS 24 hour format). This format makes the logfile easily sortable by date and time with sort(1).</li>
208
209   <li>&lt;<i>username</i>&gt; (Not sure where lshistory gets the username, normally is the same as the next field but sometimes it's different - e.g. "Clear Case Administrator")</li>
210
211   <li>&lt;<i>user</i>&gt;@&lt;<i>host</i>&gt; The user login name (e.g. adefaria) @ host (e.g. ltsjca-adefaria)</li>
212
213   <li>&lt;<i>event</i>&gt; The Clearcase event</li>
214
215   <li>&lt;<i>element</i>&gt; View extended path name</li>
216 </ol>
217
218 <h3>Clearcase Events</h3>
219
220 <p>I ran log_checkins for the last 30 days and examined the log files. No filtering for only "check in" events were done. The range of Clearcase events are:</p>
221
222 <ul>
223   <li>checkout directory version</li>
224
225   <li>checkout version</li>
226
227   <li>create activity</li>
228
229   <li>create baseline</li>
230
231   <li>create branch</li>
232
233   <li>create branch type</li>
234
235   <li>create directory element</li>
236
237   <li>create directory version</li>
238
239   <li>create file element</li>
240
241   <li>create hyperlink</li>
242
243   <li>create label type</li>
244
245   <li>create trigger type</li>
246
247   <li>create version</li>
248
249   <li>destroy activity in versioned object base</li>
250
251   <li>destroy checkpoint "&lt;<i>checkpoint</i>&gt;" in versioned object base</li>
252
253   <li>destroy element in versioned object base</li>
254
255   <li>destroy hyperlink "&lt;<i>hyperlink</i>&gt; in versioned object base</li>
256
257   <li>destroy sub-branch "&lt;<i>sub-branch</i>&gt;" of branch</li>
258
259   <li>destroy type in versioned object base</li>
260
261   <li>destroy version on branch</li>
262
263   <li>import file element</li>
264
265   <li>import hyperlink</li>
266
267   <li>lock activity</li>
268
269   <li>lock branch</li>
270
271   <li>lock branch type</li>
272
273   <li>lock trigger type</li>
274
275   <li>lock versioned object base</li>
276
277   <li>unlock activity</li>
278
279   <li>unlock versioned object base</li>
280 </ul>
281
282 <p>There are probably other event types. Also, in most cases the &lt;<i>element</i>&gt;
283 field contains additional information that can be extracted. For example:</p>
284
285 <div class="code"><pre>
286 20051201.151257;drambo;drambo@PCRMNA-DRAMBO;create
287 version;/vobs/OnePhone/pub/Makefile@@/main/OnePhone_mainline_Intr/OnePhone_3.2_Intr_new/10
288 </pre></div>
289
290 <p>one can see that this was a creation of a version in the OnePhone
291 vob of pub/Makefile. The part after the @@ is the branch information
292 (/main/OnePhone_mainline_Intr/OnePhone_3.2_Intr_new) and version 10.</p>
293
294 <p>Although you asked for checked out things, checked in things are more interesting. In fact I'd say that all of the above Clearcase events are interesting and that we should just log all of it (and I'll change log_checkins -&gt; log_activity and change checkin.&lt;<i>date</i>&gt;.log
295 -&gt; activity.&lt;<i>date</i>&gt;.log</p>
296
297 <blockquote type=cite>
298   <dt>Pulse check log</dt>
299     <dd><p>This is a script that should run a quick checkout and time the process. This should run at least every 15 minutes. I'm not sure if we need to set this up for each VOB or if we can just create a IT_SCM VOB and checkout from there. We then control how much data gets moved. For example in Perforce, I've created some file that are 100MB in size. I total the files and check this out. I now have control over the data.</p></dd>
300  
301   <dt>Statistic logs</dt>
302     <dd><p>This is a script that would create two logs - one general data for each site, one for each VOB of each site.</p>
303  
304     <p>The general data should have at the least - date_time;site;number of VOBs; number of total VOB size; number of snapshot views; number of dynamic views; number of file elements; number of directory element;...</p>
305  
306     <p>The VOB specific data - date_time;site;VOB_name;size of database;size of source pool; size of devired object; size of cleartext; size of admin data</p></dd>
307 </dl>
308  
309     <p>The directory structure that I envisioned is as such</p>
310  
311 <div class="code"><pre>
312 /projects/scm_tools_logs
313  
314  - cc
315       - 2005
316           - 12
317              - 01
318  </pre></div>
319 </blockquote>
320
321 <p>I see little benefit in constructing such a directory structure, especially programmatically. Instead I place the YYYYMMDD in the file name of the log file in a format described above. This format is easily parseable, sortable and grepable and it also compresses nicely. A directory structure such as above could easily be created at a later time or sets of logfiles could be easily gzipped and tar'ed (e.g. mkdir 2005; tar -zcf 2005/activity.logs.gz activity.2005*; rm activity.2005*).</p>
322
323 <h2>R/O Components & create_dev_snapview.pl</h2>
324
325 <p>After speaking at length with Shivdutt about this and learning more about UCM, projects, streams and the like I see a problem here. Let me explain it based on how I see this...</p>
326
327 <p>With UCM you have projects which contain components which can be R/W or R/O. Projects also have streams, one integration stream (and an associated integration view) and one or more development streams (and their associated development views).</p>
328
329 <p>When a development view is created in a development stream it is populated with all of the components in the project based on baselines. The difference here is that you can use different baselines for the various R/W components but you cannot use different baselines for the R/O components. The baseline information for R/O components is kept "globally" at the project level and is not modifiable in the development streams. Since, theoretically, R/O components are not modifiable they considered shared for all development streams.</p>
330
331 <p>While R/O components can have their baselines changed (usually advanced) at the project level, the act of doing so affects all development streams (dynamic development streams will be affected immediately while snapshot development views at next update time).</p>
332
333 <p>So if we had create_dev_snapview.pl alter the baselines of the R/O components by retarding (or advancing) them, then the side effect would affect other developers. We don't want that!</p>
334
335 <p>The only way to handle this would be to create a new project where the R/O components could be set to a previous set. This would be much more intensive and could easily be come unwieldy. For example, if you wanted 3 days worth of "history" we would need to create 3 projects to contain them.</p>
336                               
337                               <p class="entry-footer">
338                                  <span class="post-footers">Posted by  at 12:59 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000505.html">Permalink</a>
339                                  
340                                  
341                               </p>
342                            </div>
343                         </div>
344                      </div>
345                      
346                      
347
348                      <h2 class="date-header">December 27, 2005</h2>
349                      <a id="a000504"></a>
350                      <div class="entry" id="entry-504">
351                         <h3 class="entry-header">log_checkins</h3>
352                         <div class="entry-content">
353                            <div class="entry-body">
354                               <ul>
355   <li>Started investigating a log_checkins procedure</li>
356
357   <lI>Worked on Andrew's create_dev_snapview.pl</li>
358 </ul>
359                               
360                               <p class="entry-footer">
361                                  <span class="post-footers">Posted by  at 12:56 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000504.html">Permalink</a>
362                                  
363                                  
364                               </p>
365                            </div>
366                         </div>
367                      </div>
368                      
369                      
370
371                      <h2 class="date-header">December 23, 2005</h2>
372                      <a id="a000503"></a>
373                      <div class="entry" id="entry-503">
374                         <h3 class="entry-header">Clearquest Demo/CVSIMS</h3>
375                         <div class="entry-content">
376                            <div class="entry-body">
377                               <ul>
378   <li>Gave demonstration of Clearquest to Jene Fan and her group. Went pretty well</li>
379
380   <li>Investigating issue where cvsims seems to be called when one cvs adds a directory</li>
381 </ul>
382                               
383                               <p class="entry-footer">
384                                  <span class="post-footers">Posted by  at  2:39 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000503.html">Permalink</a>
385                                  
386                                  
387                               </p>
388                            </div>
389                         </div>
390                      </div>
391                      
392                      
393
394                      <h2 class="date-header">December 22, 2005</h2>
395                      <a id="a000502"></a>
396                      <div class="entry" id="entry-502">
397                         <h3 class="entry-header">Clearquest Demo/p4test/cvsims</h3>
398                         <div class="entry-content">
399                            <div class="entry-body">
400                               <ul>
401   <li>Set up a test bugs database for a demo</li>
402
403   <li>Set up p4test as a temp server for PQA on production data</li>
404
405   <li>Further coding of cvsims and integration into CVS</li>
406 </ul>
407                               
408                               <h2>CVSIMS Issues</h2>
409
410 <p>There are still some issues WRT cvsims:</p>
411
412 <ul>
413   <li>When you cvs add a directory it seems that cvsims is called. There is no issue IDs and thus thsi is a problem</li>
414
415   <li>Currently the path to the file being committed is not being passed. There is a %p that can be added to the command line in loginfo but it merely says "path relative to repository". What does that mean when you are checking in foo/foo.h, foo/foo.c and bar/bar.h?</li>
416 </ul>
417
418 <p>Turns out that cvs will make calls per path. IOW if you are checking in foo/foo.h, foo/foo.c and bar/bar.h cvs would call the loginfo trigger with path = foo for foo.h and foo.c then call the loginfo trigger again with path = bar for bar.h. Unfortuantely this would leave us with the more ugly:</p>
419
420 <div class="code"><pre>
421 ### adefaria Thu Dec 22 19:14:09 2005 ###
422 1.6 /projects/ccase_irva/cvsmaster/ims/foo/foo.h
423 1.7 /projects/ccase_irva/cvsmaster/ims/foo/foo.c
424
425 ### adefaria Thu Dec 22 19:14:10 2005 ###
426 1.4 /projects/ccase_irva/cvsmaster/ims/bar/bar.h
427 </pre></div>
428
429 <p>As you can see above I added both a -path and -repository options so I can compose the full path to each file.</p>
430
431 <p>One thing that is still not handled is the concept of branches. I'm not sure if that is required...</p>
432                               
433                               <p class="entry-footer">
434                                  <span class="post-footers">Posted by  at  6:55 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000502.html">Permalink</a>
435                                  
436                                  
437                               </p>
438                            </div>
439                         </div>
440                      </div>
441                      
442                      
443
444                      <h2 class="date-header">December 21, 2005</h2>
445                      <a id="a000501"></a>
446                      <div class="entry" id="entry-501">
447                         <h3 class="entry-header">Bugs/Integrating cvsims/PQA problems</h3>
448                         <div class="entry-content">
449                            <div class="entry-body">
450                               <ul>
451   <li>Created test bugs database for Clearquest evaluation</li>
452
453   <li>Worked on integrating cvsims into CVS</li>
454
455   <li>PQA web problems are surfacing. Need to set up newer web server</li>
456 </ul>
457                               
458                               <p class="entry-footer">
459                                  <span class="post-footers">Posted by  at  6:43 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000501.html">Permalink</a>
460                                  
461                                  
462                               </p>
463                            </div>
464                         </div>
465                      </div>
466                      
467                      
468
469                      <h2 class="date-header">December 20, 2005</h2>
470                      <a id="a000500"></a>
471                      <div class="entry" id="entry-500">
472                         <h3 class="entry-header">cvsims/SCM global area/ccase-rmna-4 issues</h3>
473                         <div class="entry-content">
474                            <div class="entry-body">
475                               <ul>
476   <li>Changed cvsims to use new global area</li>
477
478   <li>Created document for <a href="http://intranet.broadcom.com/~adefaria/CVS/IMS.php">CVS/IMS Connector</a></li>
479
480   <li>Created new global area</li>
481
482   <lI>Working on another users problems with accessing ccase-rmna-4</li>
483 </ul>
484                               
485                               <h2>Global File System Area - SCM</h2>
486
487 <p>I'm just trying to understand a little bit better about global paths, replication and DFS here at Broadcom. I ask because I see that this new SCM directory that I created over in Irvine is not at other sites as I would have expected it. For example:</p>
488
489 <div class="code"><pre>
490 ccase-rmna-3:ls -d /projects/ccase/SCM
491 ls: /projects/ccase/SCM: No such file or directory
492 ccase-rmna-3:ls /projects/ccase | wc -l
493      17
494 </pre></div>
495
496 <p>and</p>
497
498 <div class="code"><pre>
499 ccase-sj1-1:ls -d /projects/ccase/SCM
500 ls: /projects/ccase/SCM: No such file or directory
501 ccase-sj1-1:ls /projects/ccase | wc -l
502      16
503 </pre></div>
504
505 <p>However</p>
506
507 <div class="code"><pre>
508 x-irva-01:ls -d /projects/ccase/SCM                                           
509 /projects/ccase/SCM/
510 x-irva-01:ls /projects/ccase | wc -l                                          
511       24
512 </pre></div>
513
514 <p>So then the SCM directory exists in Irvine but not in SJ nor Richmond. I suspect that it's merely that something needs to replicate it and maybe I just need to wait until that happens. Still such a delay in replication is a side effect we must bear in mind when we are pushing out changes... Also, notice the different directory counts at the three sites above...</p>
515
516 <p>WRT Windows and DFS, my Z drive is mapped to \\brcm-sj\dfs and I therefore do not have a Z:\projects\ccase\SCM directory there either:</p>
517
518 <div class="code"><pre>
519 Local:ls -d /dev/z/projects/ccase/SCM
520 ls: /dev/z/projects/ccase/SCM: No such file or directory
521 Local:ls /dev/z/projects/ccase | wc -l
522 16
523 </pre></div>
524
525 <p>I suspect this correlates to ccase-sj1-1:/projects/ccase/SCM and whenever that directory gets populated so will my Z drive.</p>
526
527 <p>Again, it might be that replication will eventually happen or that it need to be set up. But we must understand that pushing something to some "global" place in Irvine, SJ or Richmond has a built in prorogation delay.</p>
528
529 <p>Finally, it seems to me that the intent of the projects automount map is to provide a well known path to global file space that exists on filers at the various sites and that replication between the filers happens on some known schedule. Scripts or other processes should "reach out" to the filer storage area they they know (e.g. \\brcm-irv\dfs\projects\ccase...) rather they should use the automount map (i.e. /projects/ccase) so as to avoid having to go out on the WAN to get stuff. For Unix this is pretty simplified in that the automounter and the projects automount map normalizes this to just /projects/<project>/<etc>. But can it be said that the same is true under Windows for the Z drive and DFS? By that I mean can I rely on Z:\projects\ccase\SCM to be the right place? If so then I will change my Perl code to set $lib_path = "Z:\\projects\\ccase\\SCM\\lib".</p>
530                               
531                               <p class="entry-footer">
532                                  <span class="post-footers">Posted by  at  5:27 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000500.html">Permalink</a>
533                                  
534                                  
535                               </p>
536                            </div>
537                         </div>
538                      </div>
539                      
540                      
541
542                      <h2 class="date-header">December 19, 2005</h2>
543                      <a id="a000499"></a>
544                      <div class="entry" id="entry-499">
545                         <h3 class="entry-header">BinRebase/ccase-rmna-4 problems</h3>
546                         <div class="entry-content">
547                            <div class="entry-body">
548                               <ul>
549   <li>BinRebase may need to use findmerge instead of rebase</li>
550
551   <li>Worked with Shivdutt re: satellite San Jose/Richmond user</li>
552 </ul>
553                               
554                               <h2>BinRebase may need to use findmerge</h2>
555
556 <p>Rebasing is different than delivering. With Inter Project Deliver developers are "delivering" from one project to the next. This is not a real delivery as in delivering to the integration stream, rather it's a delivery from one project to another. What we have here is a hierarchy outside of the normal heirarchy supported by UCM.</p>
557
558 <p>Delivery between projects therefore is merely a findmerge and indeed the deliver command is not used. Rebasing, called <i>Rebase to parent</i>, however still uses the rebase command. This presents a problem in that rebase -preview -long does not operate the same way as findmerge -print. For one it does not do recursive directory merging like findmerge does (with findmerge we can capture and control the merging by using -print and handling the merging by ourselves). IBM/Rational designed deliver and rebase to be as automatic as possible. I suspect therefore that rebase automatically handles recursive directory merging thus not allowing you to do the recursive directory merging yourself.</p>
559
560 <p>"So fine" you say, "Just let rebase handle all of the directory merging". Well there is no way to do just directory merging and remember we want to capture and handle the file element merging ourselves so we can capture those instances where merge conflicts and binary merges exist, delaying them to the very end and handling the binary merge (or rebase) ourselves. With rebase we don't seem to have the same options as with findmerge and thus this may not be doable.</p>
561
562 <p>"OK, fine" you say again, "Skip the rebasing and just use findmerge". While that may be doable we will not have the "rebase in progress" behavior that they are currently accustomed to. That plus rebase opperates off of baselines and even recommendated baselines. We would need to figure out how that translates to labels that findmerge can use - and they'd need to be labels of possibly multiple components and the like. For now we are shelfing this BinRebase until we obtain more input...</p>
563                               
564                               <p class="entry-footer">
565                                  <span class="post-footers">Posted by  at  5:09 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000499.html">Permalink</a>
566                                  
567                                  
568                               </p>
569                            </div>
570                         </div>
571                      </div>
572                      
573                      
574
575                      <h2 class="date-header">December 15, 2005</h2>
576                      <a id="a000498"></a>
577                      <div class="entry" id="entry-498">
578                         <h3 class="entry-header">CQ Web/Rebase/GNATS Access</h3>
579                         <div class="entry-content">
580                            <div class="entry-body">
581                               <ul>
582   <li>Set up GNATS access for a user</li>
583
584   <li>Helped Vinh with issues regarding old CQ Web and a bug that it has</li>
585
586   <li>Assisted a few users with resolving Evil Twin problems</li>
587
588   <li>More fully documented how to resolve Evil Twin problems by merging the parent directory</li>
589
590   <lI>Investigated implementing the other half of BinMerge where we use rebase instead of find merge</li>
591 </ul>
592                               
593                               <h2>Rebase</h2>
594
595 <p>Initially I thought that rebase did not work like findmerge in that it didn't have options for performing essentially the merge operate and just telling you what needed to merge. Turns out it does have that option - cleartool merge -preview -long. The long option causes rebase to list out what needs to be merged.</p>
596
597 <p>But rebase is more than just a findmerge. Additionally one needs to do the following:</p>
598
599   <ul>
600     <li>Create and set an activity for the view</li>
601
602     <li>Check out items first</li>
603
604     <li>Perform the merge with -abort noting which merges failed and how they failed</li>
605
606     <li>Execute the rebase command to mark the view as being rebased</li>
607
608     <li>Execute the rebase -complete to mark the rebase completed (IFF all elements are rebased)</li>
609   </ul>
610
611 <p>Of course this is just a preliminary list - we still need to figure out if rebasing, merging actually, of directories need to be done first (probably), how to execute rebase to mark "rebase in progress" without actually attempting to merge anything, etc.</p>
612                               
613                               <p class="entry-footer">
614                                  <span class="post-footers">Posted by  at  5:06 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000498.html">Permalink</a>
615                                  
616                                  
617                               </p>
618                            </div>
619                         </div>
620                      </div>
621                      
622                      
623
624                      <h2 class="date-header">December 14, 2005</h2>
625                      <a id="a000497"></a>
626                      <div class="entry" id="entry-497">
627                         <h3 class="entry-header">get_views_for_stream/create_dev_snapview.pl</h3>
628                         <div class="entry-content">
629                            <div class="entry-body">
630                               <ul>
631   <li>Found and fixed bug in get_views_for_stream</li>
632
633   <li>Fixed bug in create_dev_snapview.pl::ParseBaselines
634 </ul>
635                               
636                               <h2>get_views_for_stream</h2>
637
638 <p>Hi Naga. I'm writing you this because I believe there's a bug, possibly with Clearcase, but that seems to manifest itself in code I believe you wrote. I came across this implementing enhancements to create_dev_snapview.pl for Andrew Feltham. In essence Andrew wants to be able to have multiple views in a stream. I've implemented a -reuse_stream parm to allow this. If -reuse_stream is used then the code will skip recreating the stream and effectively just make another view in that same stream. If -reuse_stream is not specified then the stream is removed - along with any views that that stream has.</p>
639
640 <p>It appears as if the code was coded to attempt to handle the case where a stream has multiple views however it fails due to a possible but with lsstream. When calling create_stream the code checks to see if the stream exists and if it does it attempts to recreate the stream by determining the view(s) in the stream, deleting them, deleting the stream and creating the stream anew.</p>
641
642 <p>To determine the view(s) in the stream get_views_for_stream is called. Here's the original function:</p>
643
644 <div class="code"><pre>
645 sub get_views_for_stream {
646     my $sel_pvob = $_[0];
647     my $sel_stream = $_[1];
648
649     my @views = split(/\n/, `cleartool lsstream -fmt \"\%\[views\]p\\n\" stream:$sel_stream\@\\$sel_pvob`);
650     return @views;
651 }
652 </pre></div>
653
654 <p>Essentially it does an lsstream asking for only the views, separated by newlines. The problem is that lsstream (with that format) does not return the views separated by newlines:</p>
655
656 <div class="code"><pre>
657 P:\>cleartool lsstream -fmt "%[views]p\n" stream:Build_rmnaNT_adefaria_LTSJCA-ADEFARIA_sv_ldx_2.3@\rmna_projects
658 adefaria_test adefaria_test2 adefaria_test3
659
660 P:\>
661 </pre></div>
662
663 <p>As you can see adefaria_test, adefaria_test2 and adefaria_test3 all appear on the same line. The code then splits the line on \n and effectively always returns a 1 entry array with possibly multiple view names in the first entry separated by spaces. Needless to say this will fail later on when remove_view is called and it generates a "cleartool rmview -force &lt;view names&gt;".</p>
664
665 <p>Here's my proposed fix:</p>
666
667 <div class="code"><pre>
668 sub get_views_for_stream {
669     my $sel_pvob = $_[0];
670     my $sel_stream = $_[1];
671     # Modified Wed Dec 14 11:25:09 PST 2005 Andrew@DeFaria.com
672     #
673     # Note: The format -fmt "%[views]p\n" below does not work! What is
674     # expected to be returned is:
675     #
676     # view1
677     # view2
678     # view3
679     #
680     # However what is actually returned is:
681     #
682     # view1 view2 view3
683     #
684     # Therefore the old spilt of /\n/ always returned a single entry
685     # array with possibly multiple view names in the first
686     # entry. Changed to use / / for split and not append a \n.
687     my @views = split(/ /, `cleartool lsstream -fmt \"\%\[views\]p\" stream:$sel_stream\@\\$sel_pvob`);
688     return @views;
689 }
690 </pre></div>
691
692 <p>Is this acceptable to you?</p>
693                               
694                               <p class="entry-footer">
695                                  <span class="post-footers">Posted by  at  1:48 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000497.html">Permalink</a>
696                                  
697                                  
698                               </p>
699                            </div>
700                         </div>
701                      </div>
702                      
703                      
704
705                      <h2 class="date-header">December 13, 2005</h2>
706                      <a id="a000496"></a>
707                      <div class="entry" id="entry-496">
708                         <h3 class="entry-header">cvsims</h3>
709                         <div class="entry-content">
710                            <div class="entry-body">
711                               <ul>
712   <li>Updated triggers on ccase-rmna-3 as some new vobs seem to lack them</li>
713
714   <li>Updated cvsims to parse input and handle both -pre and -post operations</li>
715
716   <li>Had problems with CVS admin files</li>
717 </ul>
718                               
719                               <h2>CVSIMS</h2>
720
721 <p>I have managed to learn how to update IMS and I'm at the point where I need to understand the input requirements better. I will describe what I envision happening and follow it with a few questions.</p>
722
723 <p>In general the desire seems to be to update IMS when a commit happens in certain CVS repositories<a href="#q1"><sup>1</sup></a>. As such commit comment information will need to conform to a certain format. Commit comments need to have the following in them identifying the IMS Issue ID they are associated with:</p>
724
725 <div class="code"><pre>
726 IMSIssueID: &lt;issue ID&gt;
727 </pre></div>
728
729 <h3>Pre-commit checks (i.e. verifymsg)</h3>
730
731 <p>The string "IMSIssueID: " must appear at the start of a line followed by the issue ID<a href="#q2"><sup>2</sup></a>. The IMSIssueID must exist in IMS<a href="#q3"><sup>3</sup></a>. If the issue ID is not in IMS then the commit will not be allowed. Commits lacking any IMSIssueID will be rejected<a href="#q4"><sup>4</sup></a>.</p>
732
733 <h3>Post-commit operations (i.e. loginfo)</h3>
734
735 <p>If the pre-commit checks pass the IMS issue will have it's change set field updated with the file names of the committed files. As change set is an append only field the following separator will be added first followed by the list of files<a href="#q5"><sup>5</sup></a>:</p>
736
737 <div class="code"><pre>
738 # &lt;USERNAME&gt; &lt;DATE_TIME&gt; committed:
739 file1
740 file2
741 ...
742 </pre></div>
743
744 <p>Again, as change set is an append only field there may be multiple updates like so:</p>
745
746 <div class="code"><pre>
747 # &lt;USERNAME&gt; &lt;DATE_TIME&gt; committed:
748 file1
749 file2
750 ...
751 # &lt;USERNAME&gt; &lt;DATE_TIME&gt; committed:
752 file10
753 </pre></div>
754
755 <h3>Questions</h3>
756 <ol>
757   <li><a name="q1"></a>Which repositories does this apply?</li>
758
759   <li><a name="q2"></a>Are multiple IMSIssueIDs allowed? If so then are multiple lines such
760 as the above acceptable or should the script search for perhaps a comma separated list of issue IDs?</li>
761
762   <li><a name="q3"></a>Should the script also check to insure that the issue ID is not in say a closed state?</li>
763
764   <li><a name="q4"></a>Is it true that all commits in a repository/module/directory <b>must</b> be associated to an IMS Issue?</li>
765
766   <li><a name="q5"></a>In addition to the file name should we include the revision checked in? Also should any other information be logged (e.g. repository)?</li>
767 </ol>
768
769 <h2>CVS Admin Files</h2>
770
771 <p>I got myself into a pickle. Here's what I was doing...</p>
772
773 <p>I wanted to modify <span>rcsinfo, verifymsg and loginfo
774 in our CVS test area (:pserver:adefaria@cvsps-irva-1:/projects/ccase_irva/cvsmaster)
775 so I checked out CVSROOT and modified those files. The idea was to have rcsinfo point to a template file so the user knows where to put the IMSIssueID, change verifymsg to call cvsism
776 (the connector) to verify that it can find the IssueID and that the IssueID exists in IMS and change loginfo to call cvsism to update the change set after the commit. Unfortunately I modified the files in such a way that I cannot check in at all. I need help in fixing this because I believe what needs to be done needs to be done on the server and I don't have a login there let alone root access.</p>
777
778 <p>The problem is that I don't understand what the cwd is when CVS fires off these triggers. For example, in rcsinfo I have the following line:</p>
779
780 <div class="code"><pre>
781 ALL /tmp/IMSIssueTemplate
782 </pre></div>
783
784 <p>"ALL" means for all files and /tmp/IMSIssueTemplate is the template file. But where is /tmp? Is it supposed to be on the server? Where's a good place to put these template files?</p>
785
786 <p>In verifymsg I have:</p>
787
788 <div class="code"><pre>
789 DEFAULT SCM/cvsbin/cvsims -pre
790 </pre></div>
791
792 <p>I want to run cvsims (which is in my home directory under SCM/cvsbin) but this also fails.
793 As a result of this I cannot use cvs commit to change verifymsg, hence I'm stuck!</p>
794
795 <p>In <span>loginfo</span> I have:</p>
796
797 <div class="code"><pre>
798 DEFAULT SCM/cvsbin/cvsims -post %{s}
799 </pre></div>
800
801 <p>Again SCM/cvsbin/cvsims is not a valid path.</p>
802
803 <p>How can I get this fixed? Where should I put these files?</p>
804                               
805                               <p class="entry-footer">
806                                  <span class="post-footers">Posted by  at 12:35 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000496.html">Permalink</a>
807                                  
808                                  
809                               </p>
810                            </div>
811                         </div>
812                      </div>
813                      
814                      
815
816                      <h2 class="date-header">December 12, 2005</h2>
817                      <a id="a000495"></a>
818                      <div class="entry" id="entry-495">
819                         <h3 class="entry-header">mktriggers/CVS</h3>
820                         <div class="entry-content">
821                            <div class="entry-body">
822                               <ul>
823   <li>Worked with Shivdutt on clearfsimport</li>
824
825   <li>Updated mktriggers to use fully qualified paths to Perl</li>
826
827   <li>Added stuff to CVS area - have not committed yet - wanna establish a commitinfo script to get an idea of what input is available to commit</li>
828 </ul>
829                               
830                               <p class="entry-footer">
831                                  <span class="post-footers">Posted by  at  6:14 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000495.html">Permalink</a>
832                                  
833                                  
834                               </p>
835                            </div>
836                         </div>
837                      </div>
838                      
839                      
840
841                      <h2 class="date-header">December  9, 2005</h2>
842                      <a id="a000494"></a>
843                      <div class="entry" id="entry-494">
844                         <h3 class="entry-header">Stripmime/IMS.pm</h3>
845                         <div class="entry-content">
846                            <div class="entry-body">
847                               <ul>
848   <li>Changed stripmime to perform logging if -v is present. Also debugged stripmime to the point where it seems to be properly being passed off the queue-pr</li>
849
850   <li>Implemented IMS.pm - a more Perl-like interface to IMS. Also started implementing cvs_ims to be a connector between CVS <-> IMS</li>
851 </ul>
852                               
853                               <p class="entry-footer">
854                                  <span class="post-footers">Posted by  at  4:43 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000494.html">Permalink</a>
855                                  
856                                  
857                               </p>
858                            </div>
859                         </div>
860                      </div>
861                      
862                      
863
864                      <h2 class="date-header">December  8, 2005</h2>
865                      <a id="a000493"></a>
866                      <div class="entry" id="entry-493">
867                         <h3 class="entry-header">Bin Merge updates/GNATS: Another word for "bug"! :-(</h3>
868                         <div class="entry-content">
869                            <div class="entry-body">
870                               <ul>
871   <li>Worked with David Dinh on getting Clearquest Windows Client on Citrix</li>
872
873   <lI>Updated BinMerge to always draw the merge arrow to the branch we are merging to</li>
874
875   <li>Fixed BinMerge's PerlTk portion to top the window iniitially</lI>
876
877   <li>Worked with Ravi on Stripmime and GNATS</li>
878 </ul>
879                               
880                               <h2>BinMerge updates</h2>
881
882 <p>Updated BinMerge to always draw the merge arrow to the branch we are merging to. There was also a bug about the choice returned from the PerlTk portion where it needed to not only be chomped but chopped until there were no more "\n"'s there. Don't know why that happened.</p>
883
884 <p>Additionally the PerlTk window would often not pop to the top of the window stack. This is apparenty common under Windows. I implemented the following code:</p>
885
886 <div class="code"><pre>
887     # Make sure the window pops to the top
888     # Trying really hard... :-)
889     $main->update;
890     $main->deiconify;
891     $main->update;
892     $main->raise;
893     $main->update;
894     $main->focusForce;
895     $main->update;
896
897     MainLoop;
898 </pre></div>
899
900 <p>At least this heavy handed approach seems to work.</p>
901
902 <h2>Stripmime and GNATS</h2>
903
904 <p>Ravi and I worked on the stripmimed thing a little today. Here's what
905 happened:</p>
906
907 <ul>
908   <li>We verified that stripmimed is indeed running. The alias was changed to not run Perl first rather to  use the shebang line. That was working - IOW /tools/gnats/4.0/bin/stripmimed would run. (later it broke).</li>
909
910   <li>We verified that stripmimed was writing properly to stdout.</li>
911
912   <li>We saw that /tools/gnats/4.0/SunOS/libexec/gnats/queue-pr was being run and a file was being deposited into /tools/gnats/db-test-it/gnats-queue.</li>
913
914   <li>We saw that /tools/gnats/4.0/SunOS/libexec/gnats/queue-pr would be run by cron (or by hand) and it would process the file deposited in the queue</li>
915
916   <li>After that we don't know where the information for this went. We were using Test/1 in the subject line which should update http://gnats-irva-3.broadcom.com/cgi-bin/gnatsweb.pl?debug=&amp;database=IT-Test&amp;cmd=edit&amp;cmd=edit&amp;pr=1
917 but it isn't.</li>
918 </ul>
919
920 <p>I attempted to debug this further and I made a change /tools/gnats/4.0/bin/stripmimed and now:</p>
921
922 <div class="code"><pre>
923 gnats-irva-3:/tools/gnats/4.0/bin/stripmimed
924 /tools/gnats/4.0/bin/stripmimed: line 44: use: command not found
925 /tools/gnats/4.0/bin/stripmimed: line 48: use: command not found
926 /tools/gnats/4.0/bin/stripmimed: line 49: use: command not found
927 /tools/gnats/4.0/bin/stripmimed: line 50: use: command not found
928 /tools/gnats/4.0/bin/stripmimed: line 51: use: command not found
929 /tools/gnats/4.0/bin/stripmimed: line 52: use: command not found
930 /tools/gnats/4.0/bin/stripmimed: line 54: undef: command not found
931 /tools/gnats/4.0/bin/stripmimed: line 56: my: command not found
932 /tools/gnats/4.0/bin/stripmimed: line 57: my: command not found
933 /tools/gnats/4.0/bin/stripmimed: line 58: my: command not found
934 /tools/gnats/4.0/bin/stripmimed: line 60: open: command not found
935 /tools/gnats/4.0/bin/stripmimed: line 61: or: command not found
936 /tools/gnats/4.0/bin/stripmimed: line 63: sub: command not found
937 /tools/gnats/4.0/bin/stripmimed: line 64: my: command not found
938 /tools/gnats/4.0/bin/stripmimed: line 66: print: command not found
939 /tools/gnats/4.0/bin/stripmimed: line 67: syntax error near unexpected token `}'
940 /tools/gnats/4.0/bin/stripmimed: line 67: `} # Log'
941 </pre></div>
942
943 <p>So how did we fix the shebang problem before? Also, why is queue-pr not properly updating the pr? (My suspicion is that the file attachment on this PR is messing up queue-pr - nope, that doesn't seem to be it...</p>
944                               
945                               <p class="entry-footer">
946                                  <span class="post-footers">Posted by  at  6:35 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000493.html">Permalink</a>
947                                  
948                                  
949                               </p>
950                            </div>
951                         </div>
952                      </div>
953                      
954                      
955
956                      <h2 class="date-header">December  7, 2005</h2>
957                      <a id="a000492"></a>
958                      <div class="entry" id="entry-492">
959                         <h3 class="entry-header">BinMerge Module & Perl Issues</h3>
960                         <div class="entry-content">
961                            <div class="entry-body">
962                               <ul>
963   <li>Changed bin_merge to be a module so that it easier to call from UCMCustom</li>
964
965   <li>Integrated new BinMerge.pm module into the UCMCustom</li>
966
967   <li>Added fix to use "\" in get_vob_str</li>
968
969   <li>Changed UCMCustom to use strict and warnings(we should always use these)</li>
970
971   <li>Changed UCMCustom to use use instead of require</li>
972
973   <li>Hunted down bug where UCMCustom undef's $/ (Bad UCMCustom!! Bad!)</lI>
974 </ul>
975                               
976                               <h2>BinMerge Module</h2>
977
978 <p>I decided to change bin_merge into a module (BinMerge) and use it in UCMCustom. I was having problems trying to start the bin_merge process and getting it going in a pipe so the output from verbose could give the user feed back. For some reason bin_merge has to exit before any output was returned. Might have been because of the $/ thing described below (Bad UCMCustom, bad!)</p>
979
980 <h2>Using strict</h2>
981
982 <p>I've been taught that both use strict and use warnings should always be used when coding Perl. These diagnoistic routines are helpful in catching some common Perl mistakes that are otherwise much more difficult to debug. In fact, in implementing this I found a few potential bugs that I also corrected.</p>
983
984 <blockquote>
985 <p><b>Note:</b> Some version of Perl do not have use warnings. Instead specify -w on the #! line.</p>
986 </blockquote>
987
988 <h2>Use vs Require</h2>
989
990 <p>Require is old hat. Use is the new require! From Perldoc's <a href="http://perldoc.perl.org/perlfaq8.html#What%27s-the-difference-between-require-and-use%3F">What's the difference between require and use?</a>:</p>
991
992 <blockquote>
993   <h2>What's the difference between require and use?</h2>
994
995   <p>Perl offers several different ways to include code from one file into another. Here are the deltas between the various inclusion constructs:</p>
996
997   <ol>
998     <li> do $file is like eval `cat $file`, except the former</li>
999       <ol>
1000         <li>searches @INC and updates %INC.</li>
1001
1002         <li>bequeaths an *unrelated* lexical scope on the eval'ed code.</li>
1003       </ol>
1004
1005     <li>require $file is like do $file, except the former</li>
1006       <ol>
1007         <li>checks for redundant loading, skipping already loaded files.</li>
1008
1009         <li>raises an exception on failure to find, compile, or execute $file.</li>
1010       </ol>
1011
1012     <li>require Module is like require "Module.pm", except the former</li>
1013       <ol>
1014         <li>translates each "::" into your system's directory separator.</li>
1015
1016         <li>primes the parser to disambiguate class Module as an indirect object.</li>
1017       </ol>
1018
1019     <li>use Module is like require Module, except the former</li>
1020       <ol>
1021         <li>loads the module at compile time, not run-time.</li>
1022
1023         <li>imports symbols and semantics from that package to the current one.</li>
1024       </ol>
1025   </ol>
1026 </blockquote>
1027
1028 <p>Note that becuase use loads the module at compile time one need to arrange for the @INC array to have any paths needed for use to succeed (IOW user written modules). In order to accomplish this one need to seed the @INC arrray in a BEGIN block as BEGIN blocks are executed before use is expanded,</p>
1029
1030 <h2>$/ Bug</h2>
1031
1032 <p>From Perldoc's <a href="http://perldoc.perl.org/perlvar.html">Perlvar</a>:</p>
1033
1034 <blockquote>
1035   <p>You should be very careful when modifying the default values of most special variables described in this document. In most cases you want to localize these variables before changing them, since if you don't, the change may affect other modules which rely on the default values of the special variables that you have changed. This is one of the correct ways to read the whole file at once:</p>
1036
1037   <div class="code"><pre>
1038   open my $fh, "foo" or die $!;
1039   local $/; # enable localized slurp mode
1040   my $content = <$fh>;
1041   close $fh;
1042   </pre></div>
1043
1044   <p>But the following code is quite bad:</p>
1045
1046   <div class="code"><pre>
1047   open my $fh, "foo" or die $!;
1048   undef $/; # enable slurp mode
1049   my $content = <$fh>;
1050   close $fh;
1051   </pre></div>
1052
1053   <p>since some other module, may want to read data from some file in the default "line mode", so if the code we have just presented has been executed, the global value of $/ is now changed for any other code running inside the same Perl interpreter.</p>
1054 </blockquote>
1055                               
1056                               <p class="entry-footer">
1057                                  <span class="post-footers">Posted by  at  5:44 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000492.html">Permalink</a>
1058                                  
1059                                  
1060                               </p>
1061                            </div>
1062                         </div>
1063                      </div>
1064                      
1065                      
1066
1067                      <h2 class="date-header">December  6, 2005</h2>
1068                      <a id="a000491"></a>
1069                      <div class="entry" id="entry-491">
1070                         <h3 class="entry-header">Stripmime/Cleardiffmrg/CharacterSetValidation</h3>
1071                         <div class="entry-content">
1072                            <div class="entry-body">
1073                               <ul>
1074   <li>Fixed stripmime</li>
1075
1076   <li>Worked with Shivdutt regarding the cleardiffmrg problem. Turns out to be a leading "/". Shivdutt fixed UCMCustom.pl</lI>
1077
1078   <li>Turned off character set validation on p4test for PQA. Have not implemented this on production yet</li>
1079 </ul>
1080                               
1081                               <h2>Stripmime</h2>
1082
1083 <p>After banging my head against stripmime all day I finally figured it out. It would work from the command line but not from sendmail! It turned out to be the fact that I was not setting output_dir rather deferring to cwd and in the context of sendmail and aliases I guess that won't do. Changed stripmime to call $parser->output_dir ("/tmp"). Ravi needs to test this then we can implement.</p>
1084
1085 <h2>Cleardiffmrg</h2>
1086
1087 <p>Tommy Kee was having problems with merging where the cleardiffmrg tool would not come up stating instead that it encountered and error. I had seen this sort of error before at Ameriquest but it was specifically with snapshot views and with views that were tagged with forward slashes (something that mktag allows but cleardiffmrg has a problem with). But here we were dealing with dynamic views and the view tags were with all backslashes (\).</p>
1088
1089 <p>However, UCMCustom.pl would call cleartool findmerge with a leading forward slash (e.g. /andy\path\to\search). I suspected that this leading slash might be causing the problem and eventual showed that it was indeed the problem. Shivdutt changed UCMCustom.pl to use a leading blackslash.</p>
1090
1091 <h2>CharacterSetValidation</h2>
1092
1093 <p>I called IBM/Rational support this morning to raise the priority on this one. The priority has been raised and IBM/Rational is investigating this more fully. Meantime they suggested, as a temporary workaround, to turn off checking of code pages. I've tried this:</p>
1094
1095 <div class="code"><pre>
1096     $ installutil setdbcodepagetonochecking -dbset 2005.02.00 admin <password>
1097     *********************************************************
1098     Starting test setdbcodepagetonochecking
1099     *********************************************************
1100     Note: setting the code page to 'no checking' can result
1101     in data corruption. Please refer to the ClearQuest Release
1102     Notes for more information.
1103     Successfully set the code page to 'no checking'.
1104
1105     *********************************************************
1106     Exit code 0 for test setdbcodepagetonochecking
1107     *********************************************************
1108 </pre></div>
1109
1110 <p>Note that this does not stop the CharacterSetValidation package from complaining! Turning off the CharacterSetValidation requires a schema change to return FALSE from enable_char_set_validation.</p>
1111
1112                               
1113                               <p class="entry-footer">
1114                                  <span class="post-footers">Posted by  at  5:20 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000491.html">Permalink</a>
1115                                  
1116                                  
1117                               </p>
1118                            </div>
1119                         </div>
1120                      </div>
1121                      
1122                      
1123
1124                      <h2 class="date-header">December  5, 2005</h2>
1125                      <a id="a000489"></a>
1126                      <div class="entry" id="entry-489">
1127                         <h3 class="entry-header">Cleardiffmrg/bin_merge problems</h3>
1128                         <div class="entry-content">
1129                            <div class="entry-body">
1130                               <ul>
1131   <li>Told Andrew about new -reuse_stream option to create_dev_snapview.pl. I have him testing this</li>
1132
1133   <li>Worked with Shivdutt and IBM/Rational on problem with cleardiffmrg. I think I've worked this out to the leading "/" that UCMCustom users.</li>
1134
1135   <li>Finished stripmime - Ray testing it - created stripmimed that logs to /tmp.</li>
1136
1137   <li>Worked at getting bin_merge integrated into UCMCustom.pl</li>
1138
1139   <li>Implemented quick script (topper) to try to catch the hanging problem with ccase-rmna-3</li>
1140 </ul>
1141                               
1142                               <h2>Cleardiffmgr problem</h2>
1143
1144 <p>The problem occurs during a deliver between projects where there is a merge conflict and UCMCustom wants to have findmerge call up a Cleardiffmgr to resolve the conflicts. I've seen this before WRT snapshot views and view tags with forward slashes at Ameriquest. UCMCustom perfaces' the vob tags with "/".</p>
1145
1146 <p>But this problem doesn't always happen - in fact most of the time it appears to work. It might be just when there's a merge conflict</p>
1147
1148 <p>After working with Shivdutt and IBM/Rational on the problem and getting down to reproducing it with a long cleartool findmerge command in the user's environment this problem started happening to me in my test environment as I was integrating bin_merge. After much narrowing down I found:</p>
1149
1150 <p>Here's some more information. As you know I started having a similar problem as the end user. I paired it down to the following. This fails (but does not always fail):</p>
1151
1152 <div class="code"><pre>
1153     Z:\andys_pvob>cleartool findmerge /andy\bin\cygwin_setup -fver \main\Andrew_Integration\6 -log NUL -gmerge -nc
1154     Needs Merge "/andy\bin\cygwin_setup" [to \main\Andrew_Integration\Andrew2_Integration\CHECKEDOUT from \main\Andrew_Integration\6 base \main\Andrew_Integration\5]
1155 </pre></div>
1156
1157 <p>However the following does work:</p>
1158
1159 <div class="code"><pre>
1160     Z:\andys_pvob>cleartool findmerge \andy\bin\cygwin_setup -fver \main\Andrew_Integration\6 -log NUL -gmerge -nc
1161     Needs Merge "\andy\bin\cygwin_setup" [to \main\Andrew_Integration\Andrew2_Integration\CHECKEDOUT from \main\Andrew_Integration\6 base \main\Andrew_Integration\5]
1162 </pre></div>
1163
1164 <p>Notice the difference? It's subtle. The first findmerge's path starts with a "/" while the second one starts with a "\".</p>
1165
1166 <h2>bin_merge integration</h2>
1167
1168 <p>My bin_merge script remains it's own process. This will be useful if others wish to use this process. However UCMCustom needs to incorporate calling bin_merge. I'm currently having a problem with this because I want to start bin_merge as a pipe so I can give the user feedback. But bin_merge runs to completion before the first output is received. I don't know why this is happening as it doesn't happen in a smaller test.pl environment, only under the massive UCMCustom.pl...</p>
1169                               
1170                               <p class="entry-footer">
1171                                  <span class="post-footers">Posted by  at  7:54 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000489.html">Permalink</a>
1172                                  
1173                                  
1174                               </p>
1175                            </div>
1176                         </div>
1177                      </div>
1178                      
1179                      
1180
1181                      <h2 class="date-header">December  1, 2005</h2>
1182                      <a id="a000488"></a>
1183                      <div class="entry" id="entry-488">
1184                         <h3 class="entry-header">Code Page/create_dev_snapview.pl</h3>
1185                         <div class="entry-content">
1186                            <div class="entry-body">
1187                               <ul>
1188   <li>Researched further code page issues</li>
1189
1190   <li>Added Everest (Isreal0 team members to PQA</li>
1191
1192   <li>Added -reuse_stream parm to create_dev_snapview.pl</li>
1193
1194   <li>Handed a preliminary copy of bin_merge to Jennifer</li>
1195
1196   <li>Submitted defect to IBM/Rational regarding CharacterSetValidation and Code Pages</li>
1197 </ul>
1198                               
1199                               <h2>CharacterSetValidation Package is not that good</h2>
1200
1201 <p>We have a remaining issue where a user will attempt to update a defect and receive an error from the CharacterSetValidation package. I re-engineered CheckCodePage.pl to check through the Controller database but it didn't find anything. Investigated the CharacterSetValidation package a little more in depth - how does it validate characters? How does it do it differently than me?</p>
1202
1203 <p>Turns out that it merely does:</p>
1204
1205 <div class="code"><pre>
1206   if ($line =~ /[^\t\n\r -\177]/) {
1207     <i>error</i>
1208   }
1209 </pre></div>
1210
1211 <p>This odd regex seems to be merely checking to see if the characters are printable or not. I don't see how this would, for example, prevent a non US ASCII character like é from slipping through!</p>
1212
1213 <p>Narrowing it down a bit with my CheckCodePage.pl (which merely checks that characters are in the range of ordinal 0 - 127 (AKA the US ASCII character set) I figured out that the above regex was failing on characters such as ordinal 7 (Bell) and others. IOW characters that are technically in the US ASCII character set but that are not printable. Not sure how to resolve this problem yet...</p>
1214
1215 <h2>Submitted defect to IBM/Rational regarding CharacterSetValidation and CodePages</h2>
1216
1217 <p>Recently we upgraded our Clearquest database using 2003.06.15. With this version of Clearquest comes the usage of Code Pages. We choose to set our Code Page to US-ASCII. In upgrading our database we checked to ensure that all character data was within the US-ASCII character set (characters in the range of 0-127). Additionally we installed the CharacterSetValidation package as the Clearquest Administration Guide says:</p>
1218
1219 <blockquote>
1220   <p>The CharacterSetValidation package prevents clients running earlier versions of ClearQuest from entering data in a user record from a code page other than the data code page value of that database. If you do not apply the CharacterSetValidation package to your schemas, it is possible for users to enter unsupported data from the client and for data to be corrupted when modified on certain clients.</p>
1221 </blockquote>
1222
1223 <p>However it doesn't appear that the CharacterSetValidation package properly prevents unsupported data from being entered. Additionally it actually is causing us problems because characters that are valid US-ASCII are being flagged by the CharacterSetValidation package as unsupported.</p>
1224
1225 <p>US-ASCII is, according to <a href="http://en.wikipedia.org/wiki/ASCII:">http://en.wikipedia.org/wiki/ASCII</a>:</p>
1226
1227 <blockquote>
1228   <p>ASCII is, strictly, a seven-<a href="http://en.wikipedia.org/wiki/Bit" title="Bit">bit</a> code, meaning that it uses the bit patterns representable with seven binary digits (a range of 0 to 127 decimal) to represent character information.</p>
1229 </blockquote>
1230
1231 <p>Ergo US-ASCII is the characters whose ordinal values lie in the range of 0-127.</p>
1232
1233 <p>The CharacterSetValidation package installs a few Perl subroutines into the CQ schema that are supposed to check that the character data matches the code page of the database. However there doesn't seem to be any Perl code to check the difference between say a code page of US-ASCII or say Latin-1.</p>
1234
1235 <p>What it all comes down to eventual, as far as I can see, is a call to check_for_control_chars_in_line. The operative Perl code is:</p>
1236
1237 <div class="code"><pre>
1238 if ($line =~ /[^\t\n\r -\177]/) {
1239   return (" contains unsupported character(s):");
1240 }
1241 </pre></div>
1242
1243 <p>The above regex seems to be saying if the string $line is <b>not</b> a tab (\t), a linefeed (\n), a carriage return (\r) or in the range of space through \177 then an unsupported character has occurred. This does not include the entire US-ASCII range of 0-127. So if a client generated a yen character (¥) the above would not flag it as an unsupported character and yet (¥ - <span>ord</span> 165) is not a US-ASCII character.</p>
1244
1245 <p>Finally, since we only screened for US-ASCII in the 0-127 range, we have data that contains things like the US-ASCII Bel (ord 7) and the like that CharacterSetValidation is flagging as invalid.</p>
1246                               
1247                               <p class="entry-footer">
1248                                  <span class="post-footers">Posted by  at  4:58 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000488.html">Permalink</a>
1249                                  
1250                                  
1251                               </p>
1252                            </div>
1253                         </div>
1254                      </div>
1255                      
1256                   </div>
1257                </div>
1258             </div>
1259          </div>
1260       </div>
1261    </div>
1262 </body>
1263 </html>