[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Set permissions on new fsfs shard dirs

From: Peter Samuelson <peter_at_p12n.org>
Date: Tue, 29 Jul 2008 16:54:56 -0500

This one seems fairly obvious, but I'm new to the game, so I'm posting before I commit.

-- 
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/
[[[
When creating a new fsfs shard directory (revs/N, revprops/N), set its
permissions correctly.
* subversion/libsvn_fs_fs/fs_fs.c
  (svn_fs_fs__hotcopy): Set permissions of a shard dir in revs/ and
    revprops/ after creating it.
  (commit_body): Ditto.
]]]
Index: subversion/libsvn_fs_fs/fs_fs.c
===================================================================
--- subversion/libsvn_fs_fs/fs_fs.c	(revision 32329)
+++ subversion/libsvn_fs_fs/fs_fs.c	(working copy)
@@ -1323,9 +1323,12 @@
           src_subdir_shard = svn_path_join(src_subdir, shard, iterpool);
           dst_subdir_shard = svn_path_join(dst_subdir, shard, iterpool);
 
-          if (rev % max_files_per_dir == 0)
+          if (rev % max_files_per_dir == 0) {
             SVN_ERR(svn_io_dir_make(dst_subdir_shard, APR_OS_DEFAULT,
                                     iterpool));
+            SVN_ERR(svn_fs_fs__dup_perms(dst_subdir_shard, dst_subdir,
+                                         iterpool));
+          }
         }
 
       SVN_ERR(svn_io_dir_file_copy(src_subdir_shard, dst_subdir_shard,
@@ -1354,9 +1357,12 @@
           src_subdir_shard = svn_path_join(src_subdir, shard, iterpool);
           dst_subdir_shard = svn_path_join(dst_subdir, shard, iterpool);
 
-          if (rev % max_files_per_dir == 0)
+          if (rev % max_files_per_dir == 0) {
             SVN_ERR(svn_io_dir_make(dst_subdir_shard, APR_OS_DEFAULT,
                                     iterpool));
+            SVN_ERR(svn_fs_fs__dup_perms(dst_subdir_shard, dst_subdir,
+                                         iterpool));
+          }
         }
 
       SVN_ERR(svn_io_dir_file_copy(src_subdir_shard, dst_subdir_shard,
@@ -5371,18 +5377,26 @@
   if (ffd->max_files_per_dir && new_rev % ffd->max_files_per_dir == 0)
     {
       svn_error_t *err;
-      err = svn_io_dir_make(path_rev_shard(cb->fs, new_rev, pool),
-                            APR_OS_DEFAULT, pool);
-      if (err && APR_STATUS_IS_EEXIST(err->apr_err))
-        svn_error_clear(err);
-      else
+      const char *new_dir = path_rev_shard(cb->fs, new_rev, pool);
+      err = svn_io_dir_make(new_dir, APR_OS_DEFAULT, pool);
+      if (err && !APR_STATUS_IS_EEXIST(err->apr_err))
         SVN_ERR(err);
-      err = svn_io_dir_make(path_revprops_shard(cb->fs, new_rev, pool),
-                            APR_OS_DEFAULT, pool);
-      if (err && APR_STATUS_IS_EEXIST(err->apr_err))
-        svn_error_clear(err);
-      else
+      svn_error_clear(err);
+      SVN_ERR(svn_fs_fs__dup_perms(new_dir,
+                                   svn_path_join(cb->fs->path, PATH_REVS_DIR,
+                                                 pool),
+                                   pool));
+
+      new_dir = path_revprops_shard(cb->fs, new_rev, pool);
+      err = svn_io_dir_make(new_dir, APR_OS_DEFAULT, pool);
+      if (err && !APR_STATUS_IS_EEXIST(err->apr_err))
         SVN_ERR(err);
+      svn_error_clear(err);
+      SVN_ERR(svn_fs_fs__dup_perms(new_dir,
+                                   svn_path_join(cb->fs->path,
+                                                 PATH_REVPROPS_DIR,
+                                                 pool),
+                                   pool));
     }
 
   /* Move the finished rev file into place. */
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-07-29 23:55:07 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.