You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Kamesh Jayachandran <ka...@collab.net> on 2006/11/01 19:49:28 UTC

[PATCH][merge-tracking]data confusion(corruption?) when the source of merge has the merges from multiple other sources

Hi All,
Find the attached patch and log.

With regards
Kamesh Jayachandran

Re: [PATCH][merge-tracking]data confusion(corruption?) when the source of merge has the merges from multiple other sources

Posted by Kamesh Jayachandran <ka...@collab.net>.
>> -              apr_hash_set(*result, mergedfrom, APR_HASH_KEY_STRING,
>> +              apr_hash_set(*result, lastmergedfrom, 
>> APR_HASH_KEY_STRING,
>
> Really? I think *this* change would cause wrong paths mapped to wrong 
> rev-ranges. Do you have any tests to prove the need for this change?
I don't have a python testsuite to prove.
But you can use the small dump at 
http://puggy.symonds.net/~kameshj/my_test_area_multi_merge.dmp
(mergetracking svn) cp url/to/trunk url/to/branches/somethingelse -m 
'blah blah'
Observe the property of 'svn:mergeinfo' on /trunk and 
/branches/somethingelse to see the defect.
Apply the patch and observe the same you will get what I mean.
>
> Apart from that, I do really see a problem where the first merged from 
> path will never get set into the *result hash. To counter this, we 
> should have the if condition as below:
>
>>            if (lastmergedfrom == NULL || strcmp(mergedfrom, 
>> lastmergedfrom) != 0)
           if (lastmergedfrom && strcmp(mergedfrom, lastmergedfrom) != 
0) (I terribly fail to see the difference!).

Observe the code carefully you will see nothing is lost!.

With regards
Kamesh Jayachandran

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH][merge-tracking]data confusion(corruption?) when the source of merge has the merges from multiple other sources

Posted by Madan U Sreenivasan <ma...@collab.net>.
On Thu, 02 Nov 2006 01:19:28 +0530, Kamesh Jayachandran  
<ka...@collab.net> wrote:

> Index: subversion/libsvn_fs_util/merge-info-sqlite-index.c
> ===================================================================
> --- subversion/libsvn_fs_util/merge-info-sqlite-index.c(revision 22190)
> +++ subversion/libsvn_fs_util/merge-info-sqlite-index.c(working copy)
> @@ -326,9 +326,10 @@
>            mergedfrom = (char *) sqlite3_column_text(stmt, 0);
>            startrev = sqlite3_column_int64(stmt, 1);
>            endrev = sqlite3_column_int64(stmt, 2);
> +          mergedfrom = apr_pstrdup(pool, mergedfrom);
>            if (lastmergedfrom && strcmp(mergedfrom, lastmergedfrom) != 0)
>              {
> -              apr_hash_set(*result, mergedfrom, APR_HASH_KEY_STRING,
> +              apr_hash_set(*result, lastmergedfrom, APR_HASH_KEY_STRING,

Really? I think *this* change would cause wrong paths mapped to wrong  
rev-ranges. Do you have any tests to prove the need for this change?

Apart from that, I do really see a problem where the first merged from  
path will never get set into the *result hash. To counter this, we should  
have the if condition as below:

>            if (lastmergedfrom == NULL || strcmp(mergedfrom,  
> lastmergedfrom) != 0)

What do you think?

Regards,
Madan.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH][merge-tracking]data confusion(corruption?) when the source of merge has the merges from multiple other sources

Posted by Kamesh Jayachandran <ka...@collab.net>.
>
> I was wondering if that block in parse_mergeinfo_from_db() could be
> simplified -- or at least made more clear -- using a do/while loop
> construct.  What do you think?
>
> - Dan
>   

Yes posted a separate patch for it with a subject 'Clarity fix'.

With regards
Kamesh Jayachandran

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH][merge-tracking]data confusion(corruption?) when the source of merge has the merges from multiple other sources

Posted by Daniel Rall <dl...@collab.net>.
Nice work, Kamesh.  I commit ed your changes to the branch in r22303
with the following change log message:

--- snip ---
On the merge-tracking branch: Correct memory management while
iterating over records returned by sqlite (which re-uses its memory
across cursor locations).  Also, actually return the correct the merge
info in every case.  These problems show up if you have source of copy
having merge from two or more different merge sources.

* subversion/libsvn_fs_util/merge-info-sqlite-index.c
  (parse_mergeinfo_from_db): Copy the "mergedfrom" value procured from
   sqlite into our own pool.  Set "lastmergedfrom" as the key for our
   *RESULT hash to get the correct set of revision ranges for each
   merge source.

Patch by: Kamesh Jayachandran <ka...@collab.net>
--- snip ---

I was wondering if that block in parse_mergeinfo_from_db() could be
simplified -- or at least made more clear -- using a do/while loop
construct.  What do you think?

- Dan