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

[PATCH] svn:externals/update crash

From: Vladimir Prus <ghost_at_cs.msu.su>
Date: 2002-11-13 08:08:35 CET

Karl Fogel wrote:
> Vladimir Prus <ghost@cs.msu.su> writes:
>
>>I believe I've told you about that problem in IRC some time ago --
>>svn_io_make_dir_recursively can't handle "" path, and I can try to
>>fix it if you like.
>
>
> Yes, please do! We can file an issue now, or just wait till the patch
> is posted and make it a `patch' issue, either way is fine (maybe it'll
> be simple enough to apply right away anyway).

Log message:
Fix crashes on updating external items in current directory.

* subversion/libsvn_subr/io.c (svn_io_make_dir_recursively):
     Do nothing when passes empty path, assuming that empty path
     already exists.

* subversion/tests/clients/cmdline/module_tests.py
     (update_current_dir): New test.

Patch:
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (revision 3772)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -424,6 +424,11 @@
    apr_status_t apr_err;
    char *dir;

+ if (svn_path_is_empty_nts (path) )
+ /* Empty path (current dir) is assumed to always exist,
+ so we do nothing, per docs. */
+ return SVN_NO_ERROR;
+
    SVN_ERR (svn_utf_cstring_from_utf8 (&path_native, path, pool));

  #if 0
Index: subversion/tests/clients/cmdline/module_tests.py
===================================================================
--- subversion/tests/clients/cmdline/module_tests.py (revision 3772)
+++ subversion/tests/clients/cmdline/module_tests.py (working copy)
@@ -650,6 +650,74 @@

    return 0

+
+def update_current_dir(sbox):
+ "update '.', instead of updating directory, given its full path"
+
+ if externals_test_setup(sbox):
+ return 1
+
+ wc_dir = sbox.wc_dir
+ other_wc_dir = wc_dir + ".other"
+ repo_dir = sbox.repo_dir
+ repo_url = os.path.join(svntest.main.test_area_url, repo_dir)
+ other_repo_url = repo_url + ".other"
+
+ # Checkout a working copy
+ out_lines, err_lines = svntest.main.run_svn \
+ (None, 'checkout', repo_url, wc_dir)
+ if err_lines: return 1
+
+ # Add one more external item
+ B_path = os.path.join(wc_dir, "A/B")
+ externals_desc = \
+ "exdir_G " + os.path.join(other_repo_url, "A/D/G") + "\n" + \
+ "exdir_H -r1 " + os.path.join(other_repo_url, "A/D/H") + "\n" + \
+ "exdir_Z " + os.path.join(other_repo_url, "A/D/H") + "\n"
+
+ tmp_f = os.tempnam()
+ svntest.main.file_append(tmp_f, externals_desc)
+ out_lines, err_lines = svntest.main.run_svn \
+ (None, 'pset', '-F', tmp_f, 'svn:externals', B_path)
+ if err_lines: return 1
+
+ os.remove(tmp_f)
+
+ # Now cd into A/B and try updating
+ cd = os.getcwd()
+ result = 0
+
+ os.chdir(B_path)
+ out_lines, err_lines = svntest.main.run_svn (None, 'up')
+
+ if err_lines: result = 1
+
+ # Since 'run_svn' does not detect segfaults, just check the output.
+ if out_lines != [
+ 'At revision 6.\n',
+ '\n',
+ 'Fetching external item into exdir_G\n',
+ 'At revision 5.\n',
+ '\n',
+ 'Fetching external item into exdir_H\n',
+ 'At revision 1.\n',
+ '\n',
+ 'Fetching external item into exdir_Z\n',
+ 'A exdir_Z/chi\n',
+ 'A exdir_Z/omega\n',
+ 'A exdir_Z/psi\n',
+ 'Updated to revision 5.\n'
+ ]:
+ print "Unexpected output."
+ result = 1
+
+ os.chdir(cd)
+
+ return result
+
+
+
+
  ########################################################################
  # Run the tests

@@ -662,6 +730,7 @@
                update_change_pristine_external,
                update_change_modified_external,
                update_receive_change_under_external,
+ update_current_dir,
               ]

  if __name__ == '__main__':

- Volodya

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 13 08:08:55 2002

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