[16837] in Athena Bugs
olcd reporting machinfo
daemon@ATHENA.MIT.EDU (Jonathon Weiss)
Tue May 11 22:36:55 1999
Date: Tue, 11 May 1999 22:36:45 -0400 (EDT)
Message-Id: <199905120236.WAA00455@speaker-for-the-dead.mit.edu>
To: source-reviewers@MIT.EDU
Cc: bug-olc@MIT.EDU, ops@MIT.EDU
From: Jonathon Weiss <jweiss@MIT.EDU>
So I foolishly attempted to update olc's translations table (on the
test server) that hasn't been updated since 1992. Surprisingly, this
went very smoothly. Unsurprisingly there was a catch. While the
translations themselves worked perfectly, the code that figured out
what strinfs to translate was hopelessly screwed up. There were
several problems:
background info: the wire protocol here uses commas to seperate the
lines of output it gets from machtype while passing the info from the
client to the server.
1) sun processors are reported as SUNW,foo. Fixed by looking for
those 5 characters, and skipping over them.
2) SGIs report 3 lines of processor info. Look for and skip the 2nd
and third ones.
3) The code to translate the display code was only looking at the
first word on any line. I nuked the code that was going out of my way
to do this.
4) The SGI display info includes multiple lines, and a gazillion
commas too boot. I just nuked the stuff that looped on all of the
lines of display. No other platform produces multiple lines, not even
if they happen to have multiple displays.
5) The clients have been passing the Athena version to the server
since at least 7.7, and possibly as far back as 7.3, yet the server
had no idea it should expect it.
Jonathon
P.S. remember to have your barf bags handy before you look at the code.
Index: log.c
===================================================================
RCS file: /afs/dev.mit.edu/source/repository/athena/bin/olc/server/olcd/log.c,v
retrieving revision 1.48
diff -c -r1.48 log.c
*** log.c 1999/03/06 16:48:55 1.48
--- log.c 1999/05/12 02:10:30
***************
*** 608,624 ****
}
}
! /* This assumes all machines have a processor and memory (not a bad */
! /* assumption, I hope... */
- /* look for processor field */
p = strchr(os,',');
if (p == NULL)
return(stuff);
*p = '\0';
- o_mach = os;
-
p = p+1;
/* Need to special case for RS/6000 entry; it is formatted
processor, display, xxxxxx K
*/
--- 608,631 ----
}
}
! /* This assumes that the first piece of input is the Athena version,
! and that the memory description contains a comma.
! */
p = strchr(os,',');
if (p == NULL)
return(stuff);
*p = '\0';
p = p+1;
+ o_mach = p; /* The first line is the Athena Version */
+ /* strip whitespace off of front of CPU type */
+ while (*o_mach == ' ')
+ o_mach++;
+ if (strncmp("SUNW,",o_mach,5) == 0 ) {
+ /* Sun processors have commas imbeded in them; throw away the first part */
+ o_mach = o_mach+5;
+ }
+
/* Need to special case for RS/6000 entry; it is formatted
processor, display, xxxxxx K
*/
***************
*** 637,685 ****
*memory = ';';
memory = strrchr(p,',');
if (memory==NULL) {
! memory = p;
o_disp = "none";
}
else {
*memory = '\0';
memory++;
! o_disp = p+1;
}
}
! /* strip whitespace off of front of machine name */
! while (*o_mach == ' ')
! o_mach++;
size = strlen(o_mach);
for(i=0;i<n_mach;i++)
if (strncmp(o_mach,mach[i].orig,size) == 0) {
o_mach = mach[i].trans;
break;
}
! sprintf(stuff,"\nProcessor: %s\n",o_mach);
! while (o_disp != NULL) {
! p = strchr(o_disp,',');
! if (p != NULL) {
! *p = '\0';
! p++;
! }
! while (*o_disp == ' ')
! o_disp++;
! q = strchr(o_disp,' ');
! if (q != NULL)
! *q = '\0';
!
! size = strlen(o_disp);
! for(i=0;i<n_disp;i++)
! if (strncmp(o_disp,disp[i].orig,size) == 0) {
! o_disp = disp[i].trans;
! break;
! }
! sprintf(tmp_buf,"Display : %s\n",o_disp);
! strcat(stuff,tmp_buf);
! o_disp = p;
}
while (*memory == ' ')
memory++;
--- 644,720 ----
*memory = ';';
memory = strrchr(p,',');
if (memory==NULL) {
! memory = "unavailable";
o_disp = "none";
}
else {
*memory = '\0';
memory++;
! if (strncmp(o_mach,"SGI",3) == 0) {
! /* SGIs have 3 lines of CPU info skip the last two intelligently */
! p = strchr(o_mach,',');
! if (p == NULL)
! o_disp="none";
! *p = '\0';
! q = p+1;
! while (*q == ' ')
! q++;
! if (strncmp(q,"FPU:",4) == 0) {
! p = strchr(q,',');
! if (p != NULL) {
! *p = '\0';
! q = p+1;
! while (*q == ' ')
! q++;
! if (strncmp(q,"CPU:",4) == 0) {
! p = strchr(q,',');
! if (p != NULL) {
! *p = '\0';
! o_disp = p+1;
! } else {
! o_disp="none";
! }
! }
! }
! }
! } else {
! p = strchr(o_mach,',');
! if (p==NULL)
! o_disp="none";
! *p = '\0';
! o_disp = p+1;
! }
}
}
! /* Remember that first line of os that was the Athena Version */
! sprintf(stuff,"\nVersion : %s",os);
size = strlen(o_mach);
for(i=0;i<n_mach;i++)
if (strncmp(o_mach,mach[i].orig,size) == 0) {
o_mach = mach[i].trans;
break;
}
! sprintf(tmp_buf,"\nProcessor: %s\n",o_mach);
! strcat(stuff,tmp_buf);
! p = strchr(o_disp,',');
! if (p != NULL) {
! *p = '\0';
! p++;
}
+ while (*o_disp == ' ')
+ o_disp++;
+
+ size = strlen(o_disp);
+ for(i=0;i<n_disp;i++)
+ if (strncmp(o_disp,disp[i].orig,size) == 0) {
+ o_disp = disp[i].trans;
+ break;
+ }
+ sprintf(tmp_buf,"Display : %s\n",o_disp);
+ strcat(stuff,tmp_buf);
+ o_disp = p;
while (*memory == ' ')
memory++;