Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#17666 closed defect (fixed)

Subversion Ruby bindings are broken with Ruby-3.2

Reported by: Douglas R. Reno Owned by: Douglas R. Reno
Priority: normal Milestone: 11.3
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description

When running the test suite for Subversion, I noticed the following error:

===============================================================================
Error: test_adm_ensure(SvnWcTest): NoMethodError: undefined method `exists?' for File:Class
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:345:in `test_adm_ensure'
     342:
     343:   def test_adm_ensure
     344:     adm_dir = Dir.glob(File.join(@wc_path, "{.,_}svn")).first
  => 345:     assert(File.exists?(adm_dir))
     346:     FileUtils.rm_rf(adm_dir)
     347:     assert(!File.exists?(adm_dir))
     348:     Svn::Wc.ensure_adm(@wc_path, @fs.uuid, @repos_uri, @repos_uri, 0)
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb:115:in `run'
===============================================================================
===============================================================================
Error: test_delete(SvnWcTest): NoMethodError: undefined method `exists?' for File:Class
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:477:in `block in test_delete'
     474:       ctx.add(path)
     475:       ctx.ci(@wc_path).revision
     476:
  => 477:       assert(File.exists?(path))
     478:       Svn::Wc::AdmAccess.open(nil, @wc_path, true, 5) do |access|
     479:         access.delete(path)
     480:       end
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/util.rb:241:in `make_context'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:471:in `test_delete'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb:115:in `run'
===============================================================================
===============================================================================
Error: test_switch_editor(SvnWcTest): NoMethodError: undefined method `exists?' for File:Class
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:949:in `block (2 levels) in test_switch_editor'
     946:         ctx.add(dir2_path)
     947:         rev2 = ctx.commit(@wc_path).revision
     948:
  => 949:         assert(File.exists?(path1))
     950:         assert_equal(rev2, ctx.switch(@wc_path, dir2_uri))
     951:         assert(File.exists?(File.join(@wc_path, file2)))
     952:         Svn::Wc::AdmAccess.open_anchor(@wc_path) do |access, dir_access, target|
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/svn/ra.rb:52:in `open'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:937:in `block in test_switch_editor'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/util.rb:241:in `make_context'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:934:in `test_switch_editor'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb:115:in `run'
===============================================================================
===============================================================================
Error: test_update_editor(SvnWcTest): NoMethodError: undefined method `exists?' for File:Class
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:811:in `block (2 levels) in test_update_editor'
     808:         ctx.add(path2)
     809:         rev2 = ctx.commit(@wc_path).revision
     810:
  => 811:         assert(File.exists?(path2))
     812:         assert_equal(0, ctx.up(@wc_path, 0))
     813:         assert(!File.exists?(path2))
     814:         Svn::Wc::AdmAccess.open(nil, @wc_path) do |access|
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/svn/ra.rb:52:in `open'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:799:in `block in test_update_editor'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/util.rb:241:in `make_context'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:796:in `test_update_editor'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb:115:in `run'
===============================================================================
.E
===============================================================================
Error: test_update_editor_options(SvnWcTest): NoMethodError: undefined method `exists?' for File:Class
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:851:in `block (2 levels) in test_update_editor_options'
     848:         ctx.add(path2)
     849:         rev2 = ctx.commit(@wc_path).revision
     850:
  => 851:         assert(File.exists?(path2))
     852:         assert_equal(0, ctx.up(@wc_path, 0))
     853:         assert(!File.exists?(path2))
     854:         notification_count = 0
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/svn/ra.rb:52:in `open'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:839:in `block in test_update_editor_options'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/util.rb:241:in `make_context'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test_wc.rb:836:in `test_update_editor_options'
/sources/subversion-1.14.2/subversion-1.14.2/subversion/bindings/swig/ruby/test/test-unit-ext/priority.rb:115:in `run'
===============================================================================

I did a bit of research and noticed that the File.exists? method had been removed in 3.2 after being deprecated for a long time. I found this commit upstream: https://svn.apache.org/viewvc?view=revision&revision=1904472

After applying this commit locally, there are still some warnings regarding allocators being undefined, but there are no more errors!

I guess this is technically a runtime error unveiled by the test suite. :)

I've come up with the following sed:

sed -e 's/File.exists?/File.exist?/' \

-i subversion/bindings/swig/ruby/svn/util.rb \ -i subversion/bindings/swig/ruby/test/test_wc.rb

I'm going to try a final build without the windows_util.rb file being modified as that shouldn't be needed

Change History (5)

comment:1 by Douglas R. Reno, 14 months ago

Owner: changed from blfs-book to Douglas R. Reno
Status: newassigned

comment:2 by Douglas R. Reno, 14 months ago

Everything looks good with the sed

It should be formatted like this:

sed -e 's/File.exists?/File.exist?/'               \
    -i subversion/bindings/swig/ruby/svn/util.rb   \
    -i subversion/bindings/swig/ruby/test/test_wc.rb

Going to submit that fix now

comment:3 by Douglas R. Reno, 14 months ago

Resolution: fixed
Status: assignedclosed

comment:4 by Bruce Dubbs, 14 months ago

The sed will work, but is not, strictly speaking, correct. The -i is short for --in-place. Specifying it twice will not hurt, but can be confusing. How about:

sed -e 's/File.exists?/File.exist?/' \
    -i subversion/bindings/swig/ruby/{svn/util,test/test_wc}.rb   

or

sed -e 's/File.exists?/File.exist?/' \
    -i subversion/bindings/swig/ruby/svn/util.rb \
       subversion/bindings/swig/ruby/test/test_wc.rb

The -e can be specified twice if there are two or more expressions.

comment:5 by Douglas R. Reno, 14 months ago

Let's go with the second one that you suggested, I think it looks cleaner. :)

Note: See TracTickets for help on using tickets.