You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Peter Samuelson <pe...@p12n.org> on 2008/07/29 21:54:56 UTC

[PATCH] Set permissions on new fsfs shard dirs

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@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Set permissions on new fsfs shard dirs

Posted by Karl Fogel <kf...@red-bean.com>.
Peter Samuelson <pe...@p12n.org> writes:
>> 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.
>
> r32355, and proposed for 1.5.2.  I didn't create a test case, I don't
> know if that's important for something as small as this.

In an ideal world, we'd have test cases for every change.

In real life, yeah, I agree with your priorities -- this is not the sort
of change worth spending further hours of your time writing a test.

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

Re: [PATCH] Set permissions on new fsfs shard dirs

Posted by Peter Samuelson <pe...@p12n.org>.
[Peter Samuelson]
> 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.

r32355, and proposed for 1.5.2.  I didn't create a test case, I don't
know if that's important for something as small as this.
-- 
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/