Subject: | Documentation bugs lead to segfault |
Date: | Mon, 17 Dec 2007 23:43:59 -0800 |
To: | bug-Alien-SVN [...] rt.cpan.org |
From: | Phil Dibowitz <phil [...] ipom.com> |
I have 3 bugs to report on the documentation for SVN::Repos - the first of
which leads to a segfault.
BUG #1
The SYNOPSIS section for SVN::Delta claims you can pass in "undef" as the
3rd argument to SVN::Repos::dir_delta(). However, this isn't true. The 3rd
argument, if 'undef', is then passed as NULL to the SVN API, which then
attempts to deref this as a string pointer to concatenate it with arg2,
causing a deref of NULL and a segmentation fault.
BUG #2
Further, the SYNOPSIS shows 10 arguments passed into dir_delta(), but you
MUST pass in 11 or 12:
svn_repos.c:
if ((items < 11) || (items > 12)) {
SWIG_croak("Usage:
svn_repos_dir_delta(src_root,src_parent_dir,src_entry,tgt_root,tgt_path,editor,edit_baton,authz_read_func,authz_read_baton,text_deltas,recurse,entry_props,ignore_ancestry,pool);");
}
The argument missing isn't the last one, either... a authzcb_baton must be
passed in as the 7th argument, after the Editor, but before the flags.
Further, the documentation doesn't mention that the authzcb_baton is
actually another authzcb that the SVN::Repos callback will call as an
additional callback, but this seems to be the case from the code.
BUG #3
And finally, the documentation does not close the function leading the
reader to wonder if there are other arguments. It should probably look like
this:
# note, one additional argument may be passed in if you'd like
# to specify an APR pool directly.
SVN::Repos::dir_delta($root1, $path, '',
$root2, $path,
SVN::Delta::Editor->new(_debug=>1),
undef,
1, 1, 0, 1);
I hope that helps.
--
Phil Dibowitz phil@ipom.com
Open Source software and tech docs Insanity Palace of Metallica
http://www.phildev.net/ http://www.ipom.com/
"Never write it in C if you can do it in 'awk';
Never do it in 'awk' if 'sed' can handle it;
Never use 'sed' when 'tr' can do the job;
Never invoke 'tr' when 'cat' is sufficient;
Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming
Message body not shown because it is not plain text.