subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From phi...@apache.org
Subject svn commit: r1327979 - in /subversion/trunk/subversion: include/private/svn_repos_private.h libsvn_fs/fs-loader.c libsvn_repos/fs-wrap.c mod_dav_svn/repos.c
Date Thu, 19 Apr 2012 15:02:18 GMT
Author: philip
Date: Thu Apr 19 15:02:17 2012
New Revision: 1327979

URL: http://svn.apache.org/viewvc?rev=1327979&view=rev
Log:
Disallow opening BDB repositories when running Apache's event MPM
as the two don't play well together, see issue 4157.

* src/subversion/mod_dav_svn/repos.c
  (): Add includes.
  (get_resource): Disallow BDB/event.

* subversion/libsvn_fs/fs-loader.c
  (svn_fs_type): Return an error if the directory does not exist.

* subversion/include/private/svn_repos_private.h
* subversion/libsvn_repos/fs-wrap.c
  (svn_repos__fs_type): New.

Modified:
    subversion/trunk/subversion/include/private/svn_repos_private.h
    subversion/trunk/subversion/libsvn_fs/fs-loader.c
    subversion/trunk/subversion/libsvn_repos/fs-wrap.c
    subversion/trunk/subversion/mod_dav_svn/repos.c

Modified: subversion/trunk/subversion/include/private/svn_repos_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_repos_private.h?rev=1327979&r1=1327978&r2=1327979&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_repos_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_repos_private.h Thu Apr 19 15:02:17 2012
@@ -81,6 +81,12 @@ const char *
 svn_repos__post_commit_error_str(svn_error_t *err,
                                  apr_pool_t *pool);
 
+/* A repos version of svn_fs_type */
+svn_error_t *
+svn_repos__fs_type(const char **fs_type,
+                   const char *repos_path,
+                   apr_pool_t *pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/trunk/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs/fs-loader.c?rev=1327979&r1=1327978&r2=1327979&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/trunk/subversion/libsvn_fs/fs-loader.c Thu Apr 19 15:02:17 2012
@@ -199,14 +199,27 @@ svn_fs_type(const char **fs_type, const 
   apr_size_t len;
 
   /* Read the fsap-name file to get the FSAP name, or assume the (old)
-     default. */
+     default.  For old repositories I suppose we could check some
+     other file, DB_CONFIG or strings say, but for now just check the
+     directory exists. */
   filename = svn_dirent_join(path, FS_TYPE_FILENAME, pool);
   err = svn_io_file_open(&file, filename, APR_READ|APR_BUFFERED, 0, pool);
   if (err && APR_STATUS_IS_ENOENT(err->apr_err))
     {
-      svn_error_clear(err);
-      *fs_type = apr_pstrdup(pool, SVN_FS_TYPE_BDB);
-      return SVN_NO_ERROR;
+      svn_node_kind_t kind;
+      svn_error_t *err2 = svn_io_check_path(path, &kind, pool);
+      if (err2)
+        {
+          svn_error_clear(err2);
+          return err;
+        }
+      if (kind == svn_node_dir)
+        {
+          svn_error_clear(err);
+          *fs_type = apr_pstrdup(pool, SVN_FS_TYPE_BDB);
+          return SVN_NO_ERROR;
+        }
+      return err;
     }
   else if (err)
     return err;

Modified: subversion/trunk/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/fs-wrap.c?rev=1327979&r1=1327978&r2=1327979&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/trunk/subversion/libsvn_repos/fs-wrap.c Thu Apr 19 15:02:17 2012
@@ -740,6 +740,15 @@ svn_repos_fs_pack2(svn_repos_t *repos,
                      cancel_func, cancel_baton, pool);
 }
 
+svn_error_t *
+svn_repos__fs_type(const char **fs_type,
+                   const char *repos_path,
+                   apr_pool_t *pool)
+{
+  return svn_fs_type(fs_type,
+                     svn_dirent_join(repos_path, SVN_REPOS__DB_DIR, pool),
+                     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=1327979&r1=1327978&r2=1327979&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Thu Apr 19 15:02:17 2012
@@ -34,6 +34,9 @@
 #include <http_core.h>  /* for ap_construct_url */
 #include <mod_dav.h>
 
+#define CORE_PRIVATE      /* To make ap_show_mpm public in 2.2 */
+#include <http_config.h>
+
 #include "svn_types.h"
 #include "svn_pools.h"
 #include "svn_error.h"
@@ -50,6 +53,7 @@
 #include "svn_dirent_uri.h"
 #include "private/svn_log.h"
 #include "private/svn_fspath.h"
+#include "private/svn_repos_private.h"
 
 #include "dav_svn.h"
 
@@ -2144,6 +2148,8 @@ get_resource(request_rec *r,
   repos->repos = userdata;
   if (repos->repos == NULL)
     {
+      const char *fs_type;
+
       /* construct FS configuration parameters */
       fs_config = apr_hash_make(r->connection->pool);
       apr_hash_set(fs_config,
@@ -2159,9 +2165,24 @@ get_resource(request_rec *r,
                    APR_HASH_KEY_STRING,
                    dav_svn__get_revprop_cache_flag(r) ? "1" : "0");
 
+      /* Disallow BDB/event until issue 4157 is fixed. */
+      serr = svn_repos__fs_type(&fs_type, fs_path, r->connection->pool);
+      if (serr)
+        {
+          /* svn_repos_open2 is going to fail, use that error. */
+          svn_error_clear(serr);
+          serr = NULL;
+        }
+      else if (!strcmp(fs_type, "bdb") && !strcmp(ap_show_mpm(), "event"))
+        serr = svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+                                 "BDB repository at '%s' is not compatible "
+                                 "with event MPM",
+                                 fs_path);
+
       /* open the FS */
-      serr = svn_repos_open2(&(repos->repos), fs_path, fs_config,
-                             r->connection->pool);
+      if (!serr)
+        serr = svn_repos_open2(&(repos->repos), fs_path, fs_config,
+                               r->connection->pool);
       if (serr != NULL)
         {
           /* The error returned by svn_repos_open2 might contain the



Mime
View raw message