[前][次][番号順一覧][スレッド一覧]

ruby-changes:60795

From: Nobuyoshi <ko1@a...>
Date: Thu, 16 Apr 2020 23:40:38 +0900 (JST)
Subject: [ruby-changes:60795] f57e2d7296 (master): Preserve encoding in error message for invalid env exec option

https://git.ruby-lang.org/ruby.git/commit/?id=f57e2d7296

From f57e2d7296fbdf09041bdb237c7423a12ef06621 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 16 Apr 2020 20:40:19 +0900
Subject: Preserve encoding in error message for invalid env exec option


diff --git a/process.c b/process.c
index f13ec82..129a2e6 100644
--- a/process.c
+++ b/process.c
@@ -2325,7 +2325,7 @@ check_exec_env_i(st_data_t st_key, st_data_t st_val, st_data_t arg) https://github.com/ruby/ruby/blob/trunk/process.c#L2325
 
     k = StringValueCStr(key);
     if (strchr(k, '='))
-        rb_raise(rb_eArgError, "environment name contains a equal : %s", k);
+        rb_raise(rb_eArgError, "environment name contains a equal : %"PRIsVALUE, key);
 
     if (!NIL_P(val))
         StringValueCStr(val);
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index e9c7ee6..7170e82 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -342,6 +342,9 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L342
     assert_raise_with_message(ArgumentError, /fo=fo/) {
       system({"fo=fo"=>"ha"}, *ENVCOMMAND)
     }
+    assert_raise_with_message(ArgumentError, /\u{30c0}=\u{30e1}/) {
+      system({"\u{30c0}=\u{30e1}"=>"ha"}, *ENVCOMMAND)
+    }
   end
 
   def test_execopt_env_path
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]