rsync problems from flist.c change

Wayne Davison wayned at samba.org
Fri Apr 23 07:54:03 GMT 2004


On Fri, Apr 23, 2004 at 08:34:55AM +0200, Kurt Hornik wrote:
> Just checking: in essence you will [revert] the change to flist.c that
> I had mentioned earlier?  (In that case I would try to have the Debian
> maintainer revert the 2.6.1 style patch relative to the 2.6.0 upstream
> as well ...)

No, the patch you cited is valid and fixes a bug in 2.6.0 (it prevents
.cvsignore entries from affecting files outside of the one directory it
should affect).  The weird side-effect of the bug is that nothing gets
put onto the "local" list, so you can't notice that the logic in an
unpatched 2.6.0 doesn't let a global rule override a local rule.  The
change I talked about is a new patch, and is already in CVS for the
upcoming 2.6.1 release.  I'll attach it to this email.

..wayne..
-------------- next part --------------
--- exclude.c	22 Apr 2004 09:58:15 -0000	1.70
+++ exclude.c	22 Apr 2004 22:17:15 -0000	1.71
@@ -215,7 +215,8 @@ static void report_exclude_result(char c
 
 /*
  * Return true if file NAME is defined to be excluded by the specified
- * exclude list.
+ * exclude list.  Returns -1 for an exclude, 1 for an include, and 0 if
+ * no match.
  */
 int check_exclude(struct exclude_list_struct *listp, char *name, int name_is_dir)
 {
@@ -225,7 +226,7 @@ int check_exclude(struct exclude_list_st
 		if (check_one_exclude(name, ent, name_is_dir)) {
 			report_exclude_result(name, ent, name_is_dir,
 					      listp->debug_type);
-			return !ent->include;
+			return ent->include ? 1 : -1;
 		}
 	}
 
--- flist.c	22 Apr 2004 09:58:18 -0000	1.215
+++ flist.c	22 Apr 2004 22:17:15 -0000	1.216
@@ -211,6 +211,8 @@ int link_stat(const char *path, STRUCT_S
  */
 static int check_exclude_file(char *fname, int is_dir, int exclude_level)
 {
+	int rc;
+
 #if 0 /* This currently never happens, so avoid a useless compare. */
 	if (exclude_level == NO_EXCLUDES)
 		return 0;
@@ -227,14 +229,15 @@ static int check_exclude_file(char *fnam
 		}
 	}
 	if (server_exclude_list.head
-	 && check_exclude(&server_exclude_list, fname, is_dir))
+	    && check_exclude(&server_exclude_list, fname, is_dir) < 0)
 		return 1;
 	if (exclude_level != ALL_EXCLUDES)
 		return 0;
-	if (exclude_list.head && check_exclude(&exclude_list, fname, is_dir))
-		return 1;
+	if (exclude_list.head
+	    && (rc = check_exclude(&exclude_list, fname, is_dir)) != 0)
+		return rc < 0;
 	if (local_exclude_list.head
-	    && check_exclude(&local_exclude_list, fname, is_dir))
+	    && check_exclude(&local_exclude_list, fname, is_dir) < 0)
 		return 1;
 	return 0;
 }
--- util.c	22 Apr 2004 09:58:21 -0000	1.137
+++ util.c	22 Apr 2004 22:17:15 -0000	1.138
@@ -476,7 +476,7 @@ static int exclude_server_path(char *arg
 	if (server_exclude_list.head) {
 		for (s = arg; (s = strchr(s, '/')) != NULL; ) {
 			*s = '\0';
-			if (check_exclude(&server_exclude_list, arg, 1)) {
+			if (check_exclude(&server_exclude_list, arg, 1) < 0) {
 				/* We must leave arg truncated! */
 				return 1;
 			}


More information about the rsync mailing list