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

[bug] possible pool leak in Ruby bindings for FS?

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2007-03-14 06:39:42 CET

Hi kou,

I realize that you want to not use the binary file access when testing
on windows, but I was fiddling around with this patch (which does
cause the test to pass, but see below for how the test cleanup blows
out sideways).

===================================================================
--- subversion/bindings/swig/ruby/test/test_fs.rb (revision 23804)
+++ subversion/bindings/swig/ruby/test/test_fs.rb (working copy)
@@ -302,11 +302,11 @@

     ctx = make_context(log)

- File.open(path, "w") {|f| f.print(src)}
+ File.open(path, "wb") {|f| f.print(src)}
     ctx.add(path)
     rev1 = ctx.ci(@wc_path).revision

- File.open(path, "w") {|f| f.print(modified)}
+ File.open(path, "wb") {|f| f.print(modified)}
     @fs.transaction do |txn|
       checksum = MD5.new(result).hexdigest
       stream = txn.root.apply_text(path_in_repos, checksum)
@@ -317,6 +317,7 @@
     assert_equal(expected, File.open(path){|f| f.read})

     rev2 = ctx.ci(@wc_path).revision
+#flunk 'if the next line executes, test cleanup will error and cause
cascading test errors'
     stream = @fs.root(rev2).file_delta_stream(@fs.root(rev1),
                                               path_in_repos,
                                               path_in_repos)
@@ -324,10 +325,10 @@
     stream.each{|w| data << w.new_data}
     assert_equal(expected, data)

- File.open(path, "w") {|f| f.print(src)}
+ File.open(path, "wb") {|f| f.print(src)}
     rev3 = ctx.ci(@wc_path).revision

- File.open(path, "w") {|f| f.print(modified)}
+ File.open(path, "wb") {|f| f.print(modified)}
     @fs.transaction do |txn|
       base_checksum = MD5.new(src).hexdigest
       checksum = MD5.new(result).hexdigest

==============
and the flunk line explains what is going on. The errors are similar
to those that you fixed around a leaking pool object in initialize:

D:\SVN\src-trunk\subversion\bindings\swig\ruby>testrb test\test_fs.rb
-n test_delta
Loaded suite test_fs.rb
Started
E
Finished in 5.758 seconds.

  1) Error:
test_delta(SvnFsTest):
Svn::Error::SvnError:
D:\SVN\src-trunk\subversion\libsvn_subr\io.c:1810 Can't remove
'test\repos\db\revs\1'
Can't set file 'test\repos\db\revs\1' read-write: Access is denied.
    ./svn/util.rb:68:in `svn_repos_delete'
    ./svn/util.rb:68:in `delete'
    D:/SVN/src-trunk/subversion/bindings/swig/ruby/test/util.rb:103:in
`teardown_repository'
    D:/SVN/src-trunk/subversion/bindings/swig/ruby/test/util.rb:40:in
`teardown_basic'
    ./test\test_fs.rb:19:in `teardown'

1 tests, 3 assertions, 0 failures, 1 errors

========

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Mar 14 06:39:54 2007

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.