[1664] in testers

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

[jik@cats.UCSC.EDU: delete changes]

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Wed Jul 31 15:02:47 1991

Date: Wed, 31 Jul 91 15:02:48 -0400
From: Mark Rosenstein <mar@MIT.EDU>
To: testers@MIT.EDU

This should take care of our concerns for delete in AFS lockers.
					-Mark

Date: Fri, 26 Jul 91 15:37:40 -0700
From: "Jonathan I. Kamens" <jik@cats.UCSC.EDU>
Sender: jik@cats.UCSC.EDU
To: mar@MIT.EDU
Cc: mar@MIT.EDU
In-Reply-To: Mark Rosenstein's message of Fri, 26 Jul 91 16:50:04 -0400 <9107262050.AA01049@Toto.MIT.EDU>
Subject: delete changes

Two things:

1. I'd rather only do the utimes() when AFS_MOUNTPOINTS is defined, so
   that people who are compiling delete on non-AFS systems won't lose
   the modification time unnecessarily.

   However, I don't know if (a) we compile with AFS_MOUNTPOINTS
   defined on systems that are accessing AFS through the AFS->NFS
   translator (and I doubt it), or (b) if renaming a file through the
   AFS->NFS translator will update its ctime.

   If the answers to (a) and (b) are both "no," then I guess we'll
   have to do the utimes() all the time, or, at the very least, put
   another symbol in the Imakefile so that people can toggle the
   behavior.

   Please look into it and let me know.

2. The man page should really be updated.

Below is a patch that only enables the utimes() call it
AFS_MOUNTPOINTS is defined, and updates the man page as well.

  jik

*** /tmp/,RCSt1002991	Fri Jul 26 18:37:52 1991
--- delete.c	Fri Jul 26 18:26:19 1991
***************
*** 15,20 ****
--- 15,23 ----
  #endif
  
  #include <sys/types.h>
+ #ifdef AFS_MOUNTPOINTS
+ #include <sys/time.h>
+ #endif
  #include <stdio.h>
  #ifdef POSIX
  #include <dirent.h>
***************
*** 78,83 ****
--- 81,89 ----
  int force, interactive, recursive, noop, verbose, filesonly, directoriesonly;
  int emulate_rm, linked_to_rm, linked_to_rmdir;
  extern int errno;
+ #ifdef AFS_MOUNTPOINTS
+ struct timeval tvp[2];
+ #endif
  
  main(argc, argv)
  int argc;
***************
*** 90,96 ****
       whoami = lastpart(argv[0]);
  
       initialize_del_error_table();
!      
       force = interactive = recursive = noop = verbose = filesonly =
  	  directoriesonly = emulate_rm = linked_to_rm = linked_to_rmdir = 0;
  
--- 96,107 ----
       whoami = lastpart(argv[0]);
  
       initialize_del_error_table();
! 
! #ifdef AFS_MOUNTPOINTS
!      gettimeofday(&tvp[0], (struct timezone *)0);
!      bcopy(&tvp[0], &tvp[1], sizeof(struct timeval));
! #endif
! 
       force = interactive = recursive = noop = verbose = filesonly =
  	  directoriesonly = emulate_rm = linked_to_rm = linked_to_rmdir = 0;
  
***************
*** 503,508 ****
--- 514,536 ----
       else {
  	  if (verbose)
  	       fprintf(stderr, "%s: %s removed\n", whoami, filename);
+ #ifdef AFS_MOUNTPOINTS
+ 	  /*
+ 	   * Normally, expunge uses the ctime to determine how long
+ 	   * ago a file was deleted (since the ctime is normally
+ 	   * updated when a file is renamed).  However, in AFS,
+ 	   * renaming a file does not change the ctime, mtime OR
+ 	   * atime, so we have to use utimes to force the change.
+ 	   * This unfortunately causes the loss of the real mtime, but
+ 	   * there's nothing we can do about that, if we want expunge
+ 	   * to be able to do the right thing.
+ 	   *
+ 	   * Don't bother checking for errors, because we can't do
+ 	   * anything about them anyway, and in any case, this isn't a
+ 	   * *really* important operation.
+ 	   */
+ 	  utimes(buf, tvp);
+ #endif
  	  return 0;
       }
  }
*** /tmp/,RCSt1002996	Fri Jul 26 18:38:03 1991
--- man1/delete.1	Fri Jul 26 18:34:29 1991
***************
*** 131,136 ****
--- 131,147 ----
  file names, even if they start with a dash.
  .SH "SEE ALSO"
  undelete(1), purge(1), expunge(1), lsdel(1), rm(1), rmdir(1)
+ .SH BUGS
+ .I Delete
+ may change the access and modification times on a file when it is
+ deleted.  This is necessary in order to guarantee that
+ .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