ruby-changes:65257
From: xtkoba <ko1@a...>
Date: Sun, 14 Feb 2021 19:46:08 +0900 (JST)
Subject: [ruby-changes:65257] a681c484a3 (master): Fixed codepage for utime [Bug #17626]
https://git.ruby-lang.org/ruby.git/commit/?id=a681c484a3 From a681c484a3c5b9235c84bc5c253b4406e498e8cf Mon Sep 17 00:00:00 2001 From: "xtkoba (Tee KOBAYASHI)" <xtkoba+ruby@g...> Date: Sun, 14 Feb 2021 19:43:45 +0900 Subject: Fixed codepage for utime [Bug #17626] Should use the given codepage argument. Co-Authored-By: Nobuyoshi Nakada <nobu@r...> --- test/ruby/test_file_exhaustive.rb | 7 +++++++ win32/win32.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index b966cc6..0cb63c8 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -679,6 +679,13 @@ class TestFileExhaustive < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L679 File.utime(t + 1, t + 2, zerofile) assert_equal(t + 1, File.atime(zerofile)) assert_equal(t + 2, File.mtime(zerofile)) + Dir.mktmpdir do |dir| + Dir.chdir do + path = "foo\u{30b3 30d4 30fc}" + File.write(path, "") rescue next + assert_equal(1, File.utime(nil, nil, path)) + end + end end def test_utime_symlinkfile diff --git a/win32/win32.c b/win32/win32.c index 9b81488..b5d982b 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -7400,7 +7400,7 @@ wutimensat(int dirfd, const WCHAR *path, const struct timespec *times, int flags https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L7400 static int w32_utimensat(int dirfd, const char *path, const struct timespec *times, int flags, UINT cp) { - WCHAR *wpath = mbstr_to_wstr(filecp(), path, -1, NULL); + WCHAR *wpath = mbstr_to_wstr(cp, path, -1, NULL); int ret = -1; if (wpath) { -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/