summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2024-11-04 14:36:36 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2024-11-04 14:36:36 -0800
commit2b713dcb89c620daa55d672d2933ffde333ca5de (patch)
treec4d97226eb054559ed2e1cab070684216f413ccd
parente7c939aea1034a463226635e11117ade42cba4e4 (diff)
merge revision(s) d33e3d47b84a73b38644f2a3d41881ce9be6ef18: [Backport #20704]
[Bug #20704] Win32: Fix chdir to non-ASCII path On Windows, `chdir` in compilers' runtime libraries uses the active code page, but command line arguments in ruby are always UTF-8, since commit:33ea2646b98adb49ae2e1781753bf22d33729ac0.
-rw-r--r--ruby.c2
-rw-r--r--test/ruby/test_rubyoptions.rb15
-rw-r--r--version.h2
3 files changed, 16 insertions, 3 deletions
diff --git a/ruby.c b/ruby.c
index 0288867fde..611d887cee 100644
--- a/ruby.c
+++ b/ruby.c
@@ -571,6 +571,8 @@ translit_char_bin(char *p, int from, int to)
#endif
#ifdef _WIN32
+# undef chdir
+# define chdir rb_w32_uchdir
# define UTF8_PATH 1
#endif
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 6d80ec7a7b..b256a70ba3 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -227,7 +227,7 @@ class TestRubyOptions < Test::Unit::TestCase
def test_kanji
assert_in_out_err(%w(-KU), "p '\u3042'") do |r, e|
- assert_equal("\"\u3042\"", r.join.force_encoding(Encoding::UTF_8))
+ assert_equal("\"\u3042\"", r.join('').force_encoding(Encoding::UTF_8))
end
line = '-eputs"\xc2\xa1".encoding'
env = {'RUBYOPT' => nil}
@@ -353,9 +353,20 @@ class TestRubyOptions < Test::Unit::TestCase
d = Dir.tmpdir
assert_in_out_err(["-C", d, "-e", "puts Dir.pwd"]) do |r, e|
- assert_file.identical?(r.join, d)
+ assert_file.identical?(r.join(''), d)
assert_equal([], e)
end
+
+ Dir.mktmpdir(d) do |base|
+ # "test" in Japanese and N'Ko
+ test = base + "/\u{30c6 30b9 30c8}_\u{7e1 7ca 7dd 7cc 7df 7cd 7eb}"
+ Dir.mkdir(test)
+ assert_in_out_err(["-C", base, "-C", File.basename(test), "-e", "puts Dir.pwd"]) do |r, e|
+ assert_file.identical?(r.join(''), test)
+ assert_equal([], e)
+ end
+ Dir.rmdir(test)
+ end
end
def test_yydebug
diff --git a/version.h b/version.h
index ec002fcd39..43e825a570 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 5
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 102
+#define RUBY_PATCHLEVEL 103
#include "ruby/version.h"
#include "ruby/internal/abi.h"