[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [BUG] svnsync segfault

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Fri, 22 Jul 2011 11:58:09 +0300

Daniel Shahaf wrote on Fri, Jul 22, 2011 at 11:33:45 +0300:
> Greg pointed that earlier on IRC. I'm so far at:
>

Updated patch:

[[[
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 1149353)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -2489,10 +2491,17 @@ svn_io_start_cmd2(apr_proc_t *cmd_proc,
 
   /* Forward request for pipes to APR. */
   if (infile_pipe || outfile_pipe || errfile_pipe)
- apr_procattr_io_set(cmdproc_attr,
- infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
- outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
- errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
+ {
+ apr_err = apr_procattr_io_set(cmdproc_attr,
+ infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
+ outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
+ errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
+
+ if (apr_err)
+ return svn_error_wrap_apr(apr_err,
+ _("Can't set process '%s' stdio pipes"),
+ cmd);
+ }
 
   /* Have the child print any problems executing its program to errfile. */
   apr_err = apr_pool_userdata_set(errfile, ERRFILE_KEY, NULL, pool);
Index: subversion/libsvn_repos/hooks.c
===================================================================
--- subversion/libsvn_repos/hooks.c (revision 1149353)
+++ subversion/libsvn_repos/hooks.c (working copy)
@@ -202,7 +202,8 @@ run_hook_cmd(svn_string_t **result,
 
   if (err)
     {
- err = svn_error_createf
+ /* CMD_PROC is not safe to use. Bail. */
+ return svn_error_createf
         (SVN_ERR_REPOS_HOOK_FAILURE, err, _("Failed to start '%s' hook"), cmd);
     }
   else
]]]

(ie, theory is that the local variable CMD_PROC was used uninitialized)

Generates this error chain:
[[[
subversion/svnsync/main.c:1382: (apr_err=165001)
subversion/svnsync/main.c:1328: (apr_err=165001)
subversion/libsvn_ra_serf/replay.c:874: (apr_err=165001)
subversion/libsvn_ra_serf/util.c:2049: (apr_err=165001)
subversion/libsvn_ra_serf/util.c:2049: (apr_err=165001)
subversion/libsvn_ra_serf/util.c:1790: (apr_err=165001)
subversion/libsvn_ra_serf/util.c:1492: (apr_err=165001)
subversion/libsvn_ra_serf/replay.c:492: (apr_err=165001)
subversion/svnsync/main.c:1169: (apr_err=165001)
subversion/svnsync/main.c:570: (apr_err=165001)
subversion/libsvn_repos/fs-wrap.c:353: (apr_err=165001)
subversion/libsvn_repos/hooks.c:518: (apr_err=165001)
subversion/libsvn_repos/hooks.c:206: (apr_err=165001)
svnsync: E165001: Failed to start '/tmp/svn/r1/hooks/pre-revprop-change' hook
subversion/libsvn_subr/io.c:2502: (apr_err=24)
svnsync: E000024: Can't set process '/tmp/svn/r1/hooks/pre-revprop-change' stdio pipes: Too many open files
subversion/libsvn_ra/util.c:108: (apr_err=165001)
subversion/libsvn_repos/fs-wrap.c:353: (apr_err=165001)
subversion/libsvn_repos/hooks.c:518: (apr_err=165001)
subversion/libsvn_repos/hooks.c:206: (apr_err=165001)
svnsync: E165001: Failed to start '/tmp/svn/r1/hooks/pre-revprop-change' hook
subversion/libsvn_subr/io.c:2502: (apr_err=24)
svnsync: E000024: Can't set process '/tmp/svn/r1/hooks/pre-revprop-change' stdio pipes: Too many open files

Program exited with code 01.
]]]

>
> Lieven Govaerts wrote on Fri, Jul 22, 2011 at 10:16:07 +0200:
> > Hi,
> >
> > when syncing the first ~200 revisions from the asf repository over
> > ra_serf to ra_local, svnsync segfaults when invoking the
> > pre-revprop-change hook of the local target repo.
> >
> > Not really at home in this part of the code, so if anyone can point me
> > in the right direction that would be appreciated.
> >
> > Lieven
> >
> >
> > #0 0x00000001006b7d04 in apr_file_name_get ()
> > #1 0x000000010051ce29 in stringbuf_from_aprfile
> > (result=0x7fff5fbfe7b0, filename=0x0, file=0x0, check_size=1,
> > pool=0x104541028) at subversion/libsvn_subr/io.c:2027
> > #2 0x000000010051d18a in svn_stringbuf_from_aprfile
> > (result=0x7fff5fbfe7b0, file=0x0, pool=0x104541028) at
> > subversion/libsvn_subr/io.c:2106
> > #3 0x000000010003bfc4 in check_hook_result (name=0x100054eaa
> > "pre-revprop-change", cmd=0x104541438
> > "/tmp/asfrepo/hooks/pre-revprop-change", cmd_proc=0x7fff5fbfe860,
> > read_errhandle=0x0, pool=0x104541028) at
> > subversion/libsvn_repos/hooks.c:71
> > #4 0x000000010003c47f in run_hook_cmd (result=0x0, name=0x100054eaa
> > "pre-revprop-change", cmd=0x104541438
> > "/tmp/asfrepo/hooks/pre-revprop-change", args=0x7fff5fbfe900,
> > stdin_handle=0x104541548, pool=0x104541028) at
> > subversion/libsvn_repos/hooks.c:210
> > #5 0x000000010003d057 in svn_repos__hooks_pre_revprop_change
> > (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
> > name=0x1044e61d8 "svn:author", new_value=0x104555040, action=77 'M',
> > pool=0x104541028) at subversion/libsvn_repos/hooks.c:516
> > #6 0x000000010003aecf in svn_repos_fs_change_rev_prop4
> > (repos=0x10107e590, rev=199, author=0x101095c08 "lgo",
> > name=0x1044e61d8 "svn:author", old_value_p=0x0, new_value=0x104555040,
> > use_pre_revprop_change_hook=1, use_post_revprop_change_hook=1,
> > authz_read_func=0, authz_read_baton=0x0, pool=0x104541028) at
> > subversion/libsvn_repos/fs-wrap.c:352
> > #7 0x000000010002350a in svn_ra_local__change_rev_prop
> > (session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
> > old_value_p=0x0, value=0x104555040, pool=0x104541028) at
> > subversion/libsvn_ra_local/ra_plugin.c:587
> > #8 0x00000001000164b8 in svn_ra_change_rev_prop2
> > (session=0x10107e4c8, rev=199, name=0x1044e61d8 "svn:author",
> > old_value_p=0x0, value=0x104555040, pool=0x104541028) at
> > subversion/libsvn_ra/ra_loader.c:661
> > #9 0x000000010000162b in write_revprops
> > (filtered_count=0x7fff5fbfec5c, session=0x10107e4c8, rev=199,
> > rev_props=0x10454a438, pool=0x10454a028) at
> > subversion/svnsync/main.c:569
> > #10 0x0000000100002f93 in replay_rev_finished (revision=199,
> > replay_baton=0x10282b5f0, editor=0x103bda7a0, edit_baton=0x103bda820,
> > rev_props=0x1044e60a0, pool=0x1044e6028) at
> > subversion/svnsync/main.c:1168
> > #11 0x0000000100168abf in end_replay (parser=0x103d77a38,
> > userData=0x103d776a0, name={namespace = 0x103d716c0 "svn:", name =
> > 0x1009042e2 "editor-report"}) at
> > subversion/libsvn_ra_serf/replay.c:489
Received on 2011-07-22 10:59:29 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.