On Wed, Mar 26, 2008 at 05:24:15PM -0400, Simo Sorce wrote:
> Is it ok to pass this kind of bug directly upstream filing a new bug in
> bugzilla and linking the fedora bug ?

Sure, that works fine.  Posting a bug to the mailing list is also fine
especially when the bug is not going to linger in bugzilla before it
gets fixed.

> Summary: rsync 3.0.1pre -H fails assertion

I worked up a fix for this bug, which is attached (and also committed to
git).

I'm going to work up a 3.0.1pre2 release later today with the latest
accumulated fixes.

..wayne..
diff --git a/hlink.c b/hlink.c
index 536b571..812c55f 100644
--- a/hlink.c
+++ b/hlink.c
@@ -249,17 +249,13 @@ static char *check_prior(struct file_struct *file, int 
gnum,
                         int *prev_ndx_p, struct file_list **flist_p)
 {
        struct file_struct *fp;
-       struct file_list *flist;
        struct ht_int32_node *node;
        int prev_ndx = F_HL_PREV(file);
 
        while (1) {
-               if (prev_ndx < 0) {
-                       *prev_ndx_p = prev_ndx;
-                       *flist_p = NULL;
-                       return NULL;
-               }
-               if ((flist = flist_for_ndx(prev_ndx)) == NULL)
+               struct file_list *flist;
+               if (prev_ndx < 0
+                || (flist = flist_for_ndx(prev_ndx)) == NULL)
                        break;
                fp = flist->files[prev_ndx - flist->ndx_start];
                if (!(fp->flags & FLAG_SKIP_HLINK)) {
@@ -270,20 +266,20 @@ static char *check_prior(struct file_struct *file, int 
gnum,
                F_HL_PREV(file) = prev_ndx = F_HL_PREV(fp);
        }
 
-       node = hashtable_find(prior_hlinks, gnum, 0);
-       assert(node != NULL && node->data);
-
-       if (CVAL(node->data, 0) == 0) {
+       if ((node = hashtable_find(prior_hlinks, gnum, 0)) != NULL) {
+               assert(node->data != NULL);
+               if (CVAL(node->data, 0) != 0) {
+                       *prev_ndx_p = -1;
+                       *flist_p = NULL;
+                       return node->data;
+               }
                /* The prior file must have been skipped. */
-               F_HL_PREV(file) = prev_ndx = -1;
-               *prev_ndx_p = prev_ndx;
-               *flist_p = NULL;
-               return NULL;
+               F_HL_PREV(file) = -1;
        }
 
-       *prev_ndx_p = prev_ndx;
-       *flist_p = flist;
-       return node->data;
+       *prev_ndx_p = -1;
+       *flist_p = NULL;
+       return NULL;
 }
 
 /* Only called if FLAG_HLINKED is set and FLAG_HLINK_FIRST is not.  Returns:
-- 
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to