You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Paul Burba <pb...@collab.net> on 2007/09/27 19:35:22 UTC
RE: svn commit: r26803 - in trunk/subversion: libsvn_client tests/cmdline
> -----Original Message-----
> From: kameshj@tigris.org [mailto:kameshj@tigris.org]
> Sent: Thursday, September 27, 2007 10:25 AM
> To: svn@subversion.tigris.org
> Subject: svn commit: r26803 - in trunk/subversion:
> libsvn_client tests/cmdline
>
> Author: kameshj
> Date: Thu Sep 27 07:25:29 2007
> New Revision: 26803
>
> Log:
> Fix issue 2821.
> Improve merge algorithm used for target trees with child
> paths which have
> mergeinfo that differs from their parent.
<snip>
> --- trunk/subversion/libsvn_client/merge.c (original)
> +++ trunk/subversion/libsvn_client/merge.c Thu Sep 27 07:25:29 2007
<snip>
> @@ -3566,9 +3732,9 @@
> &initial_rev2,
> ctx, pool));
>
> - same_urls = (strcmp(URL1, URL2) == 0);
> + notify_b.same_urls = (strcmp(URL1, URL2) == 0);
>
> - if (!same_urls && record_only)
> + if (!notify_b.same_urls && record_only)
> return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
> _("Use of two URLs is not
> compatible with "
> "mergeinfo modification"));
> @@ -3612,7 +3778,7 @@
> recursive diff-editor thing. */
> else if (entry->kind == svn_node_dir)
> {
> - if (same_urls)
> + if (notify_b.same_urls)
> {
> /* Merge children with differing mergeinfo. */
>
> SVN_ERR(discover_and_merge_children(&children_with_mergeinfo,
> @@ -3625,26 +3791,27 @@
> depth,
> ignore_ancestry,
> adm_access,
> + ¬ify_b,
> &merge_cmd_baton,
> pool));
> }
> -
> - /* Merge of the actual target.*/
> - SVN_ERR(do_merge(URL1,
> - range.start,
> - URL2,
> - range.end,
> - is_rollback,
> - merge_cmd_baton.target_missing_child,
> - target_wcpath,
> - adm_access,
> - depth,
> - ignore_ancestry,
> - &merge_callbacks,
> - &merge_cmd_baton,
> - children_with_mergeinfo,
> - merge_cmd_baton.existing_mergeinfo ? 0 : -1,
> - pool));
> + else
> + {
> + SVN_ERR(do_merge(URL1,
> + range.start,
> + URL2,
> + range.end,
> + merge_cmd_baton.target_missing_child,
> + target_wcpath,
> + adm_access,
> + depth,
> + ignore_ancestry,
> + &merge_callbacks,
> + ¬ify_b,
> + &merge_cmd_baton,
> + children_with_mergeinfo,
> + pool));
> + }
Hi Kamesh,
Your change to call either discover_and_merge_children or do_merge
allowed my compiler to finally catch this:
c:\svn\src-trunk\subversion\libsvn_client\merge.c(3813) : warning C4700:
uninitialized local variable 'children_with_mergeinfo' used
This will lead to a segfault in drive_merge_report_editor() if
do_merge() is ever called. Our test suite never provokes a situation
like this, but it's easy enough to replicate:
Copy some directory DIR to DIR_COPY and commit it at rN
Make a modification to DIR in rN+1
Move DIR to DIR_MOVED in rN+2
Make a modification to DIR_MOVED in rN+3
Merge -rN:N+3 DIR_MOVED DIR_COPY -- and boom!
Anyhow, in r26813 I added an intialization and also tweaked
drive_merge_report_editor() to check for a possible NULL
children_with_mergeinfo (not really necessary right now, but you check
it elsewhere in that function, so in the name of safety and
consistency...
Paul
> SVN_ERR(cleanup_noop_merge(&merge_cmd_baton,
> children_with_mergeinfo,
> adm_access, pool));
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn commit: r26803 - in trunk/subversion: libsvn_client tests/cmdline
Posted by Kamesh Jayachandran <ka...@collab.net>.
>> Lieven,
>> Yes I *love* tests that shows detects all the problems in my code well
>> in advance(This is what exactly I feel when I change something in
>> merge-tracking code). But writing a testcase for short lived bugs of
>> this nature would be an overkill.
>>
> Kamesh,
>
> I understand you're not taking two hours to write a full regression test
> to point out a small issue that can be fixed in 2 minutes, that wasn't
> what I asked for btw.
>
> If you're doing TDD and you'd find such an issue, ideally you'd write a
> small unit test (in C), fix the issue and commit both. This would make
> sure that you pointed out the exact issue and fixed it correctly, with
> only a small overhead in time in the short run.
>
> In my reply I was in fact pointing to the scenario that Paul described,
> which looks like a way a user can trigger a path in our code that isn't
> covered by any regression test for now. In my ideal of having at least
> 100% code coverage this scenario seems like a worthy addition for the
> test suite. No? I just want to make sure we don't forget it. Anyway,
> don't worry about it, I'll add a place holder or maybe a full test to
> the test suite this weekend.
>
>
Thanks for the explanation Lieven. Yes the case is not covered by our
testsuite. I stand corrected.
With regards
Kamesh Jayachandran
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn commit: r26803 - in trunk/subversion: libsvn_client tests/cmdline
Posted by Lieven Govaerts <sv...@mobsol.be>.
Kamesh Jayachandran wrote:
>> So our test suite lacks this test?
>>
>>> Anyhow, in r26813 I added an intialization and also tweaked
>>> drive_merge_report_editor() to check for a possible NULL
>>> children_with_mergeinfo (not really necessary right now, but you check
>>> it elsewhere in that function, so in the name of safety and
>>> consistency...
>>>
>> Just wondering why you didn't add that test in r26813? If you don't have
>> time, why not add an XFail-ing place holder explaining in comments the
>> above scenario, then we can still add it later.
> Lieven,
> Yes I *love* tests that shows detects all the problems in my code well
> in advance(This is what exactly I feel when I change something in
> merge-tracking code). But writing a testcase for short lived bugs of
> this nature would be an overkill.
Kamesh,
I understand you're not taking two hours to write a full regression test
to point out a small issue that can be fixed in 2 minutes, that wasn't
what I asked for btw.
If you're doing TDD and you'd find such an issue, ideally you'd write a
small unit test (in C), fix the issue and commit both. This would make
sure that you pointed out the exact issue and fixed it correctly, with
only a small overhead in time in the short run.
In my reply I was in fact pointing to the scenario that Paul described,
which looks like a way a user can trigger a path in our code that isn't
covered by any regression test for now. In my ideal of having at least
100% code coverage this scenario seems like a worthy addition for the
test suite. No? I just want to make sure we don't forget it. Anyway,
don't worry about it, I'll add a place holder or maybe a full test to
the test suite this weekend.
BTW, thanks for doing a great job to get the merge tracking code
finished on time for 1.5.
Lieven
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn commit: r26803 - in trunk/subversion: libsvn_client tests/cmdline
Posted by Kamesh Jayachandran <ka...@collab.net>.
>>
>>
> So our test suite lacks this test?
>
>> Anyhow, in r26813 I added an intialization and also tweaked
>> drive_merge_report_editor() to check for a possible NULL
>> children_with_mergeinfo (not really necessary right now, but you check
>> it elsewhere in that function, so in the name of safety and
>> consistency...
>>
>>
> Just wondering why you didn't add that test in r26813? If you don't have
> time, why not add an XFail-ing place holder explaining in comments the
> above scenario, then we can still add it later.
>
> Lieven
>
>
Lieven,
Yes I *love* tests that shows detects all the problems in my code well
in advance(This is what exactly I feel when I change something in
merge-tracking code). But writing a testcase for short lived bugs of
this nature would be an overkill.
With regards
Kamesh Jayachandran
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn commit: r26803 - in trunk/subversion: libsvn_client tests/cmdline
Posted by Lieven Govaerts <sv...@mobsol.be>.
Paul Burba wrote:
> ..
> This will lead to a segfault in drive_merge_report_editor() if
> do_merge() is ever called. Our test suite never provokes a situation
> like this, but it's easy enough to replicate:
>
> Copy some directory DIR to DIR_COPY and commit it at rN
> Make a modification to DIR in rN+1
> Move DIR to DIR_MOVED in rN+2
> Make a modification to DIR_MOVED in rN+3
> Merge -rN:N+3 DIR_MOVED DIR_COPY -- and boom!
>
So our test suite lacks this test?
> Anyhow, in r26813 I added an intialization and also tweaked
> drive_merge_report_editor() to check for a possible NULL
> children_with_mergeinfo (not really necessary right now, but you check
> it elsewhere in that function, so in the name of safety and
> consistency...
>
Just wondering why you didn't add that test in r26813? If you don't have
time, why not add an XFail-ing place holder explaining in comments the
above scenario, then we can still add it later.
Lieven
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn commit: r26803 - in trunk/subversion: libsvn_client tests/cmdline
Posted by Kamesh Jayachandran <ka...@collab.net>.
> Hi Kamesh,
>
> Your change to call either discover_and_merge_children or do_merge
> allowed my compiler to finally catch this:
>
> c:\svn\src-trunk\subversion\libsvn_client\merge.c(3813) : warning C4700:
> uninitialized local variable 'children_with_mergeinfo' used
>
> This will lead to a segfault in drive_merge_report_editor() if
> do_merge() is ever called. Our test suite never provokes a situation
> like this, but it's easy enough to replicate:
>
> Copy some directory DIR to DIR_COPY and commit it at rN
> Make a modification to DIR in rN+1
> Move DIR to DIR_MOVED in rN+2
> Make a modification to DIR_MOVED in rN+3
> Merge -rN:N+3 DIR_MOVED DIR_COPY -- and boom!
>
> Anyhow, in r26813 I added an intialization and also tweaked
> drive_merge_report_editor() to check for a possible NULL
> children_with_mergeinfo (not really necessary right now, but you check
> it elsewhere in that function, so in the name of safety and
> consistency...
>
> Paul
>
>
Thanks Paul. Via r26822 addressed Dan's comments and few of my thoughts
on r26813.
With regards
Kamesh Jayachandran
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org