[comp.protocols.appletalk] CAP Bug report: 0001-0005

cck@cunixc.columbia.edu (Charlie C. Kim) (09/11/87)

We've gotten a number of bug reports that are worth sharing.  CAP Bug
reports, hopefully, will serve as a mechanism for doing this.  CAP Bug
reports will clearly state the distribution (with any patches) that
they apply to.  All bug reports, until distribution 5 comes out,
should be assumed to apply to CAP Pre-release distribution 4.00 with
Patches 5,6, and 7.

Here are the first 5

CAP Pre-Release Distribution 4.00 with Patches 5,6,7
Bug Report: 0001

Problem: Aufs with APPLESHARE100 defined will not compile correctly.
Reported by: Bill Croft, Sumex
Priority: Low
Diagnosis: In afpos.c, an ifdef was improperly done.
Solution:  Apply the following patch.

--- START OF PATCH ---
***************
*** 95,101
  #define ES_OWNER 0		/* external owner shift amount */
  
  #ifdef APPLESHARE100
! #define MACZEROTIME 0		/* zero time - see comments above */
  				/* Initmymactime for more information */
  				/* should be 80000000 */
  #endif

--- 95,101 -----
  #define ES_OWNER 0		/* external owner shift amount */
  
  #ifdef APPLESHARE100
! # define MACZEROTIME 0		/* zero time - see comments above */
  				/* Initmymactime for more information */
  				/* should be 80000000 */
  #else
***************
*** 98,103
  #define MACZEROTIME 0		/* zero time - see comments above */
  				/* Initmymactime for more information */
  				/* should be 80000000 */
  #endif
  
  #define MACZEROTIME 0x80000000	/* zero time - from AppleShare 1.1 on */

--- 98,105 -----
  # define MACZEROTIME 0		/* zero time - see comments above */
  				/* Initmymactime for more information */
  				/* should be 80000000 */
+ #else
+ # define MACZEROTIME 0x80000000	/* zero time - from AppleShare 1.1 on */
  #endif
  
  /* Mask search (is unix execute) bits for world, group and owner */
***************
*** 100,107
  				/* should be 80000000 */
  #endif
  
- #define MACZEROTIME 0x80000000	/* zero time - from AppleShare 1.1 on */
- 
  /* Mask search (is unix execute) bits for world, group and owner */
  
  #define IS_EX_WGO ((I_EX << IS_OWNER) | \

--- 102,107 -----
  # define MACZEROTIME 0x80000000	/* zero time - from AppleShare 1.1 on */
  #endif
  
  /* Mask search (is unix execute) bits for world, group and owner */
  
  #define IS_EX_WGO ((I_EX << IS_OWNER) | \
--- END OF PATCH ---

CAP Pre-Release Distribution 4.00 with Patches 5,6,7
Bug Report: 0002

 Date: 9/7/87
 Problem: bcmp in etc/atis.c is missing length argument
 Priority: Low
 Reported by: Robert Elz
 Diagnosis: bcmp used to "update" entries already in table.  This
could result in not being able to "update" entries when allowable (cf.
nbp.ext).  Main functionality is not affected and patch is not
"necessary".
 Solution: Apply the following patch.

---START OF PATCH---
*** /tmp/,RCSt1005471	Thu Sep 10 18:25:32 1987
--- /tmp/,RCSt2005471	Thu Sep 10 18:25:32 1987
***************
*** 487,493
  
    if (update) {			/* update==false ==> always insert */
      for (i=0; i < (point-1); i++) {
!       if (bcmp(&cetp->addr, &nbptentry->addr) == 0)
  	if (cetp->enume == nbptentry->enume) {
  	  bcopy(&nbptentry->ent, &cetp->ent, sizeof(cetp->ent));
  	  return(0);		/* done */

--- 487,493 -----
  
    if (update) {			/* update==false ==> always insert */
      for (i=0; i < (point-1); i++) {
!       if (bcmp(&cetp->addr, &nbptentry->addr, sizeof(cetp->addr)) == 0)
  	if (cetp->enume == nbptentry->enume) {
  	  bcopy(&nbptentry->ent, &cetp->ent, sizeof(cetp->ent));
  	  return(0);		/* done */

---END OF PATCH---


CAP Pre-Release Distribution 4.00 with Patches 5,6,7
Bug Report: 0003

 Date: 9/5/87
 Problem: IDLESTUFF code has race condition
 Reported by: Roy Smith, NY Public Health Research Institute
 Priority: Medium
 Diagnosis: "After installing your latest patches to cap, and defining
FSLOWQ=1 in the samples Makefile, we are still getting occasional
hangups with the LW going idle.  As I described earlier, the IDLESTUFF
code that comes with cap has a race condition which causes multiple
copies of the document to print.  I reworked the IDLESTUFF code a bit
to get rid of the race condition.  We've been running this for a few
days and it seems to work fine.  I've never seen it get hung and the
one time it invoked the idle recovery code, it didn't print any extra
copies.  Diffs follow.  You might want to include this in your next
release."  Note: we don't see the problem so we don't have IDLESTUFF
enabled, thus I've haven't tested the code.
 Solution: Apply the following patch

---- START OF PATCH ---
*** /tmp/,RCSt1001286	Sat Sep  5 19:50:22 1987
--- papif.c	Wed Sep  2 13:22:03 1987
***************
*** 527,533
    AddrBlock addr;
    int hangup();
    PAPStatusRec status;
!   
    PAPHalfClose(cno);
    signal(SIGCHLD, hangup);
    addr.net = 0;		/* sufficient */

--- 527,536 -----
    AddrBlock addr;
    int hangup();
    PAPStatusRec status;
! #ifdef IDLESTUFF
!   int count = 0;
! #endif IDLESTUFF
! 
    PAPHalfClose(cno);
    signal(SIGCHLD, hangup);
    addr.net = 0;		/* sufficient */
***************
*** 542,557
        cpyp2cstr(tmpbuf, status.StatusStr);
        if (strncmp("status: idle", tmpbuf, 12) == 0
  	  || access("/tmp/papifidletest", F_OK) == 0) {
! 	fprintf(stderr,"PAPIF:  status: idle bug; restarting\n");
! 	fflush(stderr);
! 	unlink("/tmp/papifidletest");
! 	for (i = 0 ; i < NSIG ; i++)
! 	  signal(i, SIG_IGN);
! 	sprintf(retry,
! 		"(sleep 2;/etc/lpc abort %s;sleep 2;/etc/lpc start %s)&", 
! 		printer, printer);
! 	system(retry);
! 	exit(lpd_REPRINT);
        }
      }
  #endif IDLESTUFF

--- 545,565 -----
        cpyp2cstr(tmpbuf, status.StatusStr);
        if (strncmp("status: idle", tmpbuf, 12) == 0
  	  || access("/tmp/papifidletest", F_OK) == 0) {
! 	count++;
! 	if (count >= 3) {	/* Idle 30 seconds?  Could be made shorter. */
! 	  fprintf(stderr,"PAPIF:  status: idle bug; restarting\n");
! 	  fflush(stderr);
! 	  unlink("/tmp/papifidletest");
! 	  for (i = 0 ; i < NSIG ; i++)
! 	    signal(i, SIG_IGN);
! 	  sprintf(retry,
! 		  "(sleep 2;/etc/lpc abort %s;sleep 2;/etc/lpc start %s)&", 
! 		  printer, printer);
! 	  system(retry);
! 	  exit(lpd_REPRINT);
! 	}
!       } else {
!         count = 0;	/* once it goes non-idle; restart count */
        }
      }
  #endif IDLESTUFF

---- END OF PATCH ---


CAP Pre-Release Distribution 4.00 with Patches 5,6,7
Bug Report: 0004

 Date: 9/5/87
 Problem: Error in lib/abatp.c that can affect non-pcc compilers.
 Reported by: Robert Elz
 Priority: Medium
 Diagnosis: Two places in abatp.c where a pointer to function was not
dereference before it was used.  Many compilers will generate the
"right" object code anyway, but source code is wrong.
 Solution:  Apply the following patch

--- START OF PATCH ---
*** abatp.c	Thu Sep  3 04:00:38 1987
--- abatp.c.fixed	Sat Sep  5 05:15:53 1987
***************
*** 1037,1043 ****
  #endif
    dq_elem(&rspcblist[rspcb_hash(rspcb->atpsocket)], &rspcb->link);
    if (rspcb->callback != NULL)
!     (rspcb->callback)(rspcb->abr, rspcb->cbarg);
    q_tail(&rspcb_free, &rspcb->link); /* add to free list */
  }
  
--- 1037,1043 ----
  #endif
    dq_elem(&rspcblist[rspcb_hash(rspcb->atpsocket)], &rspcb->link);
    if (rspcb->callback != NULL)
!     (*rspcb->callback)(rspcb->abr, rspcb->cbarg);
    q_tail(&rspcb_free, &rspcb->link); /* add to free list */
  }
  
***************
*** 1198,1204 ****
  #endif
    dq_elem(&rqcblist[rqcb_hash(rqcb->atpsocket)], &rqcb->link);
    if (rqcb->callback != NULL)
!     (rqcb->callback)(rqcb->abr, rqcb->cbarg);
    q_tail(&rqcb_free, &rqcb->link); /* add to free list */
  }
  
--- 1198,1204 ----
  #endif
    dq_elem(&rqcblist[rqcb_hash(rqcb->atpsocket)], &rqcb->link);
    if (rqcb->callback != NULL)
!     (*rqcb->callback)(rqcb->abr, rqcb->cbarg);
    q_tail(&rqcb_free, &rqcb->link); /* add to free list */
  }
  
***************
*** 1314,1320 ****
  
    dq_elem(&tcblist, &tcb->link);
    if (tcb->callback != NULL)
!     (tcb->callback)(tcb->abr, tcb->cbarg);
    q_tail(&tcb_free, &tcb->link); /* add to free list */
  }
  
--- 1314,1320 ----
  
    dq_elem(&tcblist, &tcb->link);
    if (tcb->callback != NULL)
!     (*tcb->callback)(tcb->abr, tcb->cbarg);
    q_tail(&tcb_free, &tcb->link); /* add to free list */
  }

--- END OF PATCH ---


CAP Pre-Release Distribution 4.00 with Patches 5,6,7
Bug Report: 0005

 Date: 8/31/87
 Problem: pap client code hangs in open state at times.  This is the
infamous IDLE bug that the papif IDLESTUFF ifdef gets around.
 Reported by: Bill Croft, Sumex many ages ago
 Priority: Medium
 Diagnosis: Handling in abpapc of open is off.  Hopefully, the
corrections below fix it.
 Solution: Apply the following patch.
--- START OF PATCH ---
*** /tmp/,RCSt1006194	Thu Sep 10 18:51:13 1987
--- abpapc.c	Mon Aug 31 16:29:42 1987
***************
*** 1,7
  /*
!  * $Author: cck $ $Date: 87/08/18 21:08:55 $
!  * $Header: abpapc.c,v 1.7 87/08/18 21:08:55 cck Rel $
!  * $Revision: 1.7 $
  */
  
  /*

--- 1,7 -----
  /*
!  * $Author: cck $ $Date: 87/08/31 16:29:36 $
!  * $Header: abpapc.c,v 1.8 87/08/31 16:29:36 cck Exp $
!  * $Revision: 1.8 $
  */
  
  /*
***************
*** 195,207
      return;
    }
    pub = (PAPUserBytes *) &ps->bds[0].userData;
!   if (abr->abResult != reqFailed || pub->PAPtype != papOpenConnReply) {
!     ps->rrskt = ps->por.papOR.atprskt; /* remote responding socket */
!     sslen = (int)(ps->por.papS.status[0]);
!     bcopy(ps->por.papS.status, ps->statusbuff->StatusStr,  sslen+1);
!     if (ps->por.papOR.result == 0) {
!       ps->rflowq = ps->por.papOR.flowq; /* save remote flow quantum */
!       start_papc(ps);
        return;
      }
      /* wait two seconds */

--- 195,203 -----
      return;
    }
    pub = (PAPUserBytes *) &ps->bds[0].userData;
!   if (abr->abResult != reqFailed) {
!     if (abr->abResult == sktClosed) {
!       *ps->comp = sktClosed;	/* only way to abort... */
        return;
      }
      if (abr->abResult == noErr && pub->PAPtype == papOpenConnReply) {
***************
*** 203,208
        ps->rflowq = ps->por.papOR.flowq; /* save remote flow quantum */
        start_papc(ps);
        return;
      }
      /* wait two seconds */
      Timeout(res_open, ps, 4*2);	/* will always.. */

--- 199,214 -----
      if (abr->abResult == sktClosed) {
        *ps->comp = sktClosed;	/* only way to abort... */
        return;
+     }
+     if (abr->abResult == noErr && pub->PAPtype == papOpenConnReply) {
+       ps->rrskt = ps->por.papOR.atprskt; /* remote responding socket */
+       sslen = (int)(ps->por.papS.status[0]);
+       bcopy(ps->por.papS.status, ps->statusbuff->StatusStr,  sslen+1);
+       if (ps->por.papOR.result == 0) {
+ 	ps->rflowq = ps->por.papOR.flowq; /* save remote flow quantum */
+ 	start_papc(ps);
+ 	return;
+       }
      }
      /* wait two seconds */
      Timeout(res_open, ps, 4*2);	/* will always.. */

--- END OF PATCH ---