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

Re: svn commit: rev 3643 - trunk/subversion/include trunk/subversion/libsvn_repos

From: Karl Fogel <kfogel_at_newton.ch.collab.net>
Date: 2002-11-04 19:37:45 CET

kfogel@tigris.org writes:
> Log:
> Resolve issue #966: empty input caused 'svnadmin load' to segfault.
>
> * subversion/include/svn_error_codes.h
> (SVN_ERR_BAD_INPUT): New error code.
>
> * subversion/libsvn_repos/load.c
> (svn_repos_parse_dumpstream): Check that the first call to
> svn_stream_readline got some data.

I also tried to write a regression test for this, but got stumped on
the question of how to portably feed empty input to 'svnadmin load' on
stdin, in Python. (Is creating empty file even a necessary part of
this?) Anyone know an answer off the top of their head? I could
probably kluge something together, after poking around on python.org,
but I have a feeling there's a standard technique for this situation.

Here's my patch-in-progress; see where it says "???".

* subversion/tests/clients/cmdline/svnadmin_tests.py
  (load_empty_file): New test, incomplete.

Index: svnadmin_tests.py
===================================================================
--- svnadmin_tests.py (revision 3643)
+++ svnadmin_tests.py (working copy)
@@ -332,6 +332,27 @@
                "* Dumped revision 1.\n",
                "* Dumped revision 2.\n"], errput)
 
+#----------------------------------------------------------------------
+
+def load_empty_file(sbox):
+ "test 'svnadmin load' on an empty file"
+
+ repos = os.path.join(svntest.main.temp_dir, sbox.name)
+ empty_file = os.path.join(svntest.main.temp_dir,
+ sbox.name + ".empty-dumpfile")
+
+ svntest.main.create_repos(repos)
+ fp = open(empty_file, 'w')
+ fp.close()
+
+ output, errput = svntest.main.run_svnadmin("load", repos, "### ???")
+ for line in errput:
+ if re.match(".*empty or incomplete input data*", line):
+ return 0
+
+ # Else never matched the expected error string, so return failure.
+ return 1
+
 
 ########################################################################
 # Run the tests
@@ -345,7 +366,8 @@
               remove_txn,
               list_revs,
               dump_copied_dir,
- dump_move_dir_modify_child
+ dump_move_dir_modify_child,
+ load_empty_file,
              ]
 
 if __name__ == '__main__':

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Nov 4 20:10:09 2002

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.