subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r1464070 - in /subversion/trunk/subversion: include/svn_repos.h libsvn_ra_local/split_url.c libsvn_repos/repos.c libsvn_repos/repos.h mod_dav_svn/repos.c svnserve/serve.c
Date Wed, 03 Apr 2013 15:29:18 GMT
Author: cmpilato
Date: Wed Apr  3 15:29:18 2013
New Revision: 1464070

URL: http://svn.apache.org/r1464070
Log:
Avoid an unenforceable API restriction.  Add a 'pool' to svn_repos_t,
and use it in svn_repos_hooks_setenv().  This way, callers *can't* not
use the same pool as the one from which the svn_repos_t was allocated,
and thus can't violate the previously stated restriction.

* subversion/libsvn_repos/repos.h
  (svn_repos_t): Add 'pool' member.

* subversion/include/svn_repos.h
  (svn_repos_hooks_setenv): Lose 'result_pool' parameter.

* subversion/libsvn_repos/repos.c
  (svn_repos_hooks_setenv): Lose 'result_pool' parameter.  Use,
    instead, the new repos->pool instead.
  (create_svn_repos_t): Initialize new 'pool' structure member.

* subversion/libsvn_ra_local/split_url.c
  (svn_ra_local__split_URL): Update call to svn_repos_hooks_setenv().

* subversion/svnserve/serve.c
  (find_repos): Update call to svn_repos_hooks_setenv().

* subversion/mod_dav_svn/repos.c
  (get_resource): Update call to svn_repos_hooks_setenv().

Modified:
    subversion/trunk/subversion/include/svn_repos.h
    subversion/trunk/subversion/libsvn_ra_local/split_url.c
    subversion/trunk/subversion/libsvn_repos/repos.c
    subversion/trunk/subversion/libsvn_repos/repos.h
    subversion/trunk/subversion/mod_dav_svn/repos.c
    subversion/trunk/subversion/svnserve/serve.c

Modified: subversion/trunk/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1464070&r1=1464069&r2=1464070&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_repos.h (original)
+++ subversion/trunk/subversion/include/svn_repos.h Wed Apr  3 15:29:18 2013
@@ -790,8 +790,7 @@ svn_repos_post_unlock_hook(svn_repos_t *
  * file in its default location within the repository disk structure.
  * If @a hooks_env_path is not absolute, it specifies a path relative
  * to the parent of the file's default location.
- *
- * @a result_pool should be the same pool that @a repos was allocated in.
+ * 
  * Use @a scratch_pool for temporary allocations.
  *
  * If this function is not called, or if the specified configuration
@@ -803,7 +802,6 @@ svn_repos_post_unlock_hook(svn_repos_t *
 svn_error_t *
 svn_repos_hooks_setenv(svn_repos_t *repos,
                        const char *hooks_env_path,
-                       apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool);
 
 /** @} */

Modified: subversion/trunk/subversion/libsvn_ra_local/split_url.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_local/split_url.c?rev=1464070&r1=1464069&r2=1464070&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_local/split_url.c (original)
+++ subversion/trunk/subversion/libsvn_ra_local/split_url.c Wed Apr  3 15:29:18 2013
@@ -73,7 +73,7 @@ svn_ra_local__split_URL(svn_repos_t **re
                                            pool));
 
   /* Configure hook script environment variables. */
-  SVN_ERR(svn_repos_hooks_setenv(*repos, NULL, pool, pool));
+  SVN_ERR(svn_repos_hooks_setenv(*repos, NULL, pool));
 
   return SVN_NO_ERROR;
 }

Modified: subversion/trunk/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos.c?rev=1464070&r1=1464069&r2=1464070&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/repos.c (original)
+++ subversion/trunk/subversion/libsvn_repos/repos.c Wed Apr  3 15:29:18 2013
@@ -1167,15 +1167,16 @@ create_conf(svn_repos_t *repos, apr_pool
 svn_error_t *
 svn_repos_hooks_setenv(svn_repos_t *repos,
                        const char *hooks_env_path,
-                       apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
 {
   if (hooks_env_path == NULL)
     repos->hooks_env_path = svn_dirent_join(repos->conf_path,
-                                            SVN_REPOS__CONF_HOOKS_ENV, result_pool);
+                                            SVN_REPOS__CONF_HOOKS_ENV,
+                                            repos->pool);
   else if (!svn_dirent_is_absolute(hooks_env_path))
-    repos->hooks_env_path = svn_dirent_join(repos->conf_path, hooks_env_path,
-                                            result_pool);
+    repos->hooks_env_path = svn_dirent_join(repos->conf_path,
+                                            hooks_env_path,
+                                            repos->pool);
 
   return SVN_NO_ERROR;
 }
@@ -1197,6 +1198,7 @@ create_svn_repos_t(const char *path, apr
   repos->lock_path = svn_dirent_join(path, SVN_REPOS__LOCK_DIR, pool);
   repos->hooks_env_path = NULL;
   repos->repository_capabilities = apr_hash_make(pool);
+  repos->pool = pool;
 
   return repos;
 }

Modified: subversion/trunk/subversion/libsvn_repos/repos.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos.h?rev=1464070&r1=1464069&r2=1464070&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/repos.h (original)
+++ subversion/trunk/subversion/libsvn_repos/repos.h Wed Apr  3 15:29:18 2013
@@ -150,6 +150,12 @@ struct svn_repos_t
      sufficiently well-informed internal code may just compare against
      those constants' addresses, therefore). */
   apr_hash_t *repository_capabilities;
+
+  /* Pool from which this structure was allocated.  Also used for
+     auxiliary repository-related data that requires a matching
+     lifespan.  (As the svn_repos_t structure tends to be relatively
+     long-lived, please be careful regarding this pool's usage.)  */
+  apr_pool_t *pool;
 };
 
 

Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1464070&r1=1464069&r2=1464070&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Wed Apr  3 15:29:18 2013
@@ -2219,7 +2219,7 @@ get_resource(request_rec *r,
 
       /* Configure hook script environment variables. */
       serr = svn_repos_hooks_setenv(repos->repos, dav_svn__get_hooks_env(r),
-                                    r->connection->pool, r->pool);
+                                    r->pool);
       if (serr)
         return dav_svn__sanitize_error(serr,
                                        "Error settings hooks environment",

Modified: subversion/trunk/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/serve.c?rev=1464070&r1=1464069&r2=1464070&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/serve.c (original)
+++ subversion/trunk/subversion/svnserve/serve.c Wed Apr  3 15:29:18 2013
@@ -3328,7 +3328,7 @@ static svn_error_t *find_repos(const cha
                  SVN_CONFIG_OPTION_HOOKS_ENV, NULL);
   if (hooks_env)
     hooks_env = svn_dirent_internal_style(hooks_env, pool);
-  SVN_ERR(svn_repos_hooks_setenv(b->repos, hooks_env, pool, pool));
+  SVN_ERR(svn_repos_hooks_setenv(b->repos, hooks_env, pool));
 
   return SVN_NO_ERROR;
 }



Mime
View raw message