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

Re: [PATCH] Fix merging with broken softlink as target

From: Karl Fogel <kfogel_at_red-bean.com>
Date: Mon, 12 May 2008 16:26:50 -0400

Karl Fogel <kfogel_at_red-bean.com> writes:
> Hmmm. If the goal is to check for symlinks, not just specialness, maybe
> it would be a good idea to check that the contents of the special file
> begins with "link:", indicating a symlink? There may be other kinds of
> special files in the future...
>
> Hmm, then again, it's highly likely that future kinds of special files
> would want the same treatment anyway. So I've just adjusted the comment
> a bit to talk about that; I'm running 'make check' now (paranoia, I know
> you already did it) and will commit soon.

Hmmm. I'm still getting a failure over ra_neon:

   prop_tests.py 26: test handling invalid svn:* property values

When I say I run 'make check', what I really mean is I run the
regression test suite over at least three RA layers:

   make check CLEANUP=true
   make svncheck CLEANUP=true
   make neoncheck CLEANUP=true
   make serfcheck CLEANUP=true /* Usually run this, not always */

Now, the latter two, Neon and Serf, require that I start up the httpd
server of course. I usually do that by hand, but 'make davautocheck'
should automate the process if you want.

The above failure is from 'make neoncheck'. Do you know what's causing
it? (I haven't looked into it yet, having choosen instead to
shamelessly toss the ball back into your court :-) .)

Below is the exact patch I was testing, using approximately r31143 of
trunk:

[[[
Fix "file not found" error when a merge target is a broken symbolic link.

Patch by: David O'Shea <david.oshea_at_s3group.com>

* subversion/libsvn_wc/merge.c
  (svn_wc__merge_internal): Diff against detranslated file if the
    target is "special".

* subversion/tests/cmdlink/merge_tests.py
  (merge_broken_link): New test function.
  (test_list): Call the new test function.
]]]

Index: subversion/libsvn_wc/merge.c
===================================================================
--- subversion/libsvn_wc/merge.c (revision 31142)
+++ subversion/libsvn_wc/merge.c (working copy)
@@ -674,9 +674,18 @@
         }
       else
         {
- svn_boolean_t same;
+ svn_boolean_t same, special;
+ /* If 'special', then use the detranslated form of the
+ target file. This is so we don't try to follow symlinks,
+ but the same treatment is probably also appropriate for
+ whatever special file types we may invent in the future. */
+ SVN_ERR(svn_wc__get_special(&special, merge_target,
+ adm_access, pool));
           SVN_ERR(svn_io_files_contents_same_p(&same, result_target,
- merge_target, pool));
+ (special ?
+ tmp_target :
+ merge_target),
+ pool));
 
           *merge_outcome = same ? svn_wc_merge_unchanged : svn_wc_merge_merged;
         }
Index: subversion/tests/cmdline/merge_tests.py
===================================================================
--- subversion/tests/cmdline/merge_tests.py (revision 31142)
+++ subversion/tests/cmdline/merge_tests.py (working copy)
@@ -11258,6 +11258,7 @@
   expected_status.tweak('H_COPY/psi_moved', status='MM')
   svntest.actions.run_and_verify_status(wc_dir, expected_status)
 
+
 #----------------------------------------------------------------------
 # Issue #3157
 def dont_explicitly_record_implicit_mergeinfo(sbox):
@@ -11349,6 +11350,32 @@
                                        None, None, None, None, None, 1)
   
 
+# Test for issue where merging a change to a broken link fails
+def merge_broken_link(sbox):
+ "merge with broken symlinks in target"
+
+ # Create our good 'ole greek tree.
+ sbox.build()
+ wc_dir = sbox.wc_dir
+ src_path = os.path.join(wc_dir, 'A', 'B', 'E')
+ copy_path = os.path.join(wc_dir, 'A', 'B', 'E_COPY')
+ link_path = os.path.join(src_path, 'beta_link')
+
+ os.symlink('beta_broken', link_path)
+ svntest.main.run_svn(None, 'add', link_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'Create a broken link', link_path)
+ svntest.main.run_svn(None, 'copy', src_path, copy_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'Copy the tree with the broken link',
+ copy_path)
+ os.unlink(link_path)
+ os.symlink('beta', link_path)
+ svntest.main.run_svn(None, 'commit', '-m', 'Fix a broken link', link_path)
+ svntest.actions.run_and_verify_svn(
+ None,
+ expected_merge_output([[4]], 'U ' + copy_path + '/beta_link\n'),
+ [], 'merge', '-c4', src_path, copy_path)
+
+
 ########################################################################
 # Run the tests
 
@@ -11515,6 +11542,7 @@
                                server_has_mergeinfo)),
               SkipUnless(dont_explicitly_record_implicit_mergeinfo,
                          server_has_mergeinfo),
+ merge_broken_link,
              ]
 
 if __name__ == '__main__':

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-05-12 22:27:04 CEST

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