diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-03 14:40:05 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-03 14:40:05 +0000 |
commit | a75bc36dd27006ef5534da44c1cf2af4a1cbd171 (patch) | |
tree | 00fde6ce366951e07bf0b7ff00b4636d269c4cf2 | |
parent | 71b3abeba3230f123598971dc6fc945c046663da (diff) |
file.c: preserve encoding
* file.c (path_check_0): preserve encoding of path name in warning
message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | file.c | 6 | ||||
-rw-r--r-- | test/ruby/test_require.rb | 3 |
2 files changed, 6 insertions, 3 deletions
@@ -5634,9 +5634,9 @@ path_check_0(VALUE path, int execpath) && !(p && execpath && (st.st_mode & S_ISVTX)) #endif && !access(p0, W_OK)) { - rb_warn("Insecure world writable dir %s in %sPATH, mode 0%" - PRI_MODET_PREFIX"o", - p0, (execpath ? "" : "LOAD_"), st.st_mode); + rb_enc_warn(enc, "Insecure world writable dir %s in %sPATH, mode 0%" + PRI_MODET_PREFIX"o", + p0, (execpath ? "" : "LOAD_"), st.st_mode); if (p) *p = '/'; RB_GC_GUARD(path); return 0; diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 44c142e88c..7dc7b4eb49 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -170,6 +170,9 @@ class TestRequire < Test::Unit::TestCase end assert_include(e.message, "loading from unsafe path") assert_include(stderr, "Insecure world writable dir") + require_path = require_path.encode(self.class.ospath_encoding(require_path)) + assert_include(e.message, require_path) + assert_include(stderr, File.dirname(require_path)) } end |