several changes:
authorAndrew Tridgell <tridge@samba.org>
Mon, 15 Dec 1997 21:04:04 +0000 (21:04 +0000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 15 Dec 1997 21:04:04 +0000 (21:04 +0000)
- by popular demand I have changed the behaviour of the --delete
option. It should now work as "expected" for even those people silly
enough not to read the man page. rsync will now only look for
candidate files/directories to delete in directories that are
explicitly transferred from the sender
- updated the README a bit
- try to fail a bit more gracefully when rsync runs out of disk
space. I don't think this issues is fully resolved yet

README
io.c
rsync.c

diff --git a/README b/README
index 25a7dd3..ddf17bb 100644 (file)
--- a/README
+++ b/README
@@ -26,6 +26,7 @@ Here is a brief description of available options:
 -c, --checksum           always checksum
 -a, --archive            archive mode (same as -rlptDog)
 -r, --recursive          recurse into directories
+-R, --relative           use relative path names
 -b, --backup             make backups (default ~ extension)
 -u, --update             update only (don't overwrite newer files)
 -l, --links              preserve soft links
@@ -81,6 +82,21 @@ no subject and a body of "subscribe rsync Your Name".
 To send mail to everyone on the list send it to rsync@samba.anu.edu.au
 
 
+BUG REPORTS
+-----------
+
+If you have web access then please look at
+http://samba.anu.edu.au/cgi-bin/rsync 
+
+This will give you access to the bug tracking system used by the
+developers of rsync and will allow you to look at other bug reports or
+submit a new bug report.
+
+If you don't have web access then mail bug reports to
+rsync-bugs@samba.anu.edu.au or (if you think it will be of interest to
+lots of people) send it to rsync@samba.anu.edu.au
+
+
 COPYRIGHT
 ---------
 
diff --git a/io.c b/io.c
index 51fc0cb..dbe2100 100644 (file)
--- a/io.c
+++ b/io.c
@@ -237,7 +237,7 @@ static int writefd(int fd,char *buf,int len)
 {
   int total = 0;
   fd_set w_fds, r_fds;
-  int fd_count;
+  int fd_count, count, got_select=0;
   struct timeval tv;
 
   if (buffer_f_in == -1) 
@@ -251,6 +251,11 @@ static int writefd(int fd,char *buf,int len)
     if (ret == -1 && !(errno == EWOULDBLOCK || errno == EAGAIN)) 
       return -1;
 
+    if (ret == -1 && got_select) {
+           fprintf(FERROR,"write exception\n");
+           exit_cleanup(1);
+    }
+
     if (ret == -1) {
       read_check(buffer_f_in);
 
@@ -263,9 +268,24 @@ static int writefd(int fd,char *buf,int len)
              if (buffer_f_in > fd) 
                      fd_count = buffer_f_in+1;
       }
+
+      got_select = 0;
+
       tv.tv_sec = BLOCKING_TIMEOUT;
       tv.tv_usec = 0;
-      select(fd_count,buffer_f_in == -1? NULL: &r_fds,&w_fds,NULL,&tv);
+      count = select(fd_count,buffer_f_in == -1? NULL: &r_fds,
+                    &w_fds,NULL,&tv);
+      if (count == -1 && errno != EINTR) {
+             if (verbose > 1) 
+                     fprintf(FERROR,"select error: %s\n", strerror(errno));
+             exit_cleanup(1);
+      }
+
+      if (count == 0) continue;
+      
+      if (FD_ISSET(fd, &w_fds)) {
+             got_select = 1;
+      }
     } else {
       total += ret;
     }
diff --git a/rsync.c b/rsync.c
index 90214a8..ea05f1e 100644 (file)
--- a/rsync.c
+++ b/rsync.c
@@ -527,23 +527,38 @@ static void delete_one(struct file_struct *f)
 }
 
 
+/* this deletes any files on the receiving side that are not present
+   on the sending side. For version 1.6.4 I have changed the behaviour
+   to match more closely what most people seem to expect of this option */
 static void delete_files(struct file_list *flist)
 {
   struct file_list *local_file_list;
   char *dot=".";
-  int i;
+  int i, j;
+  char *last_name=NULL;
 
   if (cvs_exclude)
     add_cvs_excludes();
 
-  if (!(local_file_list = send_file_list(-1,1,&dot)))
-    return;
-
-  for (i=local_file_list->count-1;i>=0;i--) {
-    if (!local_file_list->files[i].name) continue;
-    if (-1 == flist_find(flist,&local_file_list->files[i])) {
-      delete_one(&local_file_list->files[i]);
-    }    
+  for (j=0;j<flist->count;j++) {
+         if (!S_ISDIR(flist->files[j].mode)) continue;
+         if (strcmp(flist->files[j].name,".")==0) continue;
+         if (last_name &&
+             flist->files[j].name[strlen(last_name)] == '/' &&
+             strncmp(flist->files[j].name,last_name, strlen(last_name))==0)
+                 continue;
+         last_name = flist->files[j].name;
+         if (verbose > 1)
+                 fprintf(FINFO,"deleting in %s\n", last_name);
+         if (!(local_file_list = send_file_list(-1,1,&last_name)))
+                 return;
+
+         for (i=local_file_list->count-1;i>=0;i--) {
+                 if (!local_file_list->files[i].name) continue;
+                 if (-1 == flist_find(flist,&local_file_list->files[i])) {
+                         delete_one(&local_file_list->files[i]);
+                 }    
+         }
   }
 }