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

ruby-changes:38877

From: hsbt <ko1@a...>
Date: Thu, 18 Jun 2015 23:21:28 +0900 (JST)
Subject: [ruby-changes:38877] hsbt:r50958 (trunk): * include/ruby/ruby.h: $SAFE=2 is now obsolete.

hsbt	2015-06-18 23:21:03 +0900 (Thu, 18 Jun 2015)

  New Revision: 50958

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

  Log:
    * include/ruby/ruby.h: $SAFE=2 is now obsolete.
    * dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c
      gc.c, io.c, process.c, safe.c, signal.c, win32/file.c:
      removed code for $SAFE=2
    * test/erb/test_erb.rb, test/fiddle/test_handle.rb
      test/ruby/test_env.rb: removed tests for $SAFE=2.

  Modified files:
    trunk/ChangeLog
    trunk/dir.c
    trunk/ext/fiddle/handle.c
    trunk/ext/socket/basicsocket.c
    trunk/file.c
    trunk/gc.c
    trunk/include/ruby/ruby.h
    trunk/io.c
    trunk/process.c
    trunk/safe.c
    trunk/signal.c
    trunk/test/erb/test_erb.rb
    trunk/test/fiddle/test_handle.rb
    trunk/test/ruby/test_env.rb
    trunk/win32/file.c
Index: include/ruby/ruby.h
===================================================================
--- include/ruby/ruby.h	(revision 50957)
+++ include/ruby/ruby.h	(revision 50958)
@@ -572,15 +572,15 @@ VALUE rb_get_path(VALUE); https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L572
 VALUE rb_get_path_no_checksafe(VALUE);
 #define FilePathStringValue(v) ((v) = rb_get_path_no_checksafe(v))
 
-#define RUBY_SAFE_LEVEL_MAX 2
+#define RUBY_SAFE_LEVEL_MAX 1
 void rb_secure(int);
 int rb_safe_level(void);
 void rb_set_safe_level(int);
 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
-int ruby_safe_level_3_error(void) __attribute__((error("$SAFE=3 and 4 is obsolete")));
-int ruby_safe_level_3_warning(void) __attribute__((warning("$SAFE=3 and 4 is obsolete")));
+int ruby_safe_level_2_error(void) __attribute__((error("$SAFE=2 to 4 are obsolete")));
+int ruby_safe_level_2_warning(void) __attribute__((warning("$SAFE=2 to 4 are obsolete")));
 # ifdef RUBY_EXPORT
-#   define ruby_safe_level_3_warning() ruby_safe_level_3_error()
+#   define ruby_safe_level_2_warning() ruby_safe_level_2_error()
 # endif
 #if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
 # define RUBY_SAFE_LEVEL_INVALID_P(level) \
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50957)
+++ ChangeLog	(revision 50958)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 18 23:20:46 2015  SHIBATA Hiroshi  <hsbt@r...>
+
+	* include/ruby/ruby.h: $SAFE=2 is now obsolete.
+
+	* dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c
+	  gc.c, io.c, process.c, safe.c, signal.c, win32/file.c:
+	  removed code for $SAFE=2
+
+	* test/erb/test_erb.rb, test/fiddle/test_handle.rb
+	  test/ruby/test_env.rb: removed tests for $SAFE=2.
+
 Thu Jun 18 22:50:07 2015  Yusuke Endoh  <mame@r...>
 
 	* enc/make_encmake.rb: added --transes and --no-transes options.
Index: io.c
===================================================================
--- io.c	(revision 50957)
+++ io.c	(revision 50958)
@@ -9130,8 +9130,6 @@ rb_ioctl(VALUE io, VALUE req, VALUE arg) https://github.com/ruby/ruby/blob/trunk/io.c#L9130
     long narg;
     int retval;
 
-    rb_secure(2);
-
     narg = setup_narg(cmd, &arg, 1);
     GetOpenFile(io, fptr);
     retval = do_ioctl(fptr->fd, cmd, narg);
@@ -9219,8 +9217,6 @@ rb_fcntl(VALUE io, VALUE req, VALUE arg) https://github.com/ruby/ruby/blob/trunk/io.c#L9217
     long narg;
     int retval;
 
-    rb_secure(2);
-
     narg = setup_narg(cmd, &arg, 0);
     GetOpenFile(io, fptr);
     retval = do_fcntl(fptr->fd, cmd, narg);
@@ -9339,7 +9335,6 @@ rb_f_syscall(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/io.c#L9335
 	rb_warning("We plan to remove a syscall function at future release. DL(Fiddle) provides safer alternative.");
     }
 
-    rb_secure(2);
     if (argc == 0)
 	rb_raise(rb_eArgError, "too few arguments for syscall");
     if (argc > numberof(arg))
Index: dir.c
===================================================================
--- dir.c	(revision 50957)
+++ dir.c	(revision 50958)
@@ -941,7 +941,6 @@ dir_s_chdir(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/dir.c#L941
 {
     VALUE path = Qnil;
 
-    rb_secure(2);
     if (rb_scan_args(argc, argv, "01", &path) == 1) {
 	FilePathValue(path);
 	path = rb_str_encode_ospath(path);
@@ -1013,7 +1012,6 @@ check_dirname(volatile VALUE *dir) https://github.com/ruby/ruby/blob/trunk/dir.c#L1012
     long len;
     rb_encoding *enc;
 
-    rb_secure(2);
     FilePathValue(d);
     enc = rb_enc_get(d);
     RSTRING_GETMEM(d, path, len);
Index: win32/file.c
===================================================================
--- win32/file.c	(revision 50957)
+++ win32/file.c	(revision 50958)
@@ -664,7 +664,6 @@ rb_readlink(VALUE path) https://github.com/ruby/ruby/blob/trunk/win32/file.c#L664
     rb_encoding *enc;
     UINT cp, path_cp;
 
-    rb_secure(2);
     FilePathValue(path);
     enc = rb_enc_get(path);
     cp = path_cp = code_page(enc);
Index: gc.c
===================================================================
--- gc.c	(revision 50957)
+++ gc.c	(revision 50958)
@@ -7012,7 +7012,6 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/gc.c#L7012
 gc_stress_set_m(VALUE self, VALUE flag)
 {
     rb_objspace_t *objspace = &rb_objspace;
-    rb_secure(2);
     gc_stress_set(objspace, flag);
     return flag;
 }
Index: process.c
===================================================================
--- process.c	(revision 50957)
+++ process.c	(revision 50958)
@@ -377,7 +377,6 @@ parent_redirect_close(int fd) https://github.com/ruby/ruby/blob/trunk/process.c#L377
 static VALUE
 get_pid(void)
 {
-    rb_secure(2);
     return PIDT2NUM(getpid());
 }
 
@@ -401,7 +400,6 @@ get_pid(void) https://github.com/ruby/ruby/blob/trunk/process.c#L400
 static VALUE
 get_ppid(void)
 {
-    rb_secure(2);
     return PIDT2NUM(getppid());
 }
 
@@ -936,7 +934,6 @@ proc_wait(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L934
     rb_pid_t pid;
     int flags, status;
 
-    rb_secure(2);
     flags = 0;
     if (argc == 0) {
 	pid = -1;
@@ -1010,7 +1007,6 @@ proc_waitall(void) https://github.com/ruby/ruby/blob/trunk/process.c#L1007
     rb_pid_t pid;
     int status;
 
-    rb_secure(2);
     result = rb_ary_new();
     rb_last_status_clear();
 
@@ -1106,7 +1102,6 @@ rb_detach_process(rb_pid_t pid) https://github.com/ruby/ruby/blob/trunk/process.c#L1102
 static VALUE
 proc_detach(VALUE obj, VALUE pid)
 {
-    rb_secure(2);
     return rb_detach_process(NUM2PIDT(pid));
 }
 
@@ -1652,8 +1647,6 @@ rb_execarg_addopt(VALUE execarg_obj, VAL https://github.com/ruby/ruby/blob/trunk/process.c#L1647
     int rtype;
 #endif
 
-    rb_secure(2);
-
     switch (TYPE(key)) {
       case T_SYMBOL:
         if (!(id = rb_check_id(&key))) return ST_STOP;
@@ -3657,8 +3650,6 @@ rb_f_fork(VALUE obj) https://github.com/ruby/ruby/blob/trunk/process.c#L3650
 {
     rb_pid_t pid;
 
-    rb_secure(2);
-
     switch (pid = rb_fork_ruby(NULL)) {
       case 0:
 	rb_thread_atfork();
@@ -4365,7 +4356,6 @@ proc_getpgrp(void) https://github.com/ruby/ruby/blob/trunk/process.c#L4356
 {
     rb_pid_t pgrp;
 
-    rb_secure(2);
 #if defined(HAVE_GETPGRP) && defined(GETPGRP_VOID)
     pgrp = getpgrp();
     if (pgrp < 0) rb_sys_fail(0);
@@ -4393,7 +4383,6 @@ proc_getpgrp(void) https://github.com/ruby/ruby/blob/trunk/process.c#L4383
 static VALUE
 proc_setpgrp(void)
 {
-    rb_secure(2);
   /* check for posix setpgid() first; this matches the posix */
   /* getpgrp() above.  It appears that configure will set SETPGRP_VOID */
   /* even though setpgrp(0,0) would be preferred. The posix call avoids */
@@ -4426,7 +4415,6 @@ proc_getpgid(VALUE obj, VALUE pid) https://github.com/ruby/ruby/blob/trunk/process.c#L4415
 {
     rb_pid_t i;
 
-    rb_secure(2);
     i = getpgid(NUM2PIDT(pid));
     if (i < 0) rb_sys_fail(0);
     return PIDT2NUM(i);
@@ -4450,7 +4438,6 @@ proc_setpgid(VALUE obj, VALUE pid, VALUE https://github.com/ruby/ruby/blob/trunk/process.c#L4438
 {
     rb_pid_t ipid, ipgrp;
 
-    rb_secure(2);
     ipid = NUM2PIDT(pid);
     ipgrp = NUM2PIDT(pgrp);
 
@@ -4481,7 +4468,6 @@ proc_getsid(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L4468
     rb_pid_t sid;
     VALUE pid;
 
-    rb_secure(2);
     rb_scan_args(argc, argv, "01", &pid);
 
     if (NIL_P(pid))
@@ -4517,7 +4503,6 @@ proc_setsid(void) https://github.com/ruby/ruby/blob/trunk/process.c#L4503
 {
     rb_pid_t pid;
 
-    rb_secure(2);
     pid = setsid();
     if (pid < 0) rb_sys_fail(0);
     return PIDT2NUM(pid);
@@ -4578,7 +4563,6 @@ proc_getpriority(VALUE obj, VALUE which, https://github.com/ruby/ruby/blob/trunk/process.c#L4563
 {
     int prio, iwhich, iwho;
 
-    rb_secure(2);
     iwhich = NUM2INT(which);
     iwho   = NUM2INT(who);
 
@@ -4610,7 +4594,6 @@ proc_setpriority(VALUE obj, VALUE which, https://github.com/ruby/ruby/blob/trunk/process.c#L4594
 {
     int iwhich, iwho, iprio;
 
-    rb_secure(2);
     iwhich = NUM2INT(which);
     iwho   = NUM2INT(who);
     iprio  = NUM2INT(prio);
@@ -4850,8 +4833,6 @@ proc_getrlimit(VALUE obj, VALUE resource https://github.com/ruby/ruby/blob/trunk/process.c#L4833
 {
     struct rlimit rlim;
 
-    rb_secure(2);
-
     if (getrlimit(rlimit_resource_type(resource), &rlim) < 0) {
 	rb_sys_fail("getrlimit");
     }
@@ -4919,8 +4900,6 @@ proc_setrlimit(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/process.c#L4900
     VALUE resource, rlim_cur, rlim_max;
     struct rlimit rlim;
 
-    rb_secure(2);
-
     rb_scan_args(argc, argv, "21", &resource, &rlim_cur, &rlim_max);
     if (rlim_max == Qnil)
         rlim_max = rlim_cur;
@@ -4941,7 +4920,6 @@ static int under_uid_switch = 0; https://github.com/ruby/ruby/blob/trunk/process.c#L4920
 static void
 check_uid_switch(void)
 {
-    rb_secure(2);
     if (under_uid_switch) {
 	rb_raise(rb_eRuntimeError, "can't handle UID while evaluating block given to Process::UID.switch method");
     }
@@ -4951,7 +4929,6 @@ static int under_gid_switch = 0; https://github.com/ruby/ruby/blob/trunk/process.c#L4929
 static void
 check_gid_switch(void)
 {
-    rb_secure(2);
     if (under_gid_switch) {
 	rb_raise(rb_eRuntimeError, "can't handle GID while evaluating block given to Process::UID.switch method");
     }
@@ -5650,7 +5627,6 @@ p_sys_setresgid(VALUE obj, VALUE rid, VA https://github.com/ruby/ruby/blob/trunk/process.c#L5627
 static VALUE
 p_sys_issetugid(VALUE obj)
 {
-    rb_secure(2);
     if (issetugid()) {
 	return Qtrue;
     }
@@ -5965,7 +5941,6 @@ proc_daemon(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L5941
     VALUE nochdir, noclose;
     int n;
 
-    rb_secure(2);
     rb_scan_args(argc, argv, "02", &nochdir, &noclose);
 
     prefork();
Index: ext/fiddle/handle.c
===================================================================
--- ext/fiddle/handle.c	(revision 50957)
+++ ext/fiddle/handle.c	(revision 50958)
@@ -154,8 +154,6 @@ rb_fiddle_handle_initialize(int argc, VA https://github.com/ruby/ruby/blob/trunk/ext/fiddle/handle.c#L154
 	rb_bug("rb_fiddle_handle_new");
     }
 
-    rb_secure(2);
-
 #if defined(_WIN32)
     if( !clib ){
 	HANDLE rb_libruby_handle(void);
@@ -320,7 +318,6 @@ fiddle_handle_sym(void *handle, const ch https://github.com/ruby/ruby/blob/trunk/ext/fiddle/handle.c#L318
 #endif
     void (*func)();
 
-    rb_secure(2);
 #ifdef HAVE_DLERROR
     dlerror();
 #endif
Index: ext/socket/basicsocket.c
===================================================================
--- ext/socket/basicsocket.c	(revision 50957)
+++ ext/socket/basicsocket.c	(revision 50958)
@@ -213,7 +213,6 @@ bsock_setsockopt(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/socket/basicsocket.c#L213
         rb_scan_args(argc, argv, "30", &lev, &optname, &val);
     }
 
-    rb_secure(2);
     GetOpenFile(sock, fptr);
     family = rsock_getfamily(fptr->fd);
     level = rsock_level_arg(family, lev);
Index: safe.c
===================================================================
--- safe.c	(revision 50957)
+++ safe.c	(revision 50958)
@@ -24,12 +24,12 @@ https://github.com/ruby/ruby/blob/trunk/safe.c#L24
 
 #undef rb_secure
 #undef rb_set_safe_level
-#undef ruby_safe_level_3_warning
+#undef ruby_safe_level_2_warning
 
 int
-ruby_safe_level_3_warning(void)
+ruby_safe_level_2_warning(void)
 {
-    return 3;
+    return 2;
 }
 
 int
@@ -51,7 +51,7 @@ rb_set_safe_level(int level) https://github.com/ruby/ruby/blob/trunk/safe.c#L51
 
     if (level > th->safe_level) {
 	if (level > SAFE_LEVEL_MAX) {
-	    rb_raise(rb_eArgError, "$SAFE=3 and 4 is obsolete");
+	    rb_raise(rb_eArgError, "$SAFE=2 to 4 are obsolete");
 	}
 	th->safe_level = level;
     }
@@ -75,7 +75,7 @@ safe_setter(VALUE val) https://github.com/ruby/ruby/blob/trunk/safe.c#L75
 		 th->safe_level, level);
     }
     if (level > SAFE_LEVEL_MAX) {
-	rb_raise(rb_eArgError, "$SAFE=3 and 4 is obsolete");
+	rb_raise(rb_eArgError, "$SAFE=2 to 4 are obsolete");
     }
     th->safe_level = level;
 }
Index: test/ruby/test_env.rb
===================================================================
--- test/ruby/test_env.rb	(revision 50957)
+++ test/ruby/test_env.rb	(revision 50958)
@@ -444,87 +444,6 @@ class TestEnv < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_env.rb#L444
     end
   end
 
-  def test_taint_aref
-    assert_raise(SecurityError) do
-      proc do
-        $SAFE = 2
-        ENV["FOO".taint]
-      end.call
-    end
-  end
-
-  def test_taint_fetch
-    assert_raise(SecurityError) do
-      proc do
-        $SAFE = 2
-        ENV.fetch("FOO".taint)
-      end.call
-    end
-  end
-
-  def test_taint_assoc
-    assert_raise(SecurityError) do
-      proc do
-        $SAFE = 2
-        ENV.assoc("FOO".taint)
-      end.call
-    end
-  end
-
-  def test_taint_rassoc
-    assert_raise(SecurityError) do
-      proc do
-        $SAFE = 2
-        ENV.rassoc("FOO".taint)
-      end.call
-    end
-  end
-
-  def test_taint_key
-    assert_raise(SecurityError) do
-      proc do
-        $SAFE = 2
-        ENV.key("FOO".taint)
-      end.call
-    end
-  end
-
-  def test_taint_key_p
-    assert_raise(SecurityError) do
-      proc do
-        $SAFE = 2
-        ENV.key?("FOO".taint)
-      end.call
-    end
-  end
-
-  def test_taint_value_p
-    assert_raise(SecurityError) do
-      proc do
-        $SAFE = 2
-        ENV.value?("FOO".taint)
-      end.call
-    end
-  end
-
-  def test_taint_aset_value
-    assert_raise(SecurityError) do
-      proc do
-        $SAFE = 2
-        ENV["FOO"] = "BAR".taint
-      end.call
-    end
-  end
-
-  def test_taint_aset_key
-    assert_raise(SecurityError) do
-      proc do
-        $SAFE = 2
-        ENV["FOO".taint] = "BAR"
-      end.call
-    end
-  end
-
   if RUBY_PLATFORM =~ /bccwin|mswin|mingw/
     def test_memory_leak_aset
       bug9977 = '[ruby-dev:48323] [Bug #9977]'
Index: test/fiddle/test_handle.rb
===================================================================
--- test/fiddle/test_handle.rb	(revision 50957)
+++ test/fiddle/test_handle.rb	(revision 50958)
@@ -14,15 +14,6 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_handle.rb#L14
       assert_kind_of Integer, handle.to_i
     end
 
-    def test_static_sym_secure
-      assert_raises(SecurityError) do
-        Thread.new do
-          $SAFE = 2
-          Fiddle::Handle.sym('calloc')
-        end.join
-      end
-    end
-
     def test_static_sym_unknown
       assert_raises(DLError) { Fiddle::Handle.sym('fooo') }
       assert_raises(DLError) { Fiddle::Handle['fooo'] }
@@ -66,16 +57,6 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_handle.rb#L57
       assert_raises(TypeError) { handle[nil] }
     end
 
-    def test_sym_secure
-      assert_raises(SecurityError) do
-        Thread.new do
-          $SAFE = 2
-          handle = Handle.new(LIBC_SO)
-          handle.sym('calloc')
-        end.join
-      end
-    end
-
     def test_sym
       handle = Handle.new(LIBC_SO)
       refute_nil handle.sym('calloc')
@@ -99,24 +80,6 @@ module Fiddle https://github.com/ruby/ruby/blob/trunk/test/fiddle/test_handle.rb#L80
       assert_instance_of Handle, dlopen(LIBC_SO)
     end
 
-    def test_dlopen_safe
-      assert_raises(SecurityError) do
-        Thread.new do
-          $SAFE = 2
-          dlopen(LIBC_SO)
-        end.join
-      end
-    end
-
-    def test_initialize_safe
-      assert_raises(SecurityError) do
-        Thread.new do
-          $SAFE = 2
-          Handle.new(LIBC_SO)
-        end.join
-      end
-    end
-
     def test_initialize_noargs
       handle = Handle.new
       refute_nil handle['rb_str_new']
Index: test/erb/test_erb.rb
===================================================================
--- test/erb/test_erb.rb	(revision 50957)
+++ test/erb/test_erb.rb	(revision 50958)
@@ -89,7 +89,6 @@ class TestERBCore < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/erb/test_erb.rb#L89
     _test_core(nil)
     _test_core(0)
     _test_core(1)
-    _test_core(2)
   end
 
   def _test_core(safe)
Index: signal.c
===================================================================
--- signal.c	(revision 50957)
+++ signal.c	(revision 50958)
@@ -418,7 +418,6 @@ rb_f_kill(int argc, const VALUE *argv) https://github.com/ruby/ruby/blob/trunk/signal.c#L418
     VALUE str;
     const char *s;
 
-    rb_secure(2);
     rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
 
     switch (TYPE(argv[0])) {
@@ -1280,7 +1279,6 @@ sig_trap(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/signal.c#L1279
     sighandler_t func;
     VALUE cmd;
 
-    rb_secure(2);
     rb_check_arity(argc, 1, 2);
 
     sig = trap_signm(argv[0]);
Index: file.c
===================================================================
--- file.c	(revision 50957)
+++ file.c	(revision 50958)
@@ -1014,7 +1014,6 @@ rb_stat(VALUE file, struct stat *st) https://github.com/ruby/ruby/blob/trunk/file.c#L1014
 {
     VALUE tmp;
 
-    rb_secure(2);
     tmp = rb_check_convert_type(file, T_FILE, "IO", "to_io");
     if (!NIL_P(tmp)) {
 	rb_io_t *fptr;
@@ -1159,7 +1158,6 @@ rb_file_s_lstat(VALUE klass, VALUE fname https://github.com/ruby/ruby/blob/trunk/file.c#L1158
 #ifdef HAVE_LSTAT
     struct stat st;
 
-    rb_secure(2);
     FilePathValue(fname);
     fname = rb_str_encode_ospath(fname);
     if (lstat(StringValueCStr(fname), &st) == -1) {
@@ -1193,7 +1191,6 @@ rb_file_lstat(VALUE obj) https://github.com/ruby/ruby/blob/trunk/file.c#L1191
     struct stat st;
     VALUE path;
 
-    rb_secure(2);
     GetOpenFile(obj, fptr);
     if (NIL_P(fptr->pathv)) return Qnil;
     path = rb_str_encode_ospath(fptr->pathv);
@@ -1407,7 +1404,6 @@ rb_file_symlink_p(VALUE obj, VALUE fname https://github.com/ruby/ruby/blob/trunk/file.c#L1404
 #ifdef S_ISLNK
     struct stat st;
 
-    rb_secure(2);
     FilePathValue(fname);
     fname = rb_str_encode_ospath(fname);
     if (lstat(StringValueCStr(fname), &st) < 0) return Qfalse;
@@ -1559,7 +1555,6 @@ rb_file_exists_p(VALUE obj, VALUE fname) https://github.com/ruby/ruby/blob/trunk/file.c#L1555
 static VALUE
 rb_file_readable_p(VALUE obj, VALUE fname)
 {
-    rb_secure(2);
     FilePathValue(fname);
     fname = rb_str_encode_ospath(fname);
     if (eaccess(StringValueCStr(fname), R_OK) < 0) return Qfalse;
@@ -1577,7 +1572,6 @@ rb_file_readable_p(VALUE obj, VALUE fnam https://github.com/ruby/ruby/blob/trunk/file.c#L1572
 static VALUE
 rb_file_readable_real_p(VALUE obj, VALUE fname)
 {
-    rb_secure(2);
     FilePathValue(fname);
     fname = rb_str_encode_ospath(fname);
     if (access(StringValueCStr(fname), R_OK) < 0) return Qfalse;
@@ -1633,7 +1627,6 @@ rb_file_world_readable_p(VALUE obj, VALU https://github.com/ruby/ruby/blob/trunk/file.c#L1627
 static VALUE
 rb_file_writable_p(VALUE obj, VALUE fname)
 {
-    rb_secure(2);
     FilePathValue(fname);
     fname = rb_str_encode_ospath(fname);
     if (eaccess(StringValueCStr(fname), W_OK) < 0) return Qfalse;
@@ -1651,7 +1644,6 @@ rb_file_writable_p(VALUE obj, VALUE fnam https://github.com/ruby/ruby/blob/trunk/file.c#L1644
 static VALUE
 rb_file_writable_real_p(VALUE obj, VALUE fname)
 {
-    rb_secure(2);
     FilePathValue(fname);
     fname = rb_str_encode_ospath(fname);
     if (access(StringValueCStr(fname), W_OK) < 0) return Qfalse;
@@ -1699,7 +1691,6 @@ rb_file_world_writable_p(VALUE obj, VALU https://github.com/ruby/ruby/blob/trunk/file.c#L1691
 static VALUE
 rb_file_executable_p(VALUE obj, VALUE fname)
 {
-    rb_secure(2);
     FilePathValue(fname);
     fname = rb_str_encode_ospath(fname);
     if (eaccess(StringValueCStr(fname), X_OK) < 0) return Qfalse;
@@ -1717,7 +1708,6 @@ rb_file_executable_p(VALUE obj, VALUE fn https://github.com/ruby/ruby/blob/trunk/file.c#L1708
 stat (... truncated)

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

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