You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Russell Yanofsky <re...@columbia.edu> on 2003/07/25 14:38:48 UTC

[PATCH] python bindings bugfix for svn_repos_get_logs (resend, issue 1387)

This is a trivial 3-line fix for the python bindings. Several ViewCVS users have
reported errors caused by this bug:

  http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=270792
  http://mailman.lyra.org/pipermail/viewcvs/2003q3/002073.html
  http://mailman.lyra.org/pipermail/viewcvs-dev/2003-July/001082.html

And one user who applied the patch himself confirmed that it fixed the problem:

  http://mailman.lyra.org/pipermail/viewcvs/2003q3/002082.html

Can someone commit this?

- Russ


Log Message:

Bugfix for the python bindings. svn_repos_get_logs() causes a crash
when its "discover_changed_paths" argument is nonzero because the
thunk, svn_swig_py_thunk_log_receiver(), that forwards to a user
defined python callback function is unable to find a swig type
corresponding to the svn_log_changed_path_t structs that it has to
pass to the callback.

* subversion/bindings/swig/swigutil_py.c
  (svn_swig_py_thunk_log_receiver): changed argument to
  SWIG_TypeQuery for "svn_log_changed_path_t" type

* subversion/bindings/swig/core.i: exposed "svn_log_changed_path_t"
  type

Re: [PATCH] python bindings bugfix for svn_repos_get_logs (resend, issue 1387)

Posted by Russell Yanofsky <re...@columbia.edu>.
cmpilato@collab.net wrote:
> "Russell Yanofsky" <re...@columbia.edu> writes:
>
>> The immutable marker just prevents users from assigning their own
>> values to that member so there can't be any leaks.
>
> Sounds great -- thanks for explaining.  Would you mind (if you have
> the time) giving the rest of our bindings code a once-over to see if
> we need such a restriction placed on other class members?

A patch is attached that places the same restriction on other const char *
members. I didn't look over the bindings code, just dealt with swig warning
messages.

Log Message:

Prevent users of swig bindings from assigning to const char * struct members so
there won't be any memory leaks.

* subversion/bindings/swig/core.i: made struct members which cause
"Warning(451): Setting const
   char * member may leak memory" immutable.



Re: [PATCH] python bindings bugfix for svn_repos_get_logs (resend, issue 1387)

Posted by cm...@collab.net.
"Russell Yanofsky" <re...@columbia.edu> writes:

> The immutable marker just prevents users from assigning their own
> values to that member so there can't be any leaks.

Sounds great -- thanks for explaining.  Would you mind (if you have
the time) giving the rest of our bindings code a once-over to see if
we need such a restriction placed on other class members?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] python bindings bugfix for svn_repos_get_logs (resend, issue 1387)

Posted by Russell Yanofsky <re...@columbia.edu>.
cmpilato@collab.net wrote:
> "Russell Yanofsky" <re...@columbia.edu> writes:
>
> > This is a trivial 3-line fix for the python bindings.
>
> Committed in revision 6579, though I'm not sure I understand
> the need for the 'immutable' marker. That string should be
> allocated from the pool, right? So clearing or destroying
> the pool would de-alloc the copyfrom_path. What am I
> mis-logic-ifying?

When subversion assigns a string to svn_log_changed_path_t::copyfrom_path, it
doesn't need to be freed since it is allocated in the pool. But if a python user
assigned a string to that member, the string would be allocated on the heap and
would need to be freed in order to prevent a memory leak. The immutable marker
just prevents users from assigning their own values to that member so there
can't be any leaks.

- Russ



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] python bindings bugfix for svn_repos_get_logs (resend, issue 1387)

Posted by cm...@collab.net.
"Russell Yanofsky" <re...@columbia.edu> writes:

> This is a trivial 3-line fix for the python bindings. 

Committed in revision 6579, though I'm not sure I understand the need
for the 'immutable' marker.  That string should be allocated from the
pool, right?  So clearing or destroying the pool would de-alloc the
copyfrom_path.  What am I mis-logic-ifying?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org