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

[PATCH] Re: All breakage tests failing in svn_io_file_rename

From: Brian Denny <brian_at_briandenny.net>
Date: 2003-11-08 18:29:34 CET

On Fri, Nov 07, 2003 at 07:30:07PM -0800, Brian Denny wrote:
> On Sat, Nov 08, 2003 at 01:10:19AM +0000, Philip Martin wrote:
> > One option would be to make a decision based on whether we are using a
> > read-only access baton or a read-write access baton.

...And here's the patch. Currently running 'make check'.

-brian

Log:
Resolve issue #1589 -- "svn_io_temp_dir() inappropriate for some wc
write ops". In the context of merge (a read/write operation), create
the temp file in the working directory instead of the system's tempdir.

* subversion/libsvn_client/repos_diff.c
  (create_empty_file): New parameter HAVE_WRITE_LOCK. If TRUE, create
    the temp file in the working directory instead of the system's tempdir.
  (get_empty_file): Determine whether we have a write lock.
  (apply_textdelta): Determine whether we have a write lock.

Index: subversion/libsvn_client/repos_diff.c
===================================================================
--- subversion/libsvn_client/repos_diff.c (revision 7674)
+++ subversion/libsvn_client/repos_diff.c (working copy)
@@ -353,18 +353,30 @@
 }
 
 
-/* Create an empty file, the path to the file is returned in EMPTY_FILE
+/* Create an empty file, the path to the file is returned in EMPTY_FILE.
+ * If HAVE_WRITE_LOCK is true, create the file in the working directory,
+ * otherwise use a system temp dir.
  */
 static svn_error_t *
 create_empty_file (const char **empty_file,
+ svn_boolean_t have_write_lock,
                    apr_pool_t *pool)
 {
   apr_file_t *file;
- const char *temp_dir;
+ const char *temp_path;
 
- SVN_ERR (svn_io_temp_dir (&temp_dir, pool));
- SVN_ERR (svn_io_open_unique_file (&file, empty_file,
- svn_path_join (temp_dir, "tmp", pool),
+ if (have_write_lock)
+ {
+ temp_path = "tmp";
+ }
+ else
+ {
+ const char *temp_dir;
+ SVN_ERR (svn_io_temp_dir (&temp_dir, pool));
+ temp_path = svn_path_join (temp_dir, "tmp", pool);
+ }
+
+ SVN_ERR (svn_io_open_unique_file (&file, empty_file, temp_path,
                                     "", FALSE, pool));
   SVN_ERR (svn_io_file_close (file, pool));
 
@@ -432,7 +444,9 @@
   /* Create the file if it does not exist */
   if (!b->empty_file)
     {
- SVN_ERR (create_empty_file (&(b->empty_file), b->pool));
+ svn_boolean_t have_lock;
+ have_lock = (b->adm_access && svn_wc_adm_locked (b->adm_access));
+ SVN_ERR (create_empty_file (&(b->empty_file), have_lock, b->pool));
 
       /* Install a pool cleanup handler to delete the file */
       SVN_ERR (temp_file_cleanup_register (b->empty_file, b->pool));
@@ -693,6 +707,7 @@
                  void **handler_baton)
 {
   struct file_baton *b = file_baton;
+ svn_boolean_t have_lock;
 
   /* Open the file to be used as the base for second revision */
   SVN_ERR (svn_io_file_open (&(b->file_start_revision),
@@ -701,7 +716,9 @@
 
   /* Open the file that will become the second revision after applying the
      text delta, it starts empty */
- SVN_ERR (create_empty_file (&(b->path_end_revision), b->pool));
+ have_lock = (b->edit_baton->adm_access
+ && svn_wc_adm_locked (b->edit_baton->adm_access));
+ SVN_ERR (create_empty_file (&(b->path_end_revision), have_lock, b->pool));
   SVN_ERR (temp_file_cleanup_register (b->path_end_revision, b->pool));
   SVN_ERR (svn_io_file_open (&(b->file_end_revision), b->path_end_revision,
                              APR_WRITE, APR_OS_DEFAULT, b->pool));

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Nov 8 18:20:27 2003

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.