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

ruby-changes:46882

From: nobu <ko1@a...>
Date: Fri, 2 Jun 2017 13:10:40 +0900 (JST)
Subject: [ruby-changes:46882] nobu:r58997 (trunk): test_require.rb: filesystem encoding

nobu	2017-06-02 13:10:36 +0900 (Fri, 02 Jun 2017)

  New Revision: 58997

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58997

  Log:
    test_require.rb: filesystem encoding
    
    * test/ruby/test_require.rb (assert_require_nonascii_path): the
      path in error message is converted to filesystem encoding.

  Modified files:
    trunk/test/ruby/test_require.rb
Index: test/ruby/test_require.rb
===================================================================
--- test/ruby/test_require.rb	(revision 58996)
+++ test/ruby/test_require.rb	(revision 58997)
@@ -92,7 +92,6 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L92
       nil
     else
       proc do |require_path|
-        File.chmod(0777, File.dirname(require_path))
         $SAFE = 1
         require(require_path)
       end
@@ -123,8 +122,9 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L122
         $:.replace(load_path)
         $".replace(features)
         if SECURITY_WARNING
+          File.chmod(0777, File.dirname(require_path))
           require_path.untaint
-          ospath = require_path.encode(self.class.ospath_encoding(require_path))
+          ospath = require_path.encode('filesystem')
           assert_warn(/Insecure world writable dir/) do
             assert_raise_with_message(SecurityError, "loading from unsafe path #{ospath}") do
               SECURITY_WARNING.call(require_path)

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

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