[2947] in Release_Engineering

home help back first fref pref prev next nref lref last post

Patches for delete for next release

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Sun Nov 8 21:36:26 1992

Date: Sun, 8 Nov 92 21:36:09 -0500
From: "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>
To: rel-eng@Athena.MIT.EDU


Please apply the patch below (with "patch -p0") to the sources in
/source/athena/athena.bin/delete.

Alternatively, you can just copy all of /mit/delete/src and fold back
in the changes that are local to the source tree (I *think* that the
only such changes should be differences between your Imakefile and
mine).

These patches fix at least two bugs that were reported to "bugs".

  jik

*** PATCHLEVEL.orig	Sun Nov  8 21:22:23 1992
--- PATCHLEVEL	Sun Nov  8 21:23:13 1992
***************
*** 1 ****
! 14
--- 1 ----
! 15
*** delete.c.orig	Sun Nov  8 21:22:25 1992
--- delete.c	Sun Nov  8 21:25:22 1992
***************
*** 99,105 ****
  
  #ifdef AFS_MOUNTPOINTS
       gettimeofday(&tvp[0], (struct timezone *)0);
!      bcopy(&tvp[0], &tvp[1], sizeof(struct timeval));
  #endif
  
       force = interactive = recursive = noop = verbose = filesonly =
--- 99,105 ----
  
  #ifdef AFS_MOUNTPOINTS
       gettimeofday(&tvp[0], (struct timezone *)0);
!      tvp[1] = tvp[0];
  #endif
  
       force = interactive = recursive = noop = verbose = filesonly =
*** directories.c.orig	Sun Nov  8 21:22:32 1992
--- directories.c	Sun Nov  8 21:23:18 1992
***************
*** 368,374 ****
  void print_paths_from(leaf)
  filerec *leaf;
  {
!      char buf[MAXPATHLEN];
  
       printf("%s\n", get_leaf_path(leaf, buf));
       if (leaf->dirs)
--- 368,378 ----
  void print_paths_from(leaf)
  filerec *leaf;
  {
!      /*
!       * This is static to prevent multiple copies of it when calling
!       * recursively.
!       */
!      static char buf[MAXPATHLEN];
  
       printf("%s\n", get_leaf_path(leaf, buf));
       if (leaf->dirs)
***************
*** 383,389 ****
  void print_specified_paths_from(leaf)
  filerec *leaf;
  {
!      char buf[MAXPATHLEN];
  
       if (leaf->specified)
  	  printf("%s\n", get_leaf_path(leaf, buf));
--- 387,397 ----
  void print_specified_paths_from(leaf)
  filerec *leaf;
  {
!      /*
!       * This is static to prevent multiple copies of it when calling
!       * recursively.
!       */
!      static char buf[MAXPATHLEN];
  
       if (leaf->specified)
  	  printf("%s\n", get_leaf_path(leaf, buf));
***************
*** 662,673 ****
  char ***in_strings;
  int *num;
  {
-      char newname[MAXPATHLEN];
       char **strings;
       int retval;
       
       strings = *in_strings;
       if (leaf->specified) {
  	  *num += 1;
  	  strings = (char **) realloc((char *) strings, (unsigned)
  				      (sizeof(char *) * (*num)));
--- 670,687 ----
  char ***in_strings;
  int *num;
  {
       char **strings;
       int retval;
       
       strings = *in_strings;
       if (leaf->specified) {
+ 	  /*
+ 	   * This array is static so that only one copy of it is allocated,
+ 	   * rather than one copy on the stack for each recursive
+ 	   * invocation of accumulate_names.
+ 	   */
+ 	  static char newname[MAXPATHLEN];
+ 
  	  *num += 1;
  	  strings = (char **) realloc((char *) strings, (unsigned)
  				      (sizeof(char *) * (*num)));
*** expunge.c.orig	Sun Nov  8 21:22:33 1992
--- expunge.c	Sun Nov  8 21:23:23 1992
***************
*** 291,297 ****
       int retval;
       
       if ((leaf->specified) && ((leaf->specs.st_mode & S_IFMT) == S_IFDIR)) {
! 	  char buf[MAXPATHLEN];
  
  	  if (retval = get_leaf_path(leaf, buf)) {
  	       error("get_leaf_path");
--- 291,301 ----
       int retval;
       
       if ((leaf->specified) && ((leaf->specs.st_mode & S_IFMT) == S_IFDIR)) {
! 	  /*
! 	   * This is static so that we don't create a copy of it for
! 	   * every recursive invocation of expunge_specified.
! 	   */
! 	  static char buf[MAXPATHLEN];
  
  	  if (retval = get_leaf_path(leaf, buf)) {
  	       error("get_leaf_path");
No differences encountered
*** malloc-test.c.orig	Sun Nov  8 21:22:35 1992
--- malloc-test.c	Sun Nov  8 21:23:26 1992
***************
*** 1,6 ****
  main()
  {
       printf("You %s define MALLOC_0_RETURNS_NULL.\n",
! 	    malloc(0) ? "should NOT" : "SHOULD");
       exit(0);
  }
--- 1,11 ----
  main()
  {
+      char *ptr1, *ptr2;
+ 
+      ptr1 = (char *) malloc(0);
+      ptr2 = (char *) realloc(ptr1, 0);
+ 
       printf("You %s define MALLOC_0_RETURNS_NULL.\n",
! 	    (ptr1 && ptr2) ? "should NOT" : "SHOULD");
       exit(0);
  }
*** pattern.c.orig	Sun Nov  8 21:22:36 1992
--- pattern.c	Sun Nov  8 21:23:20 1992
***************
*** 584,599 ****
  	       continue;
  	  }
  
! 	  if (! stat(base, &statbuf)) {
! 	       if ((statbuf.st_mode & S_IFMT) == S_IFDIR)
! 		    dirp = Opendir(base);
! 	  }
! 	  else {
! 	       dirp = NULL;
! 	  }
  	  if (! dirp) {
! 	       set_error(errno);
! 	       error(base);
  	       string_pop(base);
  	       string_pop(rest);
  	       string_pop(first);
--- 584,630 ----
  	       continue;
  	  }
  
! 	  /*
! 	   * The logic here in this attempt to descend is as follows:
! 	   *
! 	   * Try to stat base.  Succeeds?
! 	   * Yes:
! 	   *   Is it a directory?
! 	   *   Yes:
! 	   *     Try to open it.
! 	   *     Does the open succeed?
! 	   *     Yes:
! 	   *       Continue the loop.
! 	   *     No:
! 	   *       Print an error, and pop up to the last directory.
! 	   *   No:
! 	   *     Pop up to the last directory.
! 	   * No:
! 	   *   Try to lstat base.  Succeeds?
! 	   *   Yes:
! 	   *     Is it a directory?
! 	   *     Yes: see above.  *** this should never happen ***
! 	   *     No:
! 	   *       Pop up to the last directory.
! 	   *   No:
! 	   *     Print an error, and pop up to the last directory.
! 	   *
! 	   * The reason for the lstat is that we don't want to print
! 	   * errors when we can't descend because we're trying to go
! 	   * into a symlink pointing nowhere; a symlink pointing
! 	   * nowhere is not an error when matching, it just means that
! 	   * we can't descend.
! 	   */
! 	  dirp = NULL;
! 	  if (((! (retval = stat(base, &statbuf))) ||
! 	       (! (retval = lstat(base, &statbuf)))) &&
! 	      ((statbuf.st_mode & S_IFMT) == S_IFDIR))
! 	       dirp = Opendir(base);
  	  if (! dirp) {
! 	       if (retval || ((statbuf.st_mode & S_IFMT) == S_IFDIR)) {
! 		    set_error(errno);
! 		    error(base);
! 	       }
  	       string_pop(base);
  	       string_pop(rest);
  	       string_pop(first);
No differences encountered
*** util.c.orig	Sun Nov  8 21:22:40 1992
--- util.c	Sun Nov  8 21:27:38 1992
***************
*** 17,23 ****
  #include <stdio.h>
  #include <sys/param.h>
  #include <sys/types.h>
! #ifdef SYSV /* SYSV doesn't define uid_t */
  typedef unsigned short uid_t;
  #endif
  #ifdef POSIX
--- 17,23 ----
  #include <stdio.h>
  #include <sys/param.h>
  #include <sys/types.h>
! #ifdef SYSV && !defined(hpux) /* SYSV doesn't define uid_t */
  typedef unsigned short uid_t;
  #endif
  #ifdef POSIX
***************
*** 48,55 ****
  #include "errors.h"
  
  extern char *getenv();
- extern uid_t getuid();
  extern int errno;
  
  char *convert_to_user_name(real_name, user_name)
  char real_name[];
--- 48,60 ----
  #include "errors.h"
  
  extern char *getenv();
  extern int errno;
+ 
+ #ifdef UTEK
+ extern int getuid();
+ #else /* ! UTEK */
+ extern uid_t getuid();
+ #endif /* UTEK */
  
  char *convert_to_user_name(real_name, user_name)
  char real_name[];
*** man1/delete.1.orig	Sun Nov  8 21:22:42 1992
--- man1/delete.1	Sun Nov  8 21:28:22 1992
***************
*** 138,144 ****
  .I expunge
  will work correctly in
  .I AFS
! filesystems.
  .SH AUTHOR
  Jonathan I. Kamens (MIT-Project Athena)
  .SH COPYRIGHT
--- 138,147 ----
  .I expunge
  will work correctly in
  .I AFS
! filesystems.  You might say that this is a bug in
! .IR AFS ,
! rather than a bug in
! .IR delete .
  .SH AUTHOR
  Jonathan I. Kamens (MIT-Project Athena)
  .SH COPYRIGHT

home help back first fref pref prev next nref lref last post