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

Re: [PATCH] Re: All breakage tests failing in svn_io_file_rename

From: Jani Averbach <jaa_at_cc.jyu.fi>
Date: 2003-11-11 02:33:33 CET

On 2003-11-10 14:02-0600, kfogel@collab.net wrote:
> Brian Denny <brian@briandenny.net> writes:
> > > 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'.
>
> Any news?

I ran the test set with shared build (ra_local, ra_svn, ra_dav) and here
is the report:

ra_local: all test passed
ra_svn: 1 failed, export_tests.py 6: export with keyword translation
ra_dav: 1 failed, export_tests.py 6: export with keyword translation

Without the patch, the merge tests will fail.

Here is the used patch, I had to apply Bryan's patch by hand, because
it was out of date. So the included patch is the Brian's patch, and
hopefully it is exactly same as original (it should be).

BR, Jani

Brian wrote:

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: svn/subversion/libsvn_client/repos_diff.c
===================================================================
--- svn/subversion/libsvn_client/repos_diff.c (revision 7693)
+++ svn/subversion/libsvn_client/repos_diff.c (working copy)
@@ -353,19 +353,31 @@
 }
 
 
-/* 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),
- "", FALSE, 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));
 
   return SVN_NO_ERROR;
@@ -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));

-- 
Jani Averbach
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 11 02:34:24 2003

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