You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/01/26 16:46:59 UTC
svn commit: r903284 - in /subversion/trunk/subversion: include/svn_wc.h
libsvn_client/patch.c svn/notify.c tests/cmdline/patch_tests.py
Author: stsp
Date: Tue Jan 26 15:46:59 2010
New Revision: 903284
URL: http://svn.apache.org/viewvc?rev=903284&view=rev
Log:
Make svn patch provide notifications about individual hunks.
Make the CLI client print them.
* subversion/include/svn_wc.h
(svn_wc_notify_action_t): New actions svn_wc_notify_patch_applied_hunk
and svn_wc_notify_patch_rejected_hunk.
(svn_wc_notify_t): New fields hunk_original_start, hunk_original_length,
hunk_modified_start, hunk_modified_length, and hunk_matched_line.
* subversion/libsvn_client/patch.c
(hunk_info_t): New field REJECTED.
(patch_target_t): Rename MATCHED_HUNKS to just HUNKS.
(init_patch_target): Track renamed field.
(get_hunk_info): Initialise new field in hunk_info_t.
(reject_hunk): Accept a hunk_info_t instead of a plain hunk,
and mark it rejected. Add docstring.
(apply_one_hunk): Swap TARGET and HI parameters for consistency.
Pass HI to reject_hunk().
(maybe_send_patch_notification): Send notifications for all hunks
if the target was patched (or we attempted to patch it).
(apply_one_patch): Pass a hunk info to reject_hunk. Track renamed
field in patch_target_t. Put all hunks into TARGET->HUNKS, not
just the ones we could match. The ones we could not match are
marked rejected, don't apply those.
* subversion/svn/notify.c
(notify): Print hunk-level notifications.
* subversion/tests/cmdline/patch_tests.py
(patch_unidiff, patch_unidiff_absolute_paths, patch_unidiff_offset,
patch_chopped_leading_spaces, patch_unidiff_strip1): Adjust expected output.
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/svn/notify.c
subversion/trunk/subversion/tests/cmdline/patch_tests.py
Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=903284&r1=903283&r2=903284&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Jan 26 15:46:59 2010
@@ -1064,6 +1064,14 @@
/** A file in the working copy was patched.
* @since New in 1.7. */
svn_wc_notify_patch,
+
+ /** A hunk from a patch was applied.
+ * @since New in 1.7. */
+ svn_wc_notify_patch_applied_hunk,
+
+ /** A hunk from a patch was rejected.
+ * @since New in 1.7. */
+ svn_wc_notify_patch_rejected_hunk,
} svn_wc_notify_action_t;
@@ -1227,6 +1235,19 @@
* @since New in 1.7 */
svn_revnum_t old_revision;
+ /* These fields are used by svn patch to identify the
+ * hunk the notification is for. They are line-based
+ * offsets and lengths parsed from the unidiff hunk header.
+ * @since New in 1.7. */
+ svn_linenum_t hunk_original_start;
+ svn_linenum_t hunk_original_length;
+ svn_linenum_t hunk_modified_start;
+ svn_linenum_t hunk_modified_length;
+
+ /* The line at which a hunk was matched (and applied).
+ * @since New in 1.7. */
+ svn_linenum_t hunk_matched_line;
+
/* NOTE: Add new fields at the end to preserve binary compatibility.
Also, if you add fields here, you have to update svn_wc_create_notify
and svn_wc_dup_notify. */
Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=903284&r1=903283&r2=903284&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Jan 26 15:46:59 2010
@@ -48,6 +48,9 @@
/* The line where the hunk matched in the target file. */
svn_linenum_t matched_line;
+
+ /* Whether this hunk has been rejected. */
+ svn_boolean_t rejected;
} hunk_info_t;
typedef struct {
@@ -112,7 +115,7 @@
apr_array_header_t *lines;
/* An array containing hunk_info_t structures for hunks already matched. */
- apr_array_header_t *matched_hunks;
+ apr_array_header_t *hunks;
/* The node kind of the target as found on disk prior
* to patch application. */
@@ -439,8 +442,7 @@
new_target->pool = result_pool;
new_target->lines = apr_array_make(result_pool, 0,
sizeof(svn_stream_mark_t *));
- new_target->matched_hunks = apr_array_make(result_pool, 0,
- sizeof(hunk_info_t *));
+ new_target->hunks = apr_array_make(result_pool, 0, sizeof(hunk_info_t *));
*target = new_target;
return SVN_NO_ERROR;
}
@@ -608,11 +610,11 @@
svn_boolean_t taken = FALSE;
/* Don't allow hunks to match at overlapping locations. */
- for (i = 0; i < target->matched_hunks->nelts; i++)
+ for (i = 0; i < target->hunks->nelts; i++)
{
- const hunk_info_t *hi;
+ hunk_info_t *hi;
- hi = APR_ARRAY_IDX(target->matched_hunks, i, hunk_info_t *);
+ hi = APR_ARRAY_IDX(target->hunks, i, hunk_info_t *);
taken = (target->current_line >= hi->matched_line &&
target->current_line < hi->matched_line +
hi->hunk->original_length);
@@ -690,8 +692,9 @@
}
(*hi) = apr_palloc(result_pool, sizeof(hunk_info_t));
- (*hi)->matched_line = matched_line;
(*hi)->hunk = hunk;
+ (*hi)->matched_line = matched_line;
+ (*hi)->rejected = FALSE;
return SVN_NO_ERROR;
}
@@ -782,29 +785,37 @@
}
+/* Write a hunk described by hunk info HI to the reject stream of TARGET,
+ * mark the hunk as rejected, and mark TARGET as having had rejects.
+ * Do all allocations in POOL. */
static svn_error_t *
-reject_hunk(patch_target_t *target, const svn_hunk_t *hunk, apr_pool_t *pool)
+reject_hunk(patch_target_t *target, hunk_info_t *hi, apr_pool_t *pool)
{
const char *hunk_header;
apr_size_t len;
hunk_header = apr_psprintf(pool, "@@ -%lu,%lu +%lu,%lu @@%s",
- hunk->original_start, hunk->original_length,
- hunk->modified_start, hunk->modified_length,
+ hi->hunk->original_start,
+ hi->hunk->original_length,
+ hi->hunk->modified_start,
+ hi->hunk->modified_length,
target->eol_str);
len = strlen(hunk_header);
SVN_ERR(svn_stream_write(target->reject, hunk_header, &len));
- SVN_ERR(copy_hunk_text(hunk->diff_text, target->reject,
+ SVN_ERR(copy_hunk_text(hi->hunk->diff_text, target->reject,
target->reject_path, pool));
target->had_rejects = TRUE;
+ hi->rejected = TRUE;
+
return SVN_NO_ERROR;
}
-/* Apply a HUNK to a patch TARGET. Do all allocations in POOL. */
+/* Apply a hunk described by hunk info HI to a patch TARGET.
+ * Do all allocations in POOL. */
static svn_error_t *
-apply_one_hunk(const hunk_info_t *hi, patch_target_t *target, apr_pool_t *pool)
+apply_one_hunk(patch_target_t *target, hunk_info_t *hi, apr_pool_t *pool)
{
if (target->kind == svn_node_file)
{
@@ -813,7 +824,7 @@
if (target->eof)
{
/* File is shorter than it should be. */
- SVN_ERR(reject_hunk(target, hi->hunk, pool));
+ SVN_ERR(reject_hunk(target, hi, pool));
return SVN_NO_ERROR;
}
@@ -881,6 +892,39 @@
(*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
+ if (action == svn_wc_notify_patch)
+ {
+ int i;
+ apr_pool_t *iterpool;
+
+ iterpool = svn_pool_create(pool);
+ for (i = 0; i < target->hunks->nelts; i++)
+ {
+ hunk_info_t *hi;
+
+ svn_pool_clear(iterpool);
+
+ hi = APR_ARRAY_IDX(target->hunks, i, hunk_info_t *);
+
+ if (hi->rejected)
+ action = svn_wc_notify_patch_rejected_hunk;
+ else
+ action = svn_wc_notify_patch_applied_hunk;
+
+ notify = svn_wc_create_notify(target->abs_path ? target->abs_path
+ : target->rel_path,
+ action, pool);
+ notify->hunk_original_start = hi->hunk->original_start;
+ notify->hunk_original_length = hi->hunk->original_length;
+ notify->hunk_modified_start = hi->hunk->modified_start;
+ notify->hunk_modified_length = hi->hunk->original_length;
+ notify->hunk_matched_line = hi->matched_line;
+
+ (*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
+ }
+ svn_pool_destroy(iterpool);
+ }
+
return SVN_NO_ERROR;
}
@@ -927,21 +971,22 @@
if (hi->matched_line == 0)
{
/* The hunk does not apply, reject it. */
- SVN_ERR(reject_hunk(target, hunk, iterpool));
+ SVN_ERR(reject_hunk(target, hi, iterpool));
}
else
- APR_ARRAY_PUSH(target->matched_hunks, hunk_info_t *) = hi;
+ APR_ARRAY_PUSH(target->hunks, hunk_info_t *) = hi;
}
/* Apply hunks. */
- for (i = 0; i < target->matched_hunks->nelts; i++)
+ for (i = 0; i < target->hunks->nelts; i++)
{
- const hunk_info_t *hi;
+ hunk_info_t *hi;
svn_pool_clear(iterpool);
- hi = APR_ARRAY_IDX(target->matched_hunks, i, const hunk_info_t *);
- SVN_ERR(apply_one_hunk(hi, target, iterpool));
+ hi = APR_ARRAY_IDX(target->hunks, i, hunk_info_t *);
+ if (! hi->rejected)
+ SVN_ERR(apply_one_hunk(target, hi, iterpool));
}
svn_pool_destroy(iterpool);
Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=903284&r1=903283&r2=903284&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Tue Jan 26 15:46:59 2010
@@ -288,6 +288,52 @@
goto print_error;
break;
+ case svn_wc_notify_patch_applied_hunk:
+ nb->received_some_change = TRUE;
+ if ((err = svn_cmdline_printf(pool,
+ "> applied hunk "
+ "@@ -%lu,%lu +%lu,%lu @@",
+ n->hunk_original_start,
+ n->hunk_original_length,
+ n->hunk_modified_start,
+ n->hunk_modified_length)))
+ goto print_error;
+ if (n->hunk_original_start != n->hunk_matched_line)
+ {
+ apr_int64_t off;
+ const char *s;
+
+ if (n->hunk_matched_line > n->hunk_original_start)
+ {
+ off = n->hunk_matched_line - n->hunk_original_start;
+ s = "";
+ }
+ else
+ {
+ off = n->hunk_original_start - n->hunk_matched_line;
+ s = "-";
+ }
+ if ((err = svn_cmdline_printf(pool,
+ " with offset %s%"APR_INT64_T_FMT,
+ s, off)))
+ goto print_error;
+ }
+ if ((err = svn_cmdline_printf(pool, "\n")))
+ goto print_error;
+ break;
+
+ case svn_wc_notify_patch_rejected_hunk:
+ nb->received_some_change = TRUE;
+ if ((err = svn_cmdline_printf(pool,
+ "> rejected hunk "
+ "@@ -%lu,%lu +%lu,%lu @@\n",
+ n->hunk_original_start,
+ n->hunk_original_length,
+ n->hunk_modified_start,
+ n->hunk_modified_length)))
+ goto print_error;
+ break;
+
case svn_wc_notify_update_update:
case svn_wc_notify_merge_record_info:
{
Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=903284&r1=903283&r2=903284&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Jan 26 15:46:59 2010
@@ -187,9 +187,13 @@
expected_output = [
'U %s\n' % os.path.join(wc_dir, 'A', 'D', 'gamma'),
+ '> applied hunk @@ -1,1 +1,1 @@\n',
'U %s\n' % os.path.join(wc_dir, 'iota'),
+ '> applied hunk @@ -1,1 +1,1 @@\n',
'A %s\n' % os.path.join(wc_dir, 'new'),
'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
+ '> applied hunk @@ -6,6 +6,6 @@\n',
+ '> applied hunk @@ -14,11 +17,11 @@\n',
'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
]
@@ -257,6 +261,7 @@
lambda_path = os.path.join(os.path.sep, 'A', 'B', 'lambda')
expected_output = [
'U %s\n' % os.path.join('A', 'B', 'E', 'alpha'),
+ '> applied hunk @@ -1,1 +1,1 @@\n',
'Skipped \'%s\'\n' % lambda_path,
'Summary of conflicts:\n',
' Skipped paths: 1\n'
@@ -471,7 +476,10 @@
expected_output = [
'U %s\n' % os.path.join('A', 'mu'),
- 'U iota\n'
+ '> applied hunk @@ -6,6 +6,6 @@ with offset -1\n',
+ '> applied hunk @@ -14,11 +17,11 @@ with offset 4\n',
+ 'U iota\n',
+ '> applied hunk @@ -5,6 +5,6 @@ with offset -3\n',
]
expected_disk = svntest.main.greek_state.copy()
@@ -631,9 +639,13 @@
expected_output = [
'U %s\n' % os.path.join(wc_dir, 'A', 'D', 'gamma'),
+ '> applied hunk @@ -1,1 +1,1 @@\n',
'U %s\n' % os.path.join(wc_dir, 'iota'),
+ '> applied hunk @@ -1,1 +1,1 @@\n',
'A %s\n' % os.path.join(wc_dir, 'new'),
'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
+ '> applied hunk @@ -6,6 +6,6 @@\n',
+ '> applied hunk @@ -14,11 +17,11 @@\n',
'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
]
@@ -801,9 +813,13 @@
expected_output = [
'U %s\n' % os.path.join(wc_dir, 'A', 'D', 'gamma'),
+ '> applied hunk @@ -1,1 +1,1 @@\n',
'U %s\n' % os.path.join(wc_dir, 'iota'),
+ '> applied hunk @@ -1,1 +1,1 @@\n',
'A %s\n' % os.path.join(wc_dir, 'new'),
'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
+ '> applied hunk @@ -6,6 +6,6 @@\n',
+ '> applied hunk @@ -14,11 +17,11 @@\n',
'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
]
Re: Real problem is r88099
Posted by Philip Martin <ph...@wandisco.com>.
Philip Martin <ph...@wandisco.com> writes:
> ==10949== Invalid read of size 8
> ==10949== at 0x5991011: range_contains (mergeinfo.c:780)
> ==10949== by 0x59913F3: rangelist_intersect_or_remove (mergeinfo.c:912)
> ==10949== by 0x5991903: svn_rangelist_intersect (mergeinfo.c:1043)
> ==10949== by 0x4E76FF3: svn_client_mergeinfo_log (mergeinfo.c:2036)
> ==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
> ==10949== by 0x414A11: main (main.c:2234)
> ==10949== Address 0xa7a4c08 is 0 bytes inside a block of size 24 free'd
> ==10949== at 0x4C2130F: free (vg_replace_malloc.c:323)
> ==10949== by 0x5E11469: pool_clear_debug (apr_pools.c:1432)
> ==10949== by 0x5E11537: apr_pool_clear_debug (apr_pools.c:1469)
> ==10949== by 0x4E76FD0: svn_client_mergeinfo_log (mergeinfo.c:2035)
> ==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
> ==10949== by 0x414A11: main (main.c:2234)
Fixed in r903535.
--
Philip
Re: Real problem is r88099
Posted by Philip Martin <ph...@wandisco.com>.
Philip Martin <ph...@wandisco.com> writes:
> ==13758== Invalid read of size 4
> ==13758== at 0x50FA05B: close_directory (update_editor.c:3166)
> ==13758== by 0x50B6D6E: close_directory (ambient_depth_filter_editor.c:567)
> ==13758== by 0x5541477: close_directory (cancel.c:261)
> ==13758== by 0x5541477: close_directory (cancel.c:261)
> ==13758== by 0x69E924A: update_entry (reporter.c:855)
> ==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
> ==13758== by 0x69E91F6: update_entry (reporter.c:852)
> ==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
> ==13758== by 0x69EA575: drive (reporter.c:1195)
> ==13758== by 0x69EAA4B: finish_report (reporter.c:1262)
> ==13758== by 0x69EAEA4: svn_repos_finish_report (reporter.c:1352)
> ==13758== by 0x67C07AA: reporter_finish_report (ra_plugin.c:213)
> ==13758== Address 0xc0991f0 is 56 bytes inside a block of size 120 free'd
> ==13758== at 0x4C2130F: free (vg_replace_malloc.c:323)
> ==13758== by 0x5E11469: pool_clear_debug (apr_pools.c:1432)
> ==13758== by 0x5E11599: pool_destroy_debug (apr_pools.c:1494)
> ==13758== by 0x5E1166D: apr_pool_destroy_debug (apr_pools.c:1536)
> ==13758== by 0x50F47B8: maybe_bump_dir_info (update_editor.c:862)
> ==13758== by 0x50FA01B: close_directory (update_editor.c:3159)
> ==13758== by 0x50B6D6E: close_directory (ambient_depth_filter_editor.c:567)
> ==13758== by 0x5541477: close_directory (cancel.c:261)
> ==13758== by 0x5541477: close_directory (cancel.c:261)
> ==13758== by 0x69E924A: update_entry (reporter.c:855)
> ==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
> ==13758== by 0x69E91F6: update_entry (reporter.c:852)
Fixed in r903531. I'm still seeing 3 mergeinfo failures like:
==10949== Invalid read of size 8
==10949== at 0x5991011: range_contains (mergeinfo.c:780)
==10949== by 0x59913F3: rangelist_intersect_or_remove (mergeinfo.c:912)
==10949== by 0x5991903: svn_rangelist_intersect (mergeinfo.c:1043)
==10949== by 0x4E76FF3: svn_client_mergeinfo_log (mergeinfo.c:2036)
==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
==10949== by 0x414A11: main (main.c:2234)
==10949== Address 0xa7a4c08 is 0 bytes inside a block of size 24 free'd
==10949== at 0x4C2130F: free (vg_replace_malloc.c:323)
==10949== by 0x5E11469: pool_clear_debug (apr_pools.c:1432)
==10949== by 0x5E11537: apr_pool_clear_debug (apr_pools.c:1469)
==10949== by 0x4E76FD0: svn_client_mergeinfo_log (mergeinfo.c:2035)
==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
==10949== by 0x414A11: main (main.c:2234)
==10949==
==10949== Invalid read of size 8
==10949== at 0x5990F99: range_intersect (mergeinfo.c:770)
==10949== by 0x59914B6: rangelist_intersect_or_remove (mergeinfo.c:924)
==10949== by 0x5991903: svn_rangelist_intersect (mergeinfo.c:1043)
==10949== by 0x4E76FF3: svn_client_mergeinfo_log (mergeinfo.c:2036)
==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
==10949== by 0x414A11: main (main.c:2234)
==10949== Address 0xa7a4c08 is 0 bytes inside a block of size 24 free'd
==10949== at 0x4C2130F: free (vg_replace_malloc.c:323)
==10949== by 0x5E11469: pool_clear_debug (apr_pools.c:1432)
==10949== by 0x5E11537: apr_pool_clear_debug (apr_pools.c:1469)
==10949== by 0x4E76FD0: svn_client_mergeinfo_log (mergeinfo.c:2035)
==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
==10949== by 0x414A11: main (main.c:2234)
--
Philip
Re: Real problem is r88099
Posted by Philip Martin <ph...@wandisco.com>.
Philip Martin <ph...@wandisco.com> writes:
> ==13758== Invalid read of size 4
> ==13758== at 0x50FA05B: close_directory (update_editor.c:3166)
> ==13758== by 0x50B6D6E: close_directory (ambient_depth_filter_editor.c:567)
> ==13758== by 0x5541477: close_directory (cancel.c:261)
> ==13758== by 0x5541477: close_directory (cancel.c:261)
> ==13758== by 0x69E924A: update_entry (reporter.c:855)
> ==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
> ==13758== by 0x69E91F6: update_entry (reporter.c:852)
> ==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
> ==13758== by 0x69EA575: drive (reporter.c:1195)
> ==13758== by 0x69EAA4B: finish_report (reporter.c:1262)
> ==13758== by 0x69EAEA4: svn_repos_finish_report (reporter.c:1352)
> ==13758== by 0x67C07AA: reporter_finish_report (ra_plugin.c:213)
> ==13758== Address 0xc0991f0 is 56 bytes inside a block of size 120 free'd
> ==13758== at 0x4C2130F: free (vg_replace_malloc.c:323)
> ==13758== by 0x5E11469: pool_clear_debug (apr_pools.c:1432)
> ==13758== by 0x5E11599: pool_destroy_debug (apr_pools.c:1494)
> ==13758== by 0x5E1166D: apr_pool_destroy_debug (apr_pools.c:1536)
> ==13758== by 0x50F47B8: maybe_bump_dir_info (update_editor.c:862)
> ==13758== by 0x50FA01B: close_directory (update_editor.c:3159)
> ==13758== by 0x50B6D6E: close_directory (ambient_depth_filter_editor.c:567)
> ==13758== by 0x5541477: close_directory (cancel.c:261)
> ==13758== by 0x5541477: close_directory (cancel.c:261)
> ==13758== by 0x69E924A: update_entry (reporter.c:855)
> ==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
> ==13758== by 0x69E91F6: update_entry (reporter.c:852)
Fixed in r903531. I'm still seeing 3 mergeinfo failures like:
==10949== Invalid read of size 8
==10949== at 0x5991011: range_contains (mergeinfo.c:780)
==10949== by 0x59913F3: rangelist_intersect_or_remove (mergeinfo.c:912)
==10949== by 0x5991903: svn_rangelist_intersect (mergeinfo.c:1043)
==10949== by 0x4E76FF3: svn_client_mergeinfo_log (mergeinfo.c:2036)
==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
==10949== by 0x414A11: main (main.c:2234)
==10949== Address 0xa7a4c08 is 0 bytes inside a block of size 24 free'd
==10949== at 0x4C2130F: free (vg_replace_malloc.c:323)
==10949== by 0x5E11469: pool_clear_debug (apr_pools.c:1432)
==10949== by 0x5E11537: apr_pool_clear_debug (apr_pools.c:1469)
==10949== by 0x4E76FD0: svn_client_mergeinfo_log (mergeinfo.c:2035)
==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
==10949== by 0x414A11: main (main.c:2234)
==10949==
==10949== Invalid read of size 8
==10949== at 0x5990F99: range_intersect (mergeinfo.c:770)
==10949== by 0x59914B6: rangelist_intersect_or_remove (mergeinfo.c:924)
==10949== by 0x5991903: svn_rangelist_intersect (mergeinfo.c:1043)
==10949== by 0x4E76FF3: svn_client_mergeinfo_log (mergeinfo.c:2036)
==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
==10949== by 0x414A11: main (main.c:2234)
==10949== Address 0xa7a4c08 is 0 bytes inside a block of size 24 free'd
==10949== at 0x4C2130F: free (vg_replace_malloc.c:323)
==10949== by 0x5E11469: pool_clear_debug (apr_pools.c:1432)
==10949== by 0x5E11537: apr_pool_clear_debug (apr_pools.c:1469)
==10949== by 0x4E76FD0: svn_client_mergeinfo_log (mergeinfo.c:2035)
==10949== by 0x415BAC: svn_cl__mergeinfo (mergeinfo-cmd.c:120)
==10949== by 0x414A11: main (main.c:2234)
--
Philip
Real problem is r88099
Posted by Philip Martin <ph...@wandisco.com>.
Philip Martin <ph...@wandisco.com> writes:
> stsp@apache.org writes:
>
>> Author: stsp
>> Date: Tue Jan 26 15:46:59 2010
>> New Revision: 903284
>>
>> URL: http://svn.apache.org/viewvc?rev=903284&view=rev
>> Log:
>> Make svn patch provide notifications about individual hunks.
>> Make the CLI client print them.
>
> I don't know why yet, but this patch is causing lots of regression
> test failures, e.g.:
I think it's only indirectly caused by this patch, it appears that the
real problem is a memory reuse problem tickled by the increase in size
of svn_wc_notify_t. Valgrind wasn't much help until I rebuilt apr and
apr-util, then:
==13758== Invalid read of size 4
==13758== at 0x50FA05B: close_directory (update_editor.c:3166)
==13758== by 0x50B6D6E: close_directory (ambient_depth_filter_editor.c:567)
==13758== by 0x5541477: close_directory (cancel.c:261)
==13758== by 0x5541477: close_directory (cancel.c:261)
==13758== by 0x69E924A: update_entry (reporter.c:855)
==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
==13758== by 0x69E91F6: update_entry (reporter.c:852)
==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
==13758== by 0x69EA575: drive (reporter.c:1195)
==13758== by 0x69EAA4B: finish_report (reporter.c:1262)
==13758== by 0x69EAEA4: svn_repos_finish_report (reporter.c:1352)
==13758== by 0x67C07AA: reporter_finish_report (ra_plugin.c:213)
==13758== Address 0xc0991f0 is 56 bytes inside a block of size 120 free'd
==13758== at 0x4C2130F: free (vg_replace_malloc.c:323)
==13758== by 0x5E11469: pool_clear_debug (apr_pools.c:1432)
==13758== by 0x5E11599: pool_destroy_debug (apr_pools.c:1494)
==13758== by 0x5E1166D: apr_pool_destroy_debug (apr_pools.c:1536)
==13758== by 0x50F47B8: maybe_bump_dir_info (update_editor.c:862)
==13758== by 0x50FA01B: close_directory (update_editor.c:3159)
==13758== by 0x50B6D6E: close_directory (ambient_depth_filter_editor.c:567)
==13758== by 0x5541477: close_directory (cancel.c:261)
==13758== by 0x5541477: close_directory (cancel.c:261)
==13758== by 0x69E924A: update_entry (reporter.c:855)
==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
==13758== by 0x69E91F6: update_entry (reporter.c:852)
So I think the problem is caused by:
------------------------------------------------------------------------
r880099 | rhuijben | 2009-10-14 16:27:43 +0100 (Wed, 14 Oct 2009) | 37 lines
Following up on issues discovered/worked around by gstein in r40000
and in preparation for moving all property operations in the database,
take baton lifetime in the update editor in our own hands. Construct per
dir and per file pools in their parent pool and the top level directory
in the editor pool.
This moves the final cleanup for the directories to the close/bump of
their parent or of the editor in case of the root, instead of at closing
of the parent pool of the editor (read: at svn exit time).
Use this functionality to introduce a per file log and a per file/dir
wq item accumulator, which will be used for property operations soon.
* subversion/libsvn_wc/update_editor.c
(dir_baton): Remove copy of edit_baton->db, add wq_accumulator.
(bump_dir_info): Add pool.
(flush_log): Use db from edit baton. Also flush the wq_accumulator.
(cleanup_dir_baton): Update user.
(make_dir_baton): Create baton in parent and allocate everything in the
baton pool.
(maybe_bump_dir_info): Destroy the directory pool after bumping.
(close_directory): Flush the log if skipping the directory.
(file_baton): Add log and wq accumulator.
(make_file_baton): Create pool in parent dir pool and allocate everything in
this pool.
(flush_file_log): New function, like flush_log()
(open_file, add_file, merge_file):
Add accumulated work to file accumulator.
(close_file): If not skipping, send accumulated operations to the wq. Destroy
file pool.
(make_editor): Rename pools to match their usage.
--
Philip
Real problem is r88099
Posted by Philip Martin <ph...@wandisco.com>.
Philip Martin <ph...@wandisco.com> writes:
> stsp@apache.org writes:
>
>> Author: stsp
>> Date: Tue Jan 26 15:46:59 2010
>> New Revision: 903284
>>
>> URL: http://svn.apache.org/viewvc?rev=903284&view=rev
>> Log:
>> Make svn patch provide notifications about individual hunks.
>> Make the CLI client print them.
>
> I don't know why yet, but this patch is causing lots of regression
> test failures, e.g.:
I think it's only indirectly caused by this patch, it appears that the
real problem is a memory reuse problem tickled by the increase in size
of svn_wc_notify_t. Valgrind wasn't much help until I rebuilt apr and
apr-util, then:
==13758== Invalid read of size 4
==13758== at 0x50FA05B: close_directory (update_editor.c:3166)
==13758== by 0x50B6D6E: close_directory (ambient_depth_filter_editor.c:567)
==13758== by 0x5541477: close_directory (cancel.c:261)
==13758== by 0x5541477: close_directory (cancel.c:261)
==13758== by 0x69E924A: update_entry (reporter.c:855)
==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
==13758== by 0x69E91F6: update_entry (reporter.c:852)
==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
==13758== by 0x69EA575: drive (reporter.c:1195)
==13758== by 0x69EAA4B: finish_report (reporter.c:1262)
==13758== by 0x69EAEA4: svn_repos_finish_report (reporter.c:1352)
==13758== by 0x67C07AA: reporter_finish_report (ra_plugin.c:213)
==13758== Address 0xc0991f0 is 56 bytes inside a block of size 120 free'd
==13758== at 0x4C2130F: free (vg_replace_malloc.c:323)
==13758== by 0x5E11469: pool_clear_debug (apr_pools.c:1432)
==13758== by 0x5E11599: pool_destroy_debug (apr_pools.c:1494)
==13758== by 0x5E1166D: apr_pool_destroy_debug (apr_pools.c:1536)
==13758== by 0x50F47B8: maybe_bump_dir_info (update_editor.c:862)
==13758== by 0x50FA01B: close_directory (update_editor.c:3159)
==13758== by 0x50B6D6E: close_directory (ambient_depth_filter_editor.c:567)
==13758== by 0x5541477: close_directory (cancel.c:261)
==13758== by 0x5541477: close_directory (cancel.c:261)
==13758== by 0x69E924A: update_entry (reporter.c:855)
==13758== by 0x69E9B2C: delta_dirs (reporter.c:1028)
==13758== by 0x69E91F6: update_entry (reporter.c:852)
So I think the problem is caused by:
------------------------------------------------------------------------
r880099 | rhuijben | 2009-10-14 16:27:43 +0100 (Wed, 14 Oct 2009) | 37 lines
Following up on issues discovered/worked around by gstein in r40000
and in preparation for moving all property operations in the database,
take baton lifetime in the update editor in our own hands. Construct per
dir and per file pools in their parent pool and the top level directory
in the editor pool.
This moves the final cleanup for the directories to the close/bump of
their parent or of the editor in case of the root, instead of at closing
of the parent pool of the editor (read: at svn exit time).
Use this functionality to introduce a per file log and a per file/dir
wq item accumulator, which will be used for property operations soon.
* subversion/libsvn_wc/update_editor.c
(dir_baton): Remove copy of edit_baton->db, add wq_accumulator.
(bump_dir_info): Add pool.
(flush_log): Use db from edit baton. Also flush the wq_accumulator.
(cleanup_dir_baton): Update user.
(make_dir_baton): Create baton in parent and allocate everything in the
baton pool.
(maybe_bump_dir_info): Destroy the directory pool after bumping.
(close_directory): Flush the log if skipping the directory.
(file_baton): Add log and wq accumulator.
(make_file_baton): Create pool in parent dir pool and allocate everything in
this pool.
(flush_file_log): New function, like flush_log()
(open_file, add_file, merge_file):
Add accumulated work to file accumulator.
(close_file): If not skipping, send accumulated operations to the wq. Destroy
file pool.
(make_editor): Rename pools to match their usage.
--
Philip
Re: svn commit: r903284 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/patch.c svn/notify.c tests/cmdline/patch_tests.py
Posted by Philip Martin <ph...@wandisco.com>.
stsp@apache.org writes:
> Author: stsp
> Date: Tue Jan 26 15:46:59 2010
> New Revision: 903284
>
> URL: http://svn.apache.org/viewvc?rev=903284&view=rev
> Log:
> Make svn patch provide notifications about individual hunks.
> Make the CLI client print them.
I don't know why yet, but this patch is causing lots of regression
test failures, e.g.:
$ ../../../../src/subversion/tests/cmdline/basic_tests.py --parallel
..........................F.........F..........F.
That's 16, 38 and 40 that are failing.
The client is segfaulting:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f802bb9b750 (LWP 14121)]
0x00007f802b500101 in close_directory (dir_baton=0xc115c8, pool=0xc0d538)
at ../src/subversion/libsvn_wc/update_editor.c:3181
3181 notify->revision = *db->edit_baton->target_revision;
(gdb) p db[0]->edit_baton
$1 = (struct edit_baton *) 0x0
(gdb) p *db
$2 = {name = 0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>,
local_abspath = 0x0, new_URL = 0x0, old_revision = 0, edit_baton = 0x0,
parent_baton = 0x0, skip_this = 0, skip_descendants = 0,
already_notified = 0, inside_deleted_subtree = 0, added = 0, existed = 0,
add_existed = 0, propchanges = 0xc11770, bump_info = 0xc11748,
log_accum = 0xc117a8, ambient_depth = svn_depth_infinity,
was_incomplete = 0, pool = 0xc11558}
(gdb) bt
#0 0x00007f802b500101 in close_directory (dir_baton=0xc115c8, pool=0xc0d538)
at ../src/subversion/libsvn_wc/update_editor.c:3181
#1 0x00007f802b4bcd6f in close_directory (dir_baton=0xc0d5e8, pool=0xc0d538)
at ../src/subversion/libsvn_wc/ambient_depth_filter_editor.c:567
#2 0x00007f802b082478 in close_directory (dir_baton=0xc0d5d8, pool=0xc0d538)
at ../src/subversion/libsvn_delta/cancel.c:261
#3 0x00007f802b082478 in close_directory (dir_baton=0xc0d5c8, pool=0xc0d538)
at ../src/subversion/libsvn_delta/cancel.c:261
#4 0x00007f802a05024b in update_entry (b=0xb7cb80, s_rev=1,
s_path=0xc0d5c0 "/A/D", s_entry=0xc10088, t_path=0xc0d5b8 "/A/D",
t_entry=0xc109b0, dir_baton=0xbf8e08, e_path=0xc0d5b0 "A/D", info=0x0,
wc_depth=svn_depth_infinity, requested_depth=svn_depth_unknown,
pool=0xc0d538) at ../src/subversion/libsvn_repos/reporter.c:855
#5 0x00007f802a050b2d in delta_dirs (b=0xb7cb80, s_rev=1,
s_path=0xbf8e00 "/A", t_path=0xbf8df8 "/A", dir_baton=0xbf8e08,
e_path=0xbf8df0 "A", start_empty=0, wc_depth=svn_depth_infinity,
requested_depth=svn_depth_unknown, pool=0xbf8d78)
at ../src/subversion/libsvn_repos/reporter.c:1028
#6 0x00007f802a0501f7 in update_entry (b=0xb7cb80, s_rev=1,
s_path=0xbf8e00 "/A", s_entry=0xbe8290, t_path=0xbf8df8 "/A",
t_entry=0xbe8a48, dir_baton=0xbc5410, e_path=0xbf8df0 "A", info=0x0,
wc_depth=svn_depth_infinity, requested_depth=svn_depth_unknown,
pool=0xbf8d78) at ../src/subversion/libsvn_repos/reporter.c:852
#7 0x00007f802a050b2d in delta_dirs (b=0xb7cb80, s_rev=1,
s_path=0xb94308 "/", t_path=0xb7cc30 "/", dir_baton=0xbc5410,
e_path=0x7f802a05bd87 "", start_empty=0, wc_depth=svn_depth_infinity,
requested_depth=svn_depth_unknown, pool=0xa756b8)
at ../src/subversion/libsvn_repos/reporter.c:1028
#8 0x00007f802a051576 in drive (b=0xb7cb80, s_rev=1, info=0xb94288,
pool=0xa756b8) at ../src/subversion/libsvn_repos/reporter.c:1195
#9 0x00007f802a051a4c in finish_report (b=0xb7cb80, pool=0xa756b8)
at ../src/subversion/libsvn_repos/reporter.c:1262
#10 0x00007f802a051ea5 in svn_repos_finish_report (baton=0xb7cb80,
pool=0xa756b8) at ../src/subversion/libsvn_repos/reporter.c:1352
#11 0x00007f802a26b7ab in reporter_finish_report (reporter_baton=0xb94108,
pool=0xa756b8) at ../src/subversion/libsvn_ra_local/ra_plugin.c:213
#12 0x00007f802b4b17fa in svn_wc_crawl_revisions5 (wc_ctx=0xa65c78,
local_abspath=0xa75920 "/home/pm/sw/subversion/obj/subversion/tests/cmdline/svn-test-work/working_copies/basic_tests-16", reporter=0x7f802a471040,
report_baton=0xb94108, restore_files=1, depth=svn_depth_unknown,
honor_depth_exclude=1, depth_compatibility_trick=0, use_commit_times=0,
external_func=0x7f802b76aa11 <svn_client__external_info_gatherer>,
external_baton=0x7fff7044a420, notify_func=0x416791 <notify>,
notify_baton=0xa85e88, pool=0xa756b8)
at ../src/subversion/libsvn_wc/adm_crawler.c:1056
#13 0x00007f802b79883e in svn_client__update_internal (
result_rev=0x7fff7044a640,
path=0xa85e10 "svn-test-work/working_copies/basic_tests-16",
revision=0x7fff7044a8b8, depth=svn_depth_unknown, depth_is_sticky=0,
ignore_externals=0, allow_unver_obstructions=0,
timestamp_sleep=0x7fff7044a648, send_copyfrom_args=1, innerupdate=0,
ctx=0xa65bd0, pool=0xa756b8)
at ../src/subversion/libsvn_client/update.c:278
#14 0x00007f802b798bc0 in svn_client_update3 (result_revs=0x0, paths=0xa85e40,
revision=0x7fff7044a8b8, depth=svn_depth_unknown, depth_is_sticky=0,
ignore_externals=0, allow_unver_obstructions=0, ctx=0xa65bd0,
pool=0xa652a8) at ../src/subversion/libsvn_client/update.c:362
#15 0x000000000041f872 in svn_cl__update (os=0xa654f0, baton=0x7fff7044a890,
scratch_pool=0xa652a8) at ../src/subversion/svn/update-cmd.c:92
#16 0x0000000000414a12 in main (argc=3, argv=0x7fff7044abf8)
at ../src/subversion/svn/main.c:2234
(gdb)
--
Philip
Re: svn commit: r903284 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/patch.c svn/notify.c tests/cmdline/patch_tests.py
Posted by Philip Martin <ph...@wandisco.com>.
stsp@apache.org writes:
> Author: stsp
> Date: Tue Jan 26 15:46:59 2010
> New Revision: 903284
>
> URL: http://svn.apache.org/viewvc?rev=903284&view=rev
> Log:
> Make svn patch provide notifications about individual hunks.
> Make the CLI client print them.
I don't know why yet, but this patch is causing lots of regression
test failures, e.g.:
$ ../../../../src/subversion/tests/cmdline/basic_tests.py --parallel
..........................F.........F..........F.
That's 16, 38 and 40 that are failing.
The client is segfaulting:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f802bb9b750 (LWP 14121)]
0x00007f802b500101 in close_directory (dir_baton=0xc115c8, pool=0xc0d538)
at ../src/subversion/libsvn_wc/update_editor.c:3181
3181 notify->revision = *db->edit_baton->target_revision;
(gdb) p db[0]->edit_baton
$1 = (struct edit_baton *) 0x0
(gdb) p *db
$2 = {name = 0xffffffffffffffff <Address 0xffffffffffffffff out of bounds>,
local_abspath = 0x0, new_URL = 0x0, old_revision = 0, edit_baton = 0x0,
parent_baton = 0x0, skip_this = 0, skip_descendants = 0,
already_notified = 0, inside_deleted_subtree = 0, added = 0, existed = 0,
add_existed = 0, propchanges = 0xc11770, bump_info = 0xc11748,
log_accum = 0xc117a8, ambient_depth = svn_depth_infinity,
was_incomplete = 0, pool = 0xc11558}
(gdb) bt
#0 0x00007f802b500101 in close_directory (dir_baton=0xc115c8, pool=0xc0d538)
at ../src/subversion/libsvn_wc/update_editor.c:3181
#1 0x00007f802b4bcd6f in close_directory (dir_baton=0xc0d5e8, pool=0xc0d538)
at ../src/subversion/libsvn_wc/ambient_depth_filter_editor.c:567
#2 0x00007f802b082478 in close_directory (dir_baton=0xc0d5d8, pool=0xc0d538)
at ../src/subversion/libsvn_delta/cancel.c:261
#3 0x00007f802b082478 in close_directory (dir_baton=0xc0d5c8, pool=0xc0d538)
at ../src/subversion/libsvn_delta/cancel.c:261
#4 0x00007f802a05024b in update_entry (b=0xb7cb80, s_rev=1,
s_path=0xc0d5c0 "/A/D", s_entry=0xc10088, t_path=0xc0d5b8 "/A/D",
t_entry=0xc109b0, dir_baton=0xbf8e08, e_path=0xc0d5b0 "A/D", info=0x0,
wc_depth=svn_depth_infinity, requested_depth=svn_depth_unknown,
pool=0xc0d538) at ../src/subversion/libsvn_repos/reporter.c:855
#5 0x00007f802a050b2d in delta_dirs (b=0xb7cb80, s_rev=1,
s_path=0xbf8e00 "/A", t_path=0xbf8df8 "/A", dir_baton=0xbf8e08,
e_path=0xbf8df0 "A", start_empty=0, wc_depth=svn_depth_infinity,
requested_depth=svn_depth_unknown, pool=0xbf8d78)
at ../src/subversion/libsvn_repos/reporter.c:1028
#6 0x00007f802a0501f7 in update_entry (b=0xb7cb80, s_rev=1,
s_path=0xbf8e00 "/A", s_entry=0xbe8290, t_path=0xbf8df8 "/A",
t_entry=0xbe8a48, dir_baton=0xbc5410, e_path=0xbf8df0 "A", info=0x0,
wc_depth=svn_depth_infinity, requested_depth=svn_depth_unknown,
pool=0xbf8d78) at ../src/subversion/libsvn_repos/reporter.c:852
#7 0x00007f802a050b2d in delta_dirs (b=0xb7cb80, s_rev=1,
s_path=0xb94308 "/", t_path=0xb7cc30 "/", dir_baton=0xbc5410,
e_path=0x7f802a05bd87 "", start_empty=0, wc_depth=svn_depth_infinity,
requested_depth=svn_depth_unknown, pool=0xa756b8)
at ../src/subversion/libsvn_repos/reporter.c:1028
#8 0x00007f802a051576 in drive (b=0xb7cb80, s_rev=1, info=0xb94288,
pool=0xa756b8) at ../src/subversion/libsvn_repos/reporter.c:1195
#9 0x00007f802a051a4c in finish_report (b=0xb7cb80, pool=0xa756b8)
at ../src/subversion/libsvn_repos/reporter.c:1262
#10 0x00007f802a051ea5 in svn_repos_finish_report (baton=0xb7cb80,
pool=0xa756b8) at ../src/subversion/libsvn_repos/reporter.c:1352
#11 0x00007f802a26b7ab in reporter_finish_report (reporter_baton=0xb94108,
pool=0xa756b8) at ../src/subversion/libsvn_ra_local/ra_plugin.c:213
#12 0x00007f802b4b17fa in svn_wc_crawl_revisions5 (wc_ctx=0xa65c78,
local_abspath=0xa75920 "/home/pm/sw/subversion/obj/subversion/tests/cmdline/svn-test-work/working_copies/basic_tests-16", reporter=0x7f802a471040,
report_baton=0xb94108, restore_files=1, depth=svn_depth_unknown,
honor_depth_exclude=1, depth_compatibility_trick=0, use_commit_times=0,
external_func=0x7f802b76aa11 <svn_client__external_info_gatherer>,
external_baton=0x7fff7044a420, notify_func=0x416791 <notify>,
notify_baton=0xa85e88, pool=0xa756b8)
at ../src/subversion/libsvn_wc/adm_crawler.c:1056
#13 0x00007f802b79883e in svn_client__update_internal (
result_rev=0x7fff7044a640,
path=0xa85e10 "svn-test-work/working_copies/basic_tests-16",
revision=0x7fff7044a8b8, depth=svn_depth_unknown, depth_is_sticky=0,
ignore_externals=0, allow_unver_obstructions=0,
timestamp_sleep=0x7fff7044a648, send_copyfrom_args=1, innerupdate=0,
ctx=0xa65bd0, pool=0xa756b8)
at ../src/subversion/libsvn_client/update.c:278
#14 0x00007f802b798bc0 in svn_client_update3 (result_revs=0x0, paths=0xa85e40,
revision=0x7fff7044a8b8, depth=svn_depth_unknown, depth_is_sticky=0,
ignore_externals=0, allow_unver_obstructions=0, ctx=0xa65bd0,
pool=0xa652a8) at ../src/subversion/libsvn_client/update.c:362
#15 0x000000000041f872 in svn_cl__update (os=0xa654f0, baton=0x7fff7044a890,
scratch_pool=0xa652a8) at ../src/subversion/svn/update-cmd.c:92
#16 0x0000000000414a12 in main (argc=3, argv=0x7fff7044abf8)
at ../src/subversion/svn/main.c:2234
(gdb)
--
Philip