Initial add of defaria.com
[clearscm.git] / defaria.com / blogs / Status / archives / week_2006_10_01.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: October  1, 2006 - October  7, 2006 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/week_2006_09_24.html" title="September 24, 2006 - September 30, 2006" />
16    <link rel="next" href="http://defaria.com/blogs/Status/archives/week_2006_10_08.html" title="October  8, 2006 - October 14, 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/week_2006_09_24.html">&laquo; September 24, 2006 - September 30, 2006</a> |
36                         <a href="http://defaria.com/blogs/Status/">Main</a>
37                         | <a href="http://defaria.com/blogs/Status/archives/week_2006_10_08.html">October  8, 2006 - October 14, 2006 &raquo;</a>
38                      </p>
39                      
40                      
41                      
42
43                      <h2 class="date-header">October  5, 2006</h2>
44                      <a id="a000577"></a>
45                      <div class="entry" id="entry-577">
46                         <h3 class="entry-header">Rexec</h3>
47                         <div class="entry-content">
48                            <div class="entry-body">
49                               <ul>
50   <li>Fixed bug in gpdb_add_project.pl</li>
51
52   <li>Met about MultiSite Hardening Daemon (MSHD)</li>
53 </ul>
54                               
55                               <h2>Rexec</h2>
56
57 <p>The gpdb_add_project.pl script utilizes rsh to log into remote sites to execute and otherwise gather data from other sites (Actually it uses rsh locally too but that's another blog entry!). It does this with code like this:</p>
58
59 <div class=code><pre>
60 unless ($site_registry_handle->open("rsh $siteHash{$siteName} -n cat $syncReg |"))  {
61    print ("Can not open rsh $siteHash{$siteName} -n cat $syncReg |.\n");
62    exit;
63 }
64 </pre></div>
65
66 <p>The problem is that the above code will not work. What is returned from the open call here is whether or not the rsh command worked - not whether or not the cat command worked! Indeed open of a pipe returns little - it's the close of the pipe that's going to return the status of the rsh! The status of the cat in this case is never returned. And in this case it was failing. There is no real reliable method for getting the status of the cat command except perhaps to process the remote session using expect or Perl/Expect.</p>
67
68 <p>Since we expect the cat to work and to return lines and because there is a specific format for the first line, I implemented the following:</p>
69
70 <div class=code><pre>
71 sub GetDSRegFile {
72   my $file      = shift;
73   my $server    = shift;
74
75   my @lines;
76
77   if ($server) {
78     @lines = `rsh $server -n cat $file`;
79
80     return undef if $?;
81   } else {
82     @lines = `cat $file`;
83   } # if
84
85   if ($lines [0] and $lines [0] !~ /\#\# SYNC_VERSION 1\.0/) {
86     return undef;
87   } else {
88     return @lines;
89   } # if
90 } # GetDSRegFile
91 </pre></div>
92
93 <p>This solves the problem for this particular case. However this script uses this invalid technique for many other "remote calls" and has potential for error.</p>
94
95
96                               
97                               <p class="entry-footer">
98                                  <span class="post-footers">Posted by  at  3:21 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000577.html">Permalink</a>
99                                  
100                                  
101                               </p>
102                            </div>
103                         </div>
104                      </div>
105                      
106                      
107
108                      <h2 class="date-header">October  3, 2006</h2>
109                      <a id="a000576"></a>
110                      <div class="entry" id="entry-576">
111                         <h3 class="entry-header">Redirecting on ErrorDocument</h3>
112                         <div class="entry-content">
113                            <div class="entry-body">
114                               <ul>
115   <li>Looked into redirecting when ErrorDocument is called. Doesn't look like it'll work</li>
116 </ul>
117                               
118                               <p>I thought it might be possible to direct the users to the proper Clearquest schemea and Context ID by trapping on ErrorDocument. Normally when a document is not found (i.e. error 404) Apache will display the ErrorDocument associated with error 404. I thought that that document could be a script that looked at the referer and then looked up in the table to see if the user entered a "group". so, IOW, if the user entered http://server/CSSD I could look up CSSD and see it refered to a Cleaquest schema and redirect them. If the group lookup failed then I could simply display a 404 error.</p>
119
120 <p>But alas, referer (passed in via the environment variable HTTP_REFERER) is only set if the user is coming from an existing page. Here most often users are typing in the URL or have the URL bookmarked. In either case referer is not set, and if it were it would be of no help anyway because it would not be from http://server/CSSD (since that page does not really exist).</p>
121                               
122                               <p class="entry-footer">
123                                  <span class="post-footers">Posted by  at  1:28 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000576.html">Permalink</a>
124                                  
125                                  
126                               </p>
127                            </div>
128                         </div>
129                      </div>
130                      
131                   </div>
132                </div>
133             </div>
134          </div>
135       </div>
136    </div>
137 </body>
138 </html>