RE: "Unable to parse reversed revision range" when merging from trunk to branch

2017-07-03 Thread Jens Christian Restemeier
I narrowed it down to the code in subversion/libsvn_subr/mergeinfo.c line 
892-898 in adjust_remaining_ranges. At that point next_range actually starts 
before modified_range, so my guess is svn_sort__array_insert has some 
unexpected behaviour.

   x892   svn_merge_range_t *new_modified_range =   

x
   x893 apr_palloc(result_pool, 
sizeof(*new_modified_range));   
x
   x894   new_modified_range->start = next_range->end;  

x
   x895   new_modified_range->end = modified_range->end;

x
   x896   new_modified_range->inheritable = FALSE;  

x
   x897   modified_range->end = next_range->start;  

x
   x898   (*range_index)+=2;

x
  >x899   svn_sort__array_insert(rangelist, 
&new_modified_range,
x
  *range_index);

 x
   x901   /* Recurse with the new range. */ 

x
   x902   adjust_remaining_ranges(rangelist, range_index, 
result_pool);   
  x
   
Intuitively it seems to be awfully complicated to expand a range to the end of 
a change, and then cut it down recursively with adjust_remaining_ranges. My 
first thought would be to step through "rangelist" and "changes" side by side 
in svn_rangelist_merge2, and to modify, insert or skip a range in either list 
until you're at the end. Though obviously I have no idea about all the edge 
cases the current code most likely fixes...

So how should I proceed from here? Should I open a bug with my findings and the 
test case?

-Original Message-
From: Jens Restemeier [mailto:j...@playtonicgames.com] 
Sent: 02 July 2017 23:44
To: Johan Corveleyn 
Cc: Stefan Sperling ; users@subversion.apache.org
Subject: Re: "Unable to parse reversed revision range" when merging from trunk 
to branch

The problem seems to come from svn_rangelist_merge2.

This test program recreates the problem. 

#include 
#include 

int main(int argc, char * argv[])
{
apr_pool_t *pool;
int exit_code = EXIT_SUCCESS;
svn_error_t *err;

if (svn_cmdline_init("svn", stderr) != EXIT_SUCCESS)
return EXIT_FAILURE;

pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));

// 
15014-19472,19473-19612*,19613-19614,19615-19630*,19631-19634,19635-20055*
svn_rangelist_t * rangelist = apr_array_make(pool, 1, 
sizeof(svn_merge_range_t *));
svn_merge_range_t *mrange = apr_pcalloc(pool, sizeof(*mrange));
mrange->start = 15013;
mrange->end = 19472;
mrange->inheritable = TRUE;
APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = mrange;

mrange = apr_pcalloc(pool, sizeof(*mrange));
mrange->start = 19472;
mrange->end = 19612;
mrange->inheritable = FALSE;
APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = mrange;

mrange = apr_pcalloc(pool, sizeof(*mrange));
mrange->start = 19612;
mrange->end = 19614;
mrange->inheritable = TRUE;
APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = mrange;

mrange = apr_pcalloc(pool, sizeof(*mrange));
mrange->start = 19614;
mrange->end = 19630;
mrange->inheritable = FALSE;
APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = mrange;

mrange = apr_pcalloc(pool, sizeof(*mrange));
mrange->start = 19630;
mrange->end = 19634;
mrange->inheritable = TRUE;
APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = mrange;

mrange = apr_pcalloc(pool, sizeof(*mrange));
mrange->start = 19634;

Re: "Unable to parse reversed revision range" when merging from trunk to branch

2017-07-03 Thread Stefan Sperling
On Mon, Jul 03, 2017 at 03:31:00PM +0100, Jens Christian Restemeier wrote:
> Should I open a bug with my findings and the test case?

Yes, please open a bug in the issue tracker.

A regression test for the subversion/tests tree would be essential.
Since you already wrote a test program in C, this file would be
a good location for such a test: subversion/libsvn_subr/mergeinfo.c

We should definitely keep track of this problem and fix it on trunk.
Perhaps even backport a fix to 1.9 once it exists.

Thank you very much for the work you have done so far!

Stefan


Re: "Unable to parse reversed revision range" when merging from trunk to branch

2017-07-03 Thread Jens Restemeier
Done: https://issues.apache.org/jira/browse/SVN-4686 

> Am 03.07.2017 um 19:17 schrieb Stefan Sperling :
> 
> On Mon, Jul 03, 2017 at 03:31:00PM +0100, Jens Christian Restemeier wrote:
>> Should I open a bug with my findings and the test case?
> 
> Yes, please open a bug in the issue tracker.
> 
> A regression test for the subversion/tests tree would be essential.
> Since you already wrote a test program in C, this file would be
> a good location for such a test: subversion/libsvn_subr/mergeinfo.c
> 
> We should definitely keep track of this problem and fix it on trunk.
> Perhaps even backport a fix to 1.9 once it exists.
> 
> Thank you very much for the work you have done so far!
> 
> Stefan



Re: "Unable to parse reversed revision range" when merging from trunk to branch

2017-07-03 Thread Daniel Shahaf
Jens Restemeier wrote on Mon, 03 Jul 2017 20:01 +0100:
> > Am 03.07.2017 um 19:17 schrieb Stefan Sperling :
> > 
> > On Mon, Jul 03, 2017 at 03:31:00PM +0100, Jens Christian Restemeier wrote:
> >> Should I open a bug with my findings and the test case?
> > 
> > Yes, please open a bug in the issue tracker.
> > 
> Done: https://issues.apache.org/jira/browse/SVN-4686 
> 

Thanks!

> > A regression test for the subversion/tests tree would be essential.
> > Since you already wrote a test program in C, this file would be
> > a good location for such a test: subversion/libsvn_subr/mergeinfo.c

Stefan meant subversion/tests/libsvn_subr/mergeinfo-test.c .