You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Matthias Vorwerk <mv...@xtux.de> on 2013/09/03 18:06:46 UTC

Re: svn 1.8.1: segmentation fault on merge

I encountered the same problem with subversion-1.8.3
(CentOS5, httpd-2.4.6):
svn merge ends with sengmentation fault.

I re-compiled svn with the  --enable-maintainer-mode configure option.

Here is what I get:
---------------------------------
% libtool --mode=execute  gdb --args /opt/local/bin/bin/svn merge
--non-interactive --dry-run http://reposrv/p1/branches/branch1/work .
/usr/bin/libtool: line 6823: LC_ALL: command not found
/usr/bin/libtool: line 6823: LC_CTYPE: command not found
/usr/bin/libtool: line 6823: LC_COLLATE: command not found
/usr/bin/libtool: line 6823: LC_MESSAGES: command not found
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-37.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /opt/local/bin/bin/svn...done.
(gdb) r
Starting program: /opt/local/bin/bin/svn merge --non-interactive --dry-run
http://reposrv/p1/branches/branch1/work .
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00002aaaaab0e2db in filter_log_entry_with_rangelist
(baton=0x7fffffff9530, log_entry=0x9c2510, pool=0x9c2498)
    at subversion/libsvn_client/mergeinfo.c:1399
1399                  svn_merge_range_t *youngest_range = APR_ARRAY_IDX(
(gdb)
---------------------------------

Now, when I run:

svn mergeinfo --show-revs eligible http://reposrv/p1/branches/branch1/work .

I get:

rXXXX
...
...
rYYYY

And now using the --revision option to merge:

svn merge --revision XXXX:YYYY --non-interactive --dry-run
http://reposrv/p1/branches/branch1/work .

it works. So without --revision it segfaults, using --revision it works.
I should mention that there already exists a mergeinfo containing a
number of already merged revisions which do not appear in the mergeinfo
list (as expected).







Re: svn 1.8.1: segmentation fault on merge

Posted by "mvorwerk@xtux.de" <mv...@xtux.de>.
On Tue, 3 Sep 2013 18:39:04 +0200, Stefan Sperling <st...@elego.de> wrote:
 
> Can you show us what these gdb commands print here, please?
> 
>   bt
>   p ancestor_is_self
>   p nearest_ancestor_mergeinfo
>   p rangelist
> 
> Thanks!

Here is the output:

Starting program: /opt/local/bin/bin/svn merge --non-interactive --dry-run
http://reposrv/p1/branches/branch1/work .
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00002aaaaab0e2db in filter_log_entry_with_rangelist
(baton=0x7fffffff9530, log_entry=0x9c2510, pool=0x9c2498)
    at subversion/libsvn_client/mergeinfo.c:1399
1399                  svn_merge_range_t *youngest_range = APR_ARRAY_IDX(
(gdb) bt
#0  0x00002aaaaab0e2db in filter_log_entry_with_rangelist
(baton=0x7fffffff9530, log_entry=0x9c2510, pool=0x9c2498)
    at subversion/libsvn_client/mergeinfo.c:1399
#1  0x00002aaaac6d2831 in log_closed (xes=0x9d9148, baton=0x9b1440,
leaving_state=2, cdata=0x0, attrs=0x9dd770,
    scratch_pool=0x9c2498) at subversion/libsvn_ra_serf/log.c:304
#2  0x00002aaaac6ec92b in svn_ra_serf__xml_cb_end (xmlctx=0x9b1608,
raw_name=0x6bbfc0 "S:log-item")
    at subversion/libsvn_ra_serf/xml.c:777
#3  0x00002aaaac6eacb2 in expat_end (userData=0x9b16a8, raw_name=0x6bbfc0
"S:log-item")
    at subversion/libsvn_ra_serf/util.c:2541
#4  0x0000003346409e85 in ?? () from /lib64/libexpat.so.0
#5  0x000000334640ab44 in ?? () from /lib64/libexpat.so.0
#6  0x0000003346403ef1 in XML_ParseBuffer () from /lib64/libexpat.so.0
#7  0x00002aaaac6eaefb in expat_response_handler (request=0x9b3448,
response=0x9c7848, baton=0x9b16a8,
    scratch_pool=0x9df568) at subversion/libsvn_ra_serf/util.c:2621
#8  0x00002aaaac6e9e7a in handle_response (request=0x9b3448,
response=0x9c7848, handler=0x9b16d0,
    serf_status=0x7fffffff8e94, scratch_pool=0x9df568) at
subversion/libsvn_ra_serf/util.c:2120
#9  0x00002aaaac6e9f6b in handle_response_cb (request=0x9b3448,
response=0x9c7848, baton=0x9b16d0, scratch_pool=0x9df568)
    at subversion/libsvn_ra_serf/util.c:2153
#10 0x00002aaaac904051 in serf__process_connection ()
   from /opt/local/bin/lib/libserf-1.so.3
#11 0x00002aaaac9023b5 in serf_event_trigger ()
   from /opt/local/bin/lib/libserf-1.so.3
#12 0x00002aaaac90259f in serf_context_run ()
   from /opt/local/bin/lib/libserf-1.so.3
#13 0x00002aaaac6e7387 in svn_ra_serf__context_run_wait (done=0x9b16ec,
sess=0x995970, scratch_pool=0x9b13c8)
    at subversion/libsvn_ra_serf/util.c:817
#14 0x00002aaaac6e75aa in svn_ra_serf__context_run_one (handler=0x9b16d0,
scratch_pool=0x9b13c8)
    at subversion/libsvn_ra_serf/util.c:888
#15 0x00002aaaac6d3385 in svn_ra_serf__get_log (ra_session=0x995948,
paths=0x9e71f0, start=26778, end=29119, limit=0,
    discover_changed_paths=1, strict_node_history=0,
include_merged_revisions=0, revprops=0x998ba0,
---Type <return> to continue, or q <return> to quit---
    receiver=0x2aaaaab0dea6 <filter_log_entry_with_rangelist>,
receiver_baton=0x7fffffff9530, pool=0x9b13c8)
    at subversion/libsvn_ra_serf/log.c:595
#16 0x00002aaaab025cb1 in svn_ra_get_log2 (session=0x995948,
paths=0x9e71f0, start=26778, end=29119, limit=0,
    discover_changed_paths=1, strict_node_history=0,
include_merged_revisions=0, revprops=0x998ba0,
    receiver=0x2aaaaab0dea6 <filter_log_entry_with_rangelist>,
receiver_baton=0x7fffffff9530, pool=0x9b13c8)
    at subversion/libsvn_ra/ra_loader.c:906
#17 0x00002aaaaaaf2df4 in run_ra_get_log (revision_ranges=0x9b83f0,
paths=0x9e71f0, log_segments=0x9b85d8,
    actual_loc=0x9b8490, ra_session=0x995948, targets=0x9e6f58, limit=0,
discover_changed_paths=1, strict_node_history=0,
    include_merged_revisions=0, revprops=0x998ba0,
real_receiver=0x2aaaaab0dea6 <filter_log_entry_with_rangelist>,
    real_receiver_baton=0x7fffffff9530, ctx=0x68ba70,
scratch_pool=0x65a7f8) at subversion/libsvn_client/log.c:771
#18 0x00002aaaaaaf32ea in svn_client_log5 (targets=0x9e6f58,
peg_revision=0x7fffffff9580, opt_rev_ranges=0x9e71a8,
    limit=0, discover_changed_paths=1, strict_node_history=0,
include_merged_revisions=0, revprops=0x998ba0,
    real_receiver=0x2aaaaab0dea6 <filter_log_entry_with_rangelist>,
real_receiver_baton=0x7fffffff9530, ctx=0x68ba70,
    pool=0x65a7f8) at subversion/libsvn_client/log.c:890
#19 0x00002aaaaab0e7c5 in logs_for_mergeinfo_rangelist (
    source_url=0x9e6ec8 "http://reposrv/p1/branches/branch1/work",
merge_source_fspaths=0x998bc8, filtering_merged=0, rangelist=0x9e6dc0,
oldest_revs_first=1,
    target_mergeinfo_catalog=0x9e6f80, target_fspath=0x9e6f30
"/trunk/work",
    discover_changed_paths=1, revprops=0x998ba0,
log_receiver=0x2aaaaab0a2b0 <operative_rev_receiver>,
    log_receiver_baton=0x7fffffff9a20, ctx=0x68ba70,
scratch_pool=0x65a7f8) at subversion/libsvn_client/mergeinfo.c:1559
#20 0x00002aaaaab10007 in svn_client__mergeinfo_log (finding_merged=0,
    target_path_or_url=0x68e058 "http://reposrv/p1/trunk/work",
    target_peg_revision=0x7fffffff9a40,
target_mergeinfo_catalog=0x7fffffff9a30,
    source_path_or_url=0x6957f8 "http://reposrv/p1/branches/branch1/work",
source_peg_revision=0x7fffffff9a70, source_start_revision=0x7fffffff9a60,
source_end_revision=0x7fffffff9a50,
    log_receiver=0x2aaaaab0a2b0 <operative_rev_receiver>,
log_receiver_baton=0x7fffffff9a20, discover_changed_paths=1,
    depth=svn_depth_infinity, revprops=0x998ba0, ctx=0x68ba70,
result_pool=0x65a7f8, scratch_pool=0x65a7f8)
    at subversion/libsvn_client/mergeinfo.c:2118
#21 0x00002aaaaab0a3c1 in short_circuit_mergeinfo_log
(target_mergeinfo_cat=0x7fffffff9a30, finding_merged=0,
---Type <return> to continue, or q <return> to quit---
    target_path_or_url=0x68e058 "http://reposrv/p1/trunk/work",
    target_peg_revision=0x7fffffff9a40,
    source_path_or_url=0x6957f8 "http://reposrv/p1/branches/branch1/work",
source_peg_revision=0x7fffffff9a70, source_start_revision=0x7fffffff9a60,
source_end_revision=0x7fffffff9a50,
    receiver=0x2aaaaab0a2b0 <operative_rev_receiver>,
revision=0x7fffffff9a20, ctx=0x68ba70, result_pool=0x65a7f8,
    scratch_pool=0x65a7f8) at subversion/libsvn_client/merge.c:12061
#22 0x00002aaaaab0a62c in find_last_merged_location
(base_p=0x7fffffff9b80, yca=0x6983c0, source_branch=0x68de70,
    target=0x68def0, ctx=0x68ba70, result_pool=0x65a7f8,
scratch_pool=0x65a7f8) at subversion/libsvn_client/merge.c:12190
#23 0x00002aaaaab0a789 in find_base_on_source (base_p=0x7fffffff9b80,
s_t=0x68de60, ctx=0x68ba70, result_pool=0x65a7f8,
    scratch_pool=0x65a7f8) at subversion/libsvn_client/merge.c:12248
#24 0x00002aaaaab0aae8 in find_automatic_merge (base_p=0x68dec0,
is_reintegrate_like=0x68ded8, s_t=0x68de60, ctx=0x68ba70,
    result_pool=0x65a7f8, scratch_pool=0x65a7f8) at
subversion/libsvn_client/merge.c:12334
#25 0x00002aaaaab0afc7 in client_find_automatic_merge
(merge_p=0x7fffffff9d08,
    source_path_or_url=0x68cde0 "http://reposrv/p1/branches/branch1/work",
source_revision=0x7fffffff9e00,
    target_abspath=0x68d028 "/home/mvorwerk/dev/wmerge",
allow_mixed_rev=0,
    allow_local_mods=1, allow_switched_subtrees=1, ctx=0x68ba70,
result_pool=0x65a7f8, scratch_pool=0x65a7f8)
    at subversion/libsvn_client/merge.c:12462
#26 0x00002aaaaab09a88 in svn_client_merge_peg5 (
    source_path_or_url=0x68cde0 "http://reposrv/p1/branches/branch1/work",
ranges_to_merge=0x0, source_peg_revision=0x7fffffff9e00,
target_wcpath=0x68ceb0 "", depth=svn_depth_unknown,
    ignore_mergeinfo=0, diff_ignore_ancestry=0, force_delete=0,
record_only=0, dry_run=1, allow_mixed_rev=0,
    merge_options=0x0, ctx=0x68ba70, pool=0x65a7f8) at
subversion/libsvn_client/merge.c:11818
#27 0x0000000000418763 in run_merge (two_sources_specified=0,
    sourcepath1=0x68cde0 "http://reposrv/p1/branches/branch1/work",
peg_revision1=...,
    sourcepath2=0x68cde0 "http://reposrv/p1/branches/branch1/work",
targetpath=0x68ceb0 "", ranges_to_merge=0x0, first_range_start=...,
first_range_end=..., opt_state=0x7fffffffa210,
    options=0x0, ctx=0x68ba70, scratch_pool=0x65a7f8) at
subversion/svn/merge-cmd.c:108
---Type <return> to continue, or q <return> to quit---
#28 0x0000000000419407 in svn_cl__merge (os=0x65acf0,
baton=0x7fffffffa1f0, pool=0x65a7f8)
    at subversion/svn/merge-cmd.c:434
#29 0x0000000000428ce9 in sub_main (argc=6, argv=0x7fffffffa6e8,
pool=0x65a7f8) at subversion/svn/svn.c:2878
#30 0x000000000042902d in main (argc=6, argv=0x7fffffffa6e8) at
subversion/svn/svn.c:2969
(gdb)  p ancestor_is_self
$1 = 1
(gdb)  p nearest_ancestor_mergeinfo
$2 = (svn_mergeinfo_t) 0x69bcc0
(gdb) p rangelist
$3 = (svn_rangelist_t *) 0x0
(gdb)


> And then, please try this. It's a shot in the dark. There is an obvious
> bug where the code doesn't check for nearest_ancestor_mergeinfo being
> NULL even though it could be. I threw in a NULL check for rangelist
> for good measure, apparently that's what you're hitting?
> 
> Index: subversion/libsvn_client/mergeinfo.c
> ===================================================================
> --- subversion/libsvn_client/mergeinfo.c	(revision 1519009)
> +++ subversion/libsvn_client/mergeinfo.c	(working copy)
> @@ -1405,17 +1405,21 @@ filter_log_entry_with_rangelist(void *baton,
>               obviously back.  If it was added or replaced it's still
>               around
>               possibly it was replaced one or more times, but it's back
>               now.
>               Regardless, LOG_ENTRY->REVISION is *not* an eligible
>               revision! */
> -          if (ancestor_is_self /* Explicit mergeinfo on
> TARGET_PATH_AFFECTED */
> +          if (nearest_ancestor_mergeinfo &&
> +              ancestor_is_self /* Explicit mergeinfo on
> TARGET_PATH_AFFECTED */
>                && (change->action != 'M'))
>              {
>                svn_rangelist_t *rangelist =
>                    svn_hash_gets(nearest_ancestor_mergeinfo, path);
> -              svn_merge_range_t *youngest_range = APR_ARRAY_IDX(
> -                rangelist, rangelist->nelts - 1, svn_merge_range_t *);
> +              if (rangelist)
> +                {
> +                  svn_merge_range_t *youngest_range = APR_ARRAY_IDX(
> +                    rangelist, rangelist->nelts - 1, svn_merge_range_t
*);
>  
> -              if (youngest_range
> -                  && (youngest_range->end > log_entry->revision))
> -                continue;
> +                  if (youngest_range
> +                      && (youngest_range->end > log_entry->revision))
> +                    continue;
> +                }
>              }
>  
>            if (nearest_ancestor_mergeinfo)

I applied that patch - and it worked! No segmentation fault with this
version.

Matthias


Re: svn 1.8.1: segmentation fault on merge

Posted by Stefan Sperling <st...@elego.de>.
On Tue, Sep 03, 2013 at 06:06:46PM +0200, Matthias Vorwerk wrote:
> 
> I encountered the same problem with subversion-1.8.3
> (CentOS5, httpd-2.4.6):
> svn merge ends with sengmentation fault.
> 
> I re-compiled svn with the  --enable-maintainer-mode configure option.
> 
> Here is what I get:
> ---------------------------------
> % libtool --mode=execute  gdb --args /opt/local/bin/bin/svn merge
> --non-interactive --dry-run http://reposrv/p1/branches/branch1/work .
> /usr/bin/libtool: line 6823: LC_ALL: command not found
> /usr/bin/libtool: line 6823: LC_CTYPE: command not found
> /usr/bin/libtool: line 6823: LC_COLLATE: command not found
> /usr/bin/libtool: line 6823: LC_MESSAGES: command not found
> GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-37.el5)
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-redhat-linux-gnu".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>...
> Reading symbols from /opt/local/bin/bin/svn...done.
> (gdb) r
> Starting program: /opt/local/bin/bin/svn merge --non-interactive --dry-run
> http://reposrv/p1/branches/branch1/work .
> [Thread debugging using libthread_db enabled]
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00002aaaaab0e2db in filter_log_entry_with_rangelist
> (baton=0x7fffffff9530, log_entry=0x9c2510, pool=0x9c2498)
>     at subversion/libsvn_client/mergeinfo.c:1399
> 1399                  svn_merge_range_t *youngest_range = APR_ARRAY_IDX(
> (gdb)

Can you show us what these gdb commands print here, please?

  bt
  p ancestor_is_self
  p nearest_ancestor_mergeinfo
  p rangelist

Thanks!

And then, please try this. It's a shot in the dark. There is an obvious
bug where the code doesn't check for nearest_ancestor_mergeinfo being
NULL even though it could be. I threw in a NULL check for rangelist
for good measure, apparently that's what you're hitting?

Index: subversion/libsvn_client/mergeinfo.c
===================================================================
--- subversion/libsvn_client/mergeinfo.c	(revision 1519009)
+++ subversion/libsvn_client/mergeinfo.c	(working copy)
@@ -1405,17 +1405,21 @@ filter_log_entry_with_rangelist(void *baton,
              obviously back.  If it was added or replaced it's still around
              possibly it was replaced one or more times, but it's back now.
              Regardless, LOG_ENTRY->REVISION is *not* an eligible revision! */
-          if (ancestor_is_self /* Explicit mergeinfo on TARGET_PATH_AFFECTED */
+          if (nearest_ancestor_mergeinfo &&
+              ancestor_is_self /* Explicit mergeinfo on TARGET_PATH_AFFECTED */
               && (change->action != 'M'))
             {
               svn_rangelist_t *rangelist =
                   svn_hash_gets(nearest_ancestor_mergeinfo, path);
-              svn_merge_range_t *youngest_range = APR_ARRAY_IDX(
-                rangelist, rangelist->nelts - 1, svn_merge_range_t *);
+              if (rangelist)
+                {
+                  svn_merge_range_t *youngest_range = APR_ARRAY_IDX(
+                    rangelist, rangelist->nelts - 1, svn_merge_range_t *);
 
-              if (youngest_range
-                  && (youngest_range->end > log_entry->revision))
-                continue;
+                  if (youngest_range
+                      && (youngest_range->end > log_entry->revision))
+                    continue;
+                }
             }
 
           if (nearest_ancestor_mergeinfo)