Project

General

Profile

Actions

Bug #17626

closed

FileUtils.cp may cause utime_failed

Added by agate-pris (agate pris) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
[ruby-dev:51020]

Description

FileUtils.cp will cause utime_failed if the file name contains Japanese characters and preserve is true.

This will probably only happen on Windows. It occures on Windows 10 version 2004 build 21301.1010.

require 'fileutils'

FileUtils.cp('foo', 'foo_copy', preserve: true)
FileUtils.cp('foo', 'fooコピー', preserve: true)
$ ruby test.rb
C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1424:in `utime': No such file or directory @ utime_failed - fooコピー (Errno::ENOENT)
        from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1424:in `copy_metadata'
        from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:515:in `copy_file'
        from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:433:in `block in cp'
        from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1597:in `block in fu_each_src_dest'
        from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1613:in `fu_each_src_dest0'
        from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:1595:in `fu_each_src_dest'
        from C:/tools/ruby30/lib/ruby/3.0.0/fileutils.rb:432:in `cp'
        from test.rb:4:in `<main>'

The expected result is copy to fooコピー is success same like copy to foo_copy.


Files

ruby-w32_utimensat.patch (326 Bytes) ruby-w32_utimensat.patch xtkoba (Tee KOBAYASHI), 02/14/2021 02:19 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0