[comp.protocols.appletalk] cap problem report 0002

cck@CUNIXC.CC.COLUMBIA.EDU (Charlie C. Kim) (06/05/88)

Three problems listed here:
	o one of general interest
	o one of interest to people with Sun NFS based machines (e.g.
		with statfs)
	o one of interest to ultrix 2.2 people

Charlie C. Kim
User Services
Columbia University

CAP Release 5.00 - PROBLEM REPORT: 0002

Three bug reports here and all are in afpos.c as before.  Also, the
"date" fields in cpr.0001 all said 4/25/88 when they should have read
5/25/88.

REPORT 0002.1
OS: any
Revision: n/a
Major local modifications: n/a
Machine Type: n/a
Date: 6/5/88
Reported by: Scooter Morris, Genentech
Priority: medium

Problem: Change Priviledges on root folder fails, also when it does
work, trys to change the priviledges of . (okay) and .. (not really
okay).

Diagnosis: Actually, Change priviledge will fail anytime the
.finderinfo file for the specified directory is missing.  This is
often the case with the root of the volume.  (Note: the finderinfo
file is the one that holds finder information like the "view by",
folder position, etc.  If there is no finderinfo file for the top
level directory of a volume (e.g. the superior directory does not
contain a .finderinfo directory), then any changes you make to the
"view by" settings, etc. should be considered volatile).  In any
event, the problem was that the chowns were being done in the wrong
order and no check for "." and ".." was being done while changing the
protections of the contents of the folder.

Solution: Fix the ordering for chown and check for "." and ".." in the
chmod loop.  A patch follows.


REPORT 0002.2
OS: SUN NFS based systems (e.g. systems with statfs)
Revision: n/a
Major local modifications: n/a
Machine Type: n/a
Date: 6/5/88
Reported by: Charlie C. Kim, User Services, Columbia University
Priority: Low

Problem: When a file system goes over the "minfree" limit (usually,
10% of the actual space on a file system), the volume free space
reported on the Macintosh takes upon random values.

Diagnosis: statfs returns a negative number for the number of blocks
available to the user (bavail) when the file system is over this
limit.  Though bavail is normally the correct value to return since
most users are not allowed to write beyond the minfree limit, Aufs
should not return a negative number because this has no meaning to the
client programs.

Solution: Since there is no concept of a volume being beyond its
limit, we simply return 0 if the value has gone negative to indicate
that so far as the user is concerned, the volume is full.  A patch follows.

REPORT 0002.3
OS: Ultrix
Revision: 2.2
Major local modifications: n/a
Machine Type: n/a
Date: 6/5/88
Reported by: Brad Parker, Cayman Systems
Priority: High

Problem: Ultrix 2.2 significantly changed getmnt and Aufs purportedly
had code to handle the difference.  Unfortunately, the code was never
tested and was incorrect.  The fact that the code was never tested and
thus should be considered to be possibly incorrect was supposed to be
documented, but this got lost in the shuffle....

Diagnosis: A strcmp was done without checking the result properly when
testing the system types and the arguments to getmnt for Ultrix 2.2
were just plain wrong.

Solution: Apply the patch at the end of this report.  The patch was
tested and was reported to work.  Also, Configure should be modified
to add NUMGETMNTBUF=1 to the aufsosdefs() (as per cpr.0001) for Ultrix
2.2, but this is stuff for an update.


PATCH:

NOTE: the follow patch requires that the patch from CPR.0001 also be
applied.

%%START OF PATCH%%
*** /tmp/,RCSt1020476	Sun Jun  5 05:26:28 1988
--- afpos.c	Thu Jun  2 10:02:58 1988
***************
*** 304,310
      if (strcmp(unames.sysname, "ULTRIX-32") == 0) {
        if (strcmp(unames.release, "2.0") == 0 ||
  	  strcmp(unames.release, "1.2") == 0 ||
! 	  strcmp(unames.release, "1.1")) {
  	oldgetmnt = TRUE;
        } else oldgetmnt = FALSE;
      }

--- 304,310 -----
      if (strcmp(unames.sysname, "ULTRIX-32") == 0) {
        if (strcmp(unames.release, "2.0") == 0 ||
  	  strcmp(unames.release, "1.2") == 0 ||
! 	  strcmp(unames.release, "1.1") == 0) {
  	oldgetmnt = TRUE;
        } else oldgetmnt = FALSE;
      }
***************
*** 1395,1401
    flags = ipdir->flags;		/* should use to prevent overworking */
    if (own != -1 || grp != -1) {
      /* error recovery? do all just in case */
!     OSfname(path,ipdir,fn,F_FNDR);	/* change unix name */
      if ((err = unix_chown(path,own,grp)) != noErr)
        return(err);
      OSfname(path,ipdir,fn,F_RSRC);	/* change unix name */

--- 1395,1401 -----
    flags = ipdir->flags;		/* should use to prevent overworking */
    if (own != -1 || grp != -1) {
      /* error recovery? do all just in case */
!     OSfname(path,ipdir,fn,F_DATA);	/* change unix name */
      if ((err = unix_chown(path,own,grp)) != noErr)
        return(err);
      OSfname(path,ipdir,fn,F_RSRC);	/* change unix name */
***************
*** 1401,1407
      OSfname(path,ipdir,fn,F_RSRC);	/* change unix name */
      if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound)
        return(err);
!     OSfname(path,ipdir,fn,F_DATA);	/* create unix name */
      if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound)
        return(err);
      EModified(ipdir);

--- 1401,1407 -----
      OSfname(path,ipdir,fn,F_RSRC);	/* change unix name */
      if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound)
        return(err);
!     OSfname(path,ipdir,fn,F_FNDR);	/* create unix name */
      if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound)
        return(err);
      EModified(ipdir);
***************
*** 1540,1545
      if (S_ISDIR(stb.st_mode)) {
        if (dp->d_name[0] != '.')
  	continue;
        /* if not .resource or .finderinfo then skip */
        if (typ != F_DATA &&
  	  strcmp(dp->d_name,RFDIRFN) != 0 && strcmp(dp->d_name, FIDIRFN) != 0)

--- 1540,1549 -----
      if (S_ISDIR(stb.st_mode)) {
        if (dp->d_name[0] != '.')
  	continue;
+       /* was . or .. */
+       if (dp->d_name[1] == '\0' ||
+ 	  (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))
+ 	continue;		/* skip it */
        /* if not .resource or .finderinfo then skip */
        if (typ != F_DATA &&
  	  strcmp(dp->d_name,RFDIRFN) != 0 && strcmp(dp->d_name, FIDIRFN) != 0)
***************
*** 1825,1831
  #ifdef USESTATFS
    if (statfs(path, &fsbuf) >= 0) {
      v->v_size = fsbuf.f_bsize * fsbuf.f_blocks;
!     v->v_free = fsbuf.f_bsize * fsbuf.f_bavail;
      return(noErr);
    }
  #endif

--- 1829,1836 -----
  #ifdef USESTATFS
    if (statfs(path, &fsbuf) >= 0) {
      v->v_size = fsbuf.f_bsize * fsbuf.f_blocks;
!     /* limiting factor: cannot report on overutilization of a volume */
!     v->v_free = (fsbuf.f_bavail < 0) ? 0 : fsbuf.f_bsize * fsbuf.f_bavail;
      return(noErr);
    }
  #endif
***************
*** 1857,1863
      /* use nostat_one -- we don't want to hang on nfs */
      /* return none if error or (0) - not found */
      nbytes = sizeof(struct fs_data);
!     if ((num=getmnt(&context, buffer, NOSTAT_ONE, nbytes)) <= 0)
        return(-1);
      bp = buffer;
    } else {

--- 1862,1868 -----
      /* use nostat_one -- we don't want to hang on nfs */
      /* return none if error or (0) - not found */
      nbytes = sizeof(struct fs_data);
!     if ((num=getmnt(&context, buffer, nbytes, NOSTAT_ONE, path)) <= 0)
        return(-1);
      bp = buffer;
    } else {
***************
*** 2778,2784
  u_short mode;
  {
    if (DBUNX)
!     printf("unix_chmod: mode=o%o path=%d\n",mode,path);
  
    if (chmod(path,(int) mode) == 0)
      return(noErr);

--- 2783,2789 -----
  u_short mode;
  {
    if (DBUNX)
!     printf("unix_chmod: mode=o%o path=%s\n",mode,path);
  
    if (chmod(path,(int) mode) == 0)
      return(noErr);
%%END OF PATCH%%