aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--file.c6
-rw-r--r--test/ruby/test_require.rb3
2 files changed, 6 insertions, 3 deletions
diff --git a/file.c b/file.c
index 7d2d9e88bf..31e5971894 100644
--- a/file.c
+++ b/file.c
@@ -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