You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Berlin <db...@dberlin.org> on 2005/02/14 21:59:06 UTC

[PATCH]: Fix issue 2218

Greg Hudson was right, we need a subpool when performing the check to
verify that a patch we are going to try to delete actually exists.

This fixes issue 2218

Fix issue #2218

* subversion/libsvn_client/delete.c (delete_urls): Use subpool
to verify target exists, and clear in between iterations.



Re: [PATCH]: Fix issue 2218

Posted by kf...@collab.net.
kfogel@collab.net writes:
> > Index: subversion/libsvn_client/delete.c
> > ===================================================================
> > --- subversion/libsvn_client/delete.c	(revision 13016)
> > +++ subversion/libsvn_client/delete.c	(working copy)
> > @@ -124,6 +124,7 @@
> >    svn_error_t *err;
> >    const char *common;
> >    int i;
> > +  apr_pool_t *subpool = svn_pool_create (pool);
> >  
> >    /* Condense our list of deletion targets. */
> >    SVN_ERR (svn_path_condense_targets (&common, &targets, paths, TRUE, pool));
> > @@ -170,16 +171,17 @@
> >    for (i = 0; i < targets->nelts; i++)
> >      {
> >        const char *path = APR_ARRAY_IDX (targets, i, const char *);
> > +      svn_pool_clear (subpool);
> >        path = svn_path_uri_decode (path, pool);
> >        APR_ARRAY_IDX (targets, i, const char *) = path;
> >        SVN_ERR (svn_ra_check_path (ra_session, path, SVN_INVALID_REVNUM,
> > -                                  &kind, pool));
> > +                                  &kind, subpool));
> >        if (kind == svn_node_none)
> >          return svn_error_createf (SVN_ERR_FS_NOT_FOUND, NULL,
> >                                    "URL '%s' does not exist",
> >                                    svn_path_local_style (path, pool));
> >      }
> > -
> > +  svn_pool_destroy (subpool);
> >    /* Fetch RA commit editor */
> >    SVN_ERR (svn_client__commit_get_baton (&commit_baton, commit_info, pool));
> >    SVN_ERR (svn_ra_get_commit_editor (ra_session, &editor, &edit_baton,
> 
> Why not use the same subpool in the svn_path_uri_decode() call too?

Daniel answered my question in IRC: because path is saved in the
targets array, thus used later outside the loop.


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

Re: [PATCH]: Fix issue 2218

Posted by Daniel Berlin <db...@dberlin.org>.
On Mon, 2005-02-14 at 18:05 -0600, kfogel@collab.net wrote:
> Daniel Berlin <db...@dberlin.org> writes:
> > Fix issue #2218
> > 
> > * subversion/libsvn_client/delete.c (delete_urls): Use subpool
> > to verify target exists, and clear in between iterations.
> 
> Looks good, just one question:
> 
> > Index: subversion/libsvn_client/delete.c
> > ===================================================================
> > --- subversion/libsvn_client/delete.c	(revision 13016)
> > +++ subversion/libsvn_client/delete.c	(working copy)
> > @@ -124,6 +124,7 @@
> >    svn_error_t *err;
> >    const char *common;
> >    int i;
> > +  apr_pool_t *subpool = svn_pool_create (pool);
> >  
> >    /* Condense our list of deletion targets. */
> >    SVN_ERR (svn_path_condense_targets (&common, &targets, paths, TRUE, pool));
> > @@ -170,16 +171,17 @@
> >    for (i = 0; i < targets->nelts; i++)
> >      {
> >        const char *path = APR_ARRAY_IDX (targets, i, const char *);
> > +      svn_pool_clear (subpool);
> >        path = svn_path_uri_decode (path, pool);
> >        APR_ARRAY_IDX (targets, i, const char *) = path;
> >        SVN_ERR (svn_ra_check_path (ra_session, path, SVN_INVALID_REVNUM,
> > -                                  &kind, pool));
> > +                                  &kind, subpool));
> >        if (kind == svn_node_none)
> >          return svn_error_createf (SVN_ERR_FS_NOT_FOUND, NULL,
> >                                    "URL '%s' does not exist",
> >                                    svn_path_local_style (path, pool));
> >      }
> > -
> > +  svn_pool_destroy (subpool);
> >    /* Fetch RA commit editor */
> >    SVN_ERR (svn_client__commit_get_baton (&commit_baton, commit_info, pool));
> >    SVN_ERR (svn_ra_get_commit_editor (ra_session, &editor, &edit_baton,
> 
> Why not use the same subpool in the svn_path_uri_decode() call too?

Because of:
>        APR_ARRAY_IDX (targets, i, const char *) = path;
We use targets array later on.
If you put the uri in the pool, then we clear the pool, and suddenly the
paths in the array are garbage :)


> 
> -Karl


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

Re: [PATCH]: Fix issue 2218

Posted by kf...@collab.net.
Daniel Berlin <db...@dberlin.org> writes:
> Fix issue #2218
> 
> * subversion/libsvn_client/delete.c (delete_urls): Use subpool
> to verify target exists, and clear in between iterations.

Looks good, just one question:

> Index: subversion/libsvn_client/delete.c
> ===================================================================
> --- subversion/libsvn_client/delete.c	(revision 13016)
> +++ subversion/libsvn_client/delete.c	(working copy)
> @@ -124,6 +124,7 @@
>    svn_error_t *err;
>    const char *common;
>    int i;
> +  apr_pool_t *subpool = svn_pool_create (pool);
>  
>    /* Condense our list of deletion targets. */
>    SVN_ERR (svn_path_condense_targets (&common, &targets, paths, TRUE, pool));
> @@ -170,16 +171,17 @@
>    for (i = 0; i < targets->nelts; i++)
>      {
>        const char *path = APR_ARRAY_IDX (targets, i, const char *);
> +      svn_pool_clear (subpool);
>        path = svn_path_uri_decode (path, pool);
>        APR_ARRAY_IDX (targets, i, const char *) = path;
>        SVN_ERR (svn_ra_check_path (ra_session, path, SVN_INVALID_REVNUM,
> -                                  &kind, pool));
> +                                  &kind, subpool));
>        if (kind == svn_node_none)
>          return svn_error_createf (SVN_ERR_FS_NOT_FOUND, NULL,
>                                    "URL '%s' does not exist",
>                                    svn_path_local_style (path, pool));
>      }
> -
> +  svn_pool_destroy (subpool);
>    /* Fetch RA commit editor */
>    SVN_ERR (svn_client__commit_get_baton (&commit_baton, commit_info, pool));
>    SVN_ERR (svn_ra_get_commit_editor (ra_session, &editor, &edit_baton,

Why not use the same subpool in the svn_path_uri_decode() call too?

-Karl

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