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

Re: svn commit: r12676 - branches/locking/subversion/libsvn_fs_fs

From: <kfogel_at_collab.net>
Date: 2005-01-12 18:12:29 CET

Greg Hudson <ghudson@MIT.EDU> writes:
> On Wed, 2005-01-12 at 09:12, Peter N. Lundblad wrote:
> > umask problems? I think you need to be careful when creating new files and
> > directories. Other parts of libsvn_fs_fs is it. I think it copies
> > permissions from another file, but I am not sure.
>
> New rev and rev-prop files get permissions copied from the previous head
> revision.

Hmmm.

Does this mean that my change r12669 is problematic? I used
svn_io_file_rename() instead of use move_into_place() because I wasn't
sure that the dest file would exist to be used as a perms reference by
move_into_place()...

(See also my comments in issue #2193, about other potentially
vulnerable places in fs_fs.c.)

  ------------------------------------------------------------------------
  r12669 | kfogel | 2005-01-11 03:02:33 -0600 (Tue, 11 Jan 2005) | 5 lines
  Changed paths:
     M /trunk/subversion/libsvn_fs_fs/fs_fs.c
  
  Fix issue #2193: Change FSFS revprops atomically, thus safely.
  
  * subversion/libsvn_fs_fs/fs_fs.c
    (svn_fs_fs__set_revision_proplist): Write to tmp file, then rename.
  
  Index: subversion/libsvn_fs_fs/fs_fs.c
  ===================================================================
  --- subversion/libsvn_fs_fs/fs_fs.c (revision 12668)
  +++ subversion/libsvn_fs_fs/fs_fs.c (revision 12669)
  @@ -1009,16 +1009,16 @@
                                     apr_hash_t *proplist,
                                     apr_pool_t *pool)
   {
  - apr_file_t *revprop_file;
  + const char *final_path = path_revprops (fs, rev, pool);
  + const char *tmp_path;
  + apr_file_t *f;
   
  - SVN_ERR (svn_io_file_open (&revprop_file, path_revprops (fs, rev, pool),
  - APR_WRITE | APR_TRUNCATE | APR_CREATE,
  - APR_OS_DEFAULT, pool));
  + SVN_ERR (svn_io_open_unique_file
  + (&f, &tmp_path, final_path, ".tmp", FALSE, pool));
  + SVN_ERR (svn_hash_write (proplist, f, pool));
  + SVN_ERR (svn_io_file_close (f, pool));
  + SVN_ERR (svn_io_file_rename (tmp_path, final_path, pool));
     
  - SVN_ERR (svn_hash_write (proplist, revprop_file, pool));
  -
  - SVN_ERR (svn_io_file_close (revprop_file, pool));
  -
     return SVN_NO_ERROR;
   }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jan 12 18:28:27 2005

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.