Issue #5817 has been reported by Jon Forums.

----------------------------------------
Bug #5817: [mingw] ruby/test_file.rb error in test_chmod_m17n(TestFile)
https://bugs.ruby-lang.org/issues/5817

Author: Jon Forums
Status: Open
Priority: Normal
Assignee: 
Category: M17N
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2011-12-26 trunk 34138) [i386-mingw32]


I cannot read #5671 to determine if this is a duplicate, but based upon the info below, the error doesn't appear to be caused by `File.chmod` but by m17n issues.

The following is from a RubyInstaller-based build of trunk on a Win7 32bit system.


sh-3.1$ make test-all TESTS='ruby/test_file.rb'
./miniruby.exe -I../../../../Users/Jon/Documents/RubyDev/ruby-git/lib -I.
-I.ext/common  ../../../../Users/Jon/Documents/RubyDev/ruby-git/tool/runruby.rb --extout=.ext  -- --disable-gems
"../../../../Users/Jon/Documents/RubyDev/ruby-git/test/runner.rb"
--ruby="./miniruby.exe -I../../../../Users/Jon/Documents/RubyDev/ruby-git/lib -I. -I.ext/common
../../../../Users/Jon/Documents/RubyDev/ruby-git/tool/runruby.rb --extout=.ext  -- --disable-gems" ruby/test_file.rb
Run options: "--ruby=./miniruby.exe -I../../../../Users/Jon/Documents/RubyDev/ruby-git/lib -I. -I.ext/common  ../../../../Users/Jon/Documents/RubyDev/ruby-git/tool/runruby.rb --extout=.ext  -- --disable-gems"

# Running tests:

E........................

Finished tests in 1.154402s, 21.6562 tests/s, 100.4849 assertions/s.

  1) Error:
test_chmod_m17n(TestFile):
Errno::EINVAL: Invalid argument - C:/Users/Jon/AppData/Local/Temp/test-file-chmod-m17n-20111226-3376-1ezxf5l/?
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1403:in `unlink'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1403:in `block in remove_file'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1411:in `platform_support'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1402:in `remove_file'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1391:in `remove'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:770:in `block in remove_entry'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1441:in `block (2 levels) in postorder_traverse'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1445:in `postorder_traverse'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1440:in `block in postorder_traverse'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1439:in `each'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:1439:in `postorder_traverse'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:768:in `remove_entry'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/fileutils.rb:692:in `remove_entry_secure'
    c:/Users/Jon/Documents/RubyDev/ruby-git/lib/tmpdir.rb:85:in `mktmpdir'
    c:/Users/Jon/Documents/RubyDev/ruby-git/test/ruby/test_file.rb:201:in `test_chmod_m17n'

25 tests, 116 assertions, 0 failures, 1 errors, 0 skips

ruby -v: ruby 2.0.0dev (2011-12-26 trunk 34138) [i386-mingw32]
make: *** [yes-test-all] Error 1


=== ripl spelunking ===

C:\Users\Jon\Downloads\temp>ripl
>> RUBY_DESCRIPTION
=> "ruby 2.0.0dev (2011-12-26 trunk 34138) [i386-mingw32]"
>> Dir.mkdir('foo')
=> 0
>> f = File.open("foo/\u3042", "w")
=> #<File:foo/???>
>> f.close
=> nil
>> File.chmod(0666, f)
=> 1
>> File.unlink(f)
=> 1
>> require 'fileutils'
=> true
>> f = File.open("foo/\u3042", "w")
=> #<File:foo/???>
>> f.close
=> nil
>> FileUtils.remove_entry_secure(f)
=> nil
>> require 'tmpdir'
=> true
>> # fails for chcp 437, 1258, and 65001; tmpdir and \u3042 file successfully created
=> nil
>> Dir.mktmpdir('foo-') do |tmpdir|
 |   f = File.join(tmpdir, "\u3042")
 |   File.open(f, 'w') {}
 | end
Errno::EINVAL: Invalid argument - C:/Users/Jon/AppData/Local/Temp/foo20111226-4264-1qoznij/?
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1403:in `unlink'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1403:in `block in remove_file'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1411:in `platform_support'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1402:in `remove_file'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1391:in `remove'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:770:in `block in remove_entry'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1441:in `block (2 levels) in postorder_traverse'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1445:in `postorder_traverse'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1440:in `block in postorder_traverse'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1439:in `each'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:1439:in `postorder_traverse'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:768:in `remove_entry'
    C:/rubytrunk/lib/ruby/1.9.1/fileutils.rb:692:in `remove_entry_secure'
    C:/rubytrunk/lib/ruby/1.9.1/tmpdir.rb:85:in `mktmpdir'
    (ripl):5:in `<main>'
>> # works OK
=> nil
>> Dir.mktmpdir('foo-') do |tmpdir|
 |   f = File.join(tmpdir, 'bar')
 |   File.open(f, 'w') {}
 | end
=> nil



-- 
http://redmine.ruby-lang.org