diff options
-rw-r--r-- | error.c | 13 | ||||
-rw-r--r-- | hash.c | 7 | ||||
-rw-r--r-- | include/ruby/internal/fl_type.h | 6 | ||||
-rw-r--r-- | include/ruby/internal/intern/error.h | 2 | ||||
-rw-r--r-- | include/ruby/internal/intern/hash.h | 9 | ||||
-rw-r--r-- | include/ruby/internal/intern/object.h | 68 | ||||
-rw-r--r-- | include/ruby/internal/intern/string.h | 64 | ||||
-rw-r--r-- | object.c | 98 | ||||
-rw-r--r-- | spec/ruby/optional/capi/ext/object_spec.c | 4 | ||||
-rw-r--r-- | spec/ruby/optional/capi/ext/rubyspec.h | 4 | ||||
-rw-r--r-- | spec/ruby/optional/capi/ext/string_spec.c | 4 | ||||
-rw-r--r-- | string.c | 15 | ||||
-rw-r--r-- | test/-ext-/string/test_fstring.rb | 14 | ||||
-rw-r--r-- | test/ruby/test_exception.rb | 12 |
14 files changed, 12 insertions, 308 deletions
@@ -3393,19 +3393,6 @@ rb_check_frozen(VALUE obj) } void -rb_error_untrusted(VALUE obj) -{ - rb_warn_deprecated_to_remove_at(3.2, "rb_error_untrusted", NULL); -} - -#undef rb_check_trusted -void -rb_check_trusted(VALUE obj) -{ - rb_warn_deprecated_to_remove_at(3.2, "rb_check_trusted", NULL); -} - -void rb_check_copyable(VALUE obj, VALUE orig) { if (!FL_ABLE(obj)) return; @@ -5043,13 +5043,6 @@ env_fetch(int argc, VALUE *argv, VALUE _) return env; } -int -rb_env_path_tainted(void) -{ - rb_warn_deprecated_to_remove_at(3.2, "rb_env_path_tainted", NULL); - return 0; -} - #if defined(_WIN32) || (defined(HAVE_SETENV) && defined(HAVE_UNSETENV)) #elif defined __sun static int diff --git a/include/ruby/internal/fl_type.h b/include/ruby/internal/fl_type.h index 08405d6f30..c51bd2e9d9 100644 --- a/include/ruby/internal/fl_type.h +++ b/include/ruby/internal/fl_type.h @@ -451,12 +451,6 @@ enum { RBIMPL_SYMBOL_EXPORT_BEGIN() /** - * @deprecated Does nothing. This method is deprecated and will be removed in - * Ruby 3.2. - */ -void rb_obj_infect(VALUE victim, VALUE carrier); - -/** * This is an implementation detail of #RB_OBJ_FREEZE(). People don't use it * directly. * diff --git a/include/ruby/internal/intern/error.h b/include/ruby/internal/intern/error.h index 37d3b8592b..b255abb82b 100644 --- a/include/ruby/internal/intern/error.h +++ b/include/ruby/internal/intern/error.h @@ -38,8 +38,6 @@ #define rb_exc_new3 rb_exc_new_str /**< @old{rb_exc_new_str} */ /** @cond INTERNAL_MACRO */ -#define rb_check_trusted rb_check_trusted -#define rb_check_trusted_inline rb_check_trusted #define rb_check_arity rb_check_arity /** @endcond */ diff --git a/include/ruby/internal/intern/hash.h b/include/ruby/internal/intern/hash.h index 9d2ce8279a..3cce7f61c7 100644 --- a/include/ruby/internal/intern/hash.h +++ b/include/ruby/internal/intern/hash.h @@ -288,15 +288,6 @@ int rb_path_check(const char *path); /* hash.c */ /** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @return 0 always. - */ -int rb_env_path_tainted(void); - -/** * Destructively removes every environment variables of the running process. * * @return The `ENV` object. diff --git a/include/ruby/internal/intern/object.h b/include/ruby/internal/intern/object.h index 6bb4ccb2fe..19af49b140 100644 --- a/include/ruby/internal/intern/object.h +++ b/include/ruby/internal/intern/object.h @@ -202,74 +202,6 @@ VALUE rb_obj_dup(VALUE obj); */ VALUE rb_obj_init_copy(VALUE src, VALUE dst); -RBIMPL_ATTR_DEPRECATED_EXT(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - * @return Verbatim `obj`. - */ -VALUE rb_obj_taint(VALUE obj); - -RBIMPL_ATTR_PURE() -RBIMPL_ATTR_DEPRECATED_EXT(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - * @return Always returns ::RUBY_Qfalse. - */ -VALUE rb_obj_tainted(VALUE obj); - -RBIMPL_ATTR_DEPRECATED_EXT(("taintedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - * @return Verbatim `obj`. - */ -VALUE rb_obj_untaint(VALUE obj); - -RBIMPL_ATTR_DEPRECATED_EXT(("trustedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - * @return Verbatim `obj`. - */ -VALUE rb_obj_untrust(VALUE obj); - -RBIMPL_ATTR_PURE() -RBIMPL_ATTR_DEPRECATED_EXT(("trustedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - * @return Always returns ::RUBY_Qfalse. - */ -VALUE rb_obj_untrusted(VALUE obj); - -RBIMPL_ATTR_DEPRECATED_EXT(("trustedness turned out to be a wrong idea.")) -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] obj Object in question. - * @return Verbatim `obj`. - */ -VALUE rb_obj_trust(VALUE obj); - /** * Just calls rb_obj_freeze_inline() inside. Does this make any sens to * extension libraries? diff --git a/include/ruby/internal/intern/string.h b/include/ruby/internal/intern/string.h index 2ee8496256..3083125e56 100644 --- a/include/ruby/internal/intern/string.h +++ b/include/ruby/internal/intern/string.h @@ -123,37 +123,6 @@ VALUE rb_str_new_frozen(VALUE str); VALUE rb_str_new_with_class(VALUE obj, const char *ptr, long len); /** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] ptr A C string. - * @exception rb_eNoMemError Failed to allocate memory. - * @exception rb_eArgError `ptr` is a null pointer. - * @return An instance of ::rb_cString, of "binary" encoding, whose - * contents are verbatim copy of `ptr`. - * @pre `ptr` must not be a null pointer. - */ -VALUE rb_tainted_str_new_cstr(const char *ptr); - -/** - * @deprecated This function once was a thing in the old days, but makes no - * sense any longer today. Exists here for backwards - * compatibility only. You can safely forget about it. - * - * @param[in] ptr A memory region of `len` bytes length. - * @param[in] len Length of `ptr`, in bytes, not including the - * terminating NUL character. - * @exception rb_eNoMemError Failed to allocate `len+1` bytes. - * @exception rb_eArgError `len` is negative. - * @return An instance of ::rb_cString, of `len` bytes length, of - * "binary" encoding, whose contents are verbatim copy of `ptr`. - * @pre At least `len` bytes of continuous memory region shall be - * accessible via `ptr`. - */ -VALUE rb_tainted_str_new(const char *ptr, long len); - -/** * Identical to rb_str_new(), except it generates a string of "default * external" encoding. * @@ -1398,22 +1367,6 @@ rbimpl_str_new_cstr(const char *str) return rb_str_new_static(str, len); } -RBIMPL_ATTR_DEPRECATED(("taintedness turned out to be a wrong idea.")) -/** - * @private - * - * This is an implementation detail. Don't bother. - * - * @param[in] str A C string literal. - * @return Corresponding Ruby string. - */ -static inline VALUE -rbimpl_tainted_str_new_cstr(const char *str) -{ - long len = rbimpl_strlen(str); - return rb_tainted_str_new(str, len); -} - RBIMPL_ATTR_NONNULL(()) /** * @private @@ -1600,22 +1553,6 @@ rbimpl_exc_new_cstr(VALUE exc, const char *str) rb_utf8_str_new) ((str), (len))) /** - * @deprecated This macro once was a thing in the old days, but makes no sense - * any longer today. Exists here for backwards compatibility - * only. You can safely forget about it. - * - * @param[in] str A C string. - * @exception rb_eNoMemError Failed to allocate memory. - * @return An instance of ::rb_cString, of "binary" encoding, whose - * contents are verbatim copy of `str`. - * @pre `str` must not be a null pointer. - */ -#define rb_tainted_str_new_cstr(str) \ - ((RBIMPL_CONSTANT_P(str) ? \ - rbimpl_tainted_str_new_cstr : \ - rb_tainted_str_new_cstr) (str)) - -/** * Identical to #rb_str_new_cstr, except it generates a string of "US ASCII" * encoding. It can also be seen as a routine Identical to * #rb_usascii_str_new, except it assumes the passed pointer is a pointer to a @@ -1739,7 +1676,6 @@ rbimpl_exc_new_cstr(VALUE exc, const char *str) #define rb_str_new3 rb_str_new_shared /**< @old{rb_str_new_shared} */ #define rb_str_new4 rb_str_new_frozen /**< @old{rb_str_new_frozen} */ #define rb_str_new5 rb_str_new_with_class /**< @old{rb_str_new_with_class} */ -#define rb_tainted_str_new2 rb_tainted_str_new_cstr /**< @old{rb_tainted_str_new_cstr} */ #define rb_str_buf_new2 rb_str_buf_new_cstr /**< @old{rb_str_buf_new_cstr} */ #define rb_usascii_str_new2 rb_usascii_str_new_cstr /**< @old{rb_usascii_str_new_cstr} */ #define rb_str_buf_cat rb_str_cat /**< @alias{rb_str_cat} */ @@ -1102,98 +1102,6 @@ rb_obj_dummy1(VALUE _x, VALUE _y) /* * call-seq: - * obj.tainted? -> false - * - * Returns false. This method is deprecated and will be removed in Ruby 3.2. - */ - -VALUE -rb_obj_tainted(VALUE obj) -{ - rb_warn_deprecated_to_remove_at(3.2, "Object#tainted?", NULL); - return Qfalse; -} - -/* - * call-seq: - * obj.taint -> obj - * - * Returns object. This method is deprecated and will be removed in Ruby 3.2. - */ - -VALUE -rb_obj_taint(VALUE obj) -{ - rb_warn_deprecated_to_remove_at(3.2, "Object#taint", NULL); - return obj; -} - - -/* - * call-seq: - * obj.untaint -> obj - * - * Returns object. This method is deprecated and will be removed in Ruby 3.2. - */ - -VALUE -rb_obj_untaint(VALUE obj) -{ - rb_warn_deprecated_to_remove_at(3.2, "Object#untaint", NULL); - return obj; -} - -/* - * call-seq: - * obj.untrusted? -> false - * - * Returns false. This method is deprecated and will be removed in Ruby 3.2. - */ - -VALUE -rb_obj_untrusted(VALUE obj) -{ - rb_warn_deprecated_to_remove_at(3.2, "Object#untrusted?", NULL); - return Qfalse; -} - -/* - * call-seq: - * obj.untrust -> obj - * - * Returns object. This method is deprecated and will be removed in Ruby 3.2. - */ - -VALUE -rb_obj_untrust(VALUE obj) -{ - rb_warn_deprecated_to_remove_at(3.2, "Object#untrust", NULL); - return obj; -} - - -/* - * call-seq: - * obj.trust -> obj - * - * Returns object. This method is deprecated and will be removed in Ruby 3.2. - */ - -VALUE -rb_obj_trust(VALUE obj) -{ - rb_warn_deprecated_to_remove_at(3.2, "Object#trust", NULL); - return obj; -} - -void -rb_obj_infect(VALUE victim, VALUE carrier) -{ - rb_warn_deprecated_to_remove_at(3.2, "rb_obj_infect", NULL); -} - -/* - * call-seq: * obj.freeze -> obj * * Prevents further modifications to <i>obj</i>. A @@ -4549,12 +4457,6 @@ InitVM_Object(void) rb_define_method(rb_mKernel, "initialize_dup", rb_obj_init_dup_clone, 1); rb_define_method(rb_mKernel, "initialize_clone", rb_obj_init_clone, -1); - rb_define_method(rb_mKernel, "taint", rb_obj_taint, 0); - rb_define_method(rb_mKernel, "tainted?", rb_obj_tainted, 0); - rb_define_method(rb_mKernel, "untaint", rb_obj_untaint, 0); - rb_define_method(rb_mKernel, "untrust", rb_obj_untrust, 0); - rb_define_method(rb_mKernel, "untrusted?", rb_obj_untrusted, 0); - rb_define_method(rb_mKernel, "trust", rb_obj_trust, 0); rb_define_method(rb_mKernel, "freeze", rb_obj_freeze, 0); rb_define_method(rb_mKernel, "to_s", rb_any_to_s, 0); diff --git a/spec/ruby/optional/capi/ext/object_spec.c b/spec/ruby/optional/capi/ext/object_spec.c index c1f3b09ff8..6c4b66fc06 100644 --- a/spec/ruby/optional/capi/ext/object_spec.c +++ b/spec/ruby/optional/capi/ext/object_spec.c @@ -161,9 +161,11 @@ static VALUE object_specs_rb_obj_method(VALUE self, VALUE obj, VALUE method) { # endif #endif +#ifndef RUBY_VERSION_IS_3_2 static VALUE object_spec_rb_obj_taint(VALUE self, VALUE obj) { return rb_obj_taint(obj); } +#endif #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) # pragma GCC diagnostic pop @@ -448,7 +450,9 @@ void Init_object_spec(void) { rb_define_method(cls, "rb_obj_is_kind_of", so_kind_of, 2); rb_define_method(cls, "rb_obj_method_arity", object_specs_rb_obj_method_arity, 2); rb_define_method(cls, "rb_obj_method", object_specs_rb_obj_method, 2); +#ifndef RUBY_VERSION_IS_3_2 rb_define_method(cls, "rb_obj_taint", object_spec_rb_obj_taint, 1); +#endif rb_define_method(cls, "rb_require", so_require, 0); rb_define_method(cls, "rb_respond_to", so_respond_to, 2); rb_define_method(cls, "rb_method_boundp", object_spec_rb_method_boundp, 3); diff --git a/spec/ruby/optional/capi/ext/rubyspec.h b/spec/ruby/optional/capi/ext/rubyspec.h index 7e4a252b38..426b1ddc04 100644 --- a/spec/ruby/optional/capi/ext/rubyspec.h +++ b/spec/ruby/optional/capi/ext/rubyspec.h @@ -22,6 +22,10 @@ (RUBY_VERSION_MAJOR == (major) && RUBY_VERSION_MINOR < (minor)) || \ (RUBY_VERSION_MAJOR == (major) && RUBY_VERSION_MINOR == (minor) && RUBY_VERSION_TEENY < (teeny))) +#if RUBY_VERSION_MAJOR > 3 || (RUBY_VERSION_MAJOR == 3 && RUBY_VERSION_MINOR >= 2) +#define RUBY_VERSION_IS_3_2 +#endif + #if RUBY_VERSION_MAJOR > 3 || (RUBY_VERSION_MAJOR == 3 && RUBY_VERSION_MINOR >= 1) #define RUBY_VERSION_IS_3_1 #endif diff --git a/spec/ruby/optional/capi/ext/string_spec.c b/spec/ruby/optional/capi/ext/string_spec.c index 2a21304a10..2bcd3be243 100644 --- a/spec/ruby/optional/capi/ext/string_spec.c +++ b/spec/ruby/optional/capi/ext/string_spec.c @@ -261,6 +261,7 @@ VALUE string_spec_rb_str_new5(VALUE self, VALUE str, VALUE ptr, VALUE len) { # endif #endif +#ifndef RUBY_VERSION_IS_3_2 VALUE string_spec_rb_tainted_str_new(VALUE self, VALUE str, VALUE len) { return rb_tainted_str_new(RSTRING_PTR(str), FIX2INT(len)); } @@ -268,6 +269,7 @@ VALUE string_spec_rb_tainted_str_new(VALUE self, VALUE str, VALUE len) { VALUE string_spec_rb_tainted_str_new2(VALUE self, VALUE str) { return rb_tainted_str_new2(RSTRING_PTR(str)); } +#endif #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) # pragma GCC diagnostic pop @@ -629,8 +631,10 @@ void Init_string_spec(void) { rb_define_method(cls, "rb_str_new3", string_spec_rb_str_new3, 1); rb_define_method(cls, "rb_str_new4", string_spec_rb_str_new4, 1); rb_define_method(cls, "rb_str_new5", string_spec_rb_str_new5, 3); +#ifndef RUBY_VERSION_IS_3_2 rb_define_method(cls, "rb_tainted_str_new", string_spec_rb_tainted_str_new, 2); rb_define_method(cls, "rb_tainted_str_new2", string_spec_rb_tainted_str_new2, 1); +#endif rb_define_method(cls, "rb_str_plus", string_spec_rb_str_plus, 2); rb_define_method(cls, "rb_str_times", string_spec_rb_str_times, 2); rb_define_method(cls, "rb_str_modify_expand", string_spec_rb_str_modify_expand, 2); @@ -63,7 +63,6 @@ #undef rb_utf8_str_new #undef rb_enc_str_new #undef rb_str_new_cstr -#undef rb_tainted_str_new_cstr #undef rb_usascii_str_new_cstr #undef rb_utf8_str_new_cstr #undef rb_enc_str_new_cstr @@ -1036,20 +1035,6 @@ rb_enc_str_new_static(const char *ptr, long len, rb_encoding *enc) return str_new_static(rb_cString, ptr, len, rb_enc_to_index(enc)); } -VALUE -rb_tainted_str_new(const char *ptr, long len) -{ - rb_warn_deprecated_to_remove_at(3.2, "rb_tainted_str_new", NULL); - return rb_str_new(ptr, len); -} - -VALUE -rb_tainted_str_new_cstr(const char *ptr) -{ - rb_warn_deprecated_to_remove_at(3.2, "rb_tainted_str_new_cstr", NULL); - return rb_str_new_cstr(ptr); -} - static VALUE str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts); diff --git a/test/-ext-/string/test_fstring.rb b/test/-ext-/string/test_fstring.rb index 9b4956ecef..5a3456c566 100644 --- a/test/-ext-/string/test_fstring.rb +++ b/test/-ext-/string/test_fstring.rb @@ -57,18 +57,4 @@ class Test_String_Fstring < Test::Unit::TestCase str.freeze assert_fstring(str) {|s| assert_instance_of(S, s)} end - - def test_shared_string_safety - _unused = -('a' * 30).force_encoding(Encoding::ASCII) - begin - verbose_back, $VERBOSE = $VERBOSE, nil - str = ('a' * 30).force_encoding(Encoding::ASCII).taint - ensure - $VERBOSE = verbose_back - end - frozen_str = Bug::String.rb_str_new_frozen(str) - assert_fstring(frozen_str) {|s| assert_equal(str, s)} - GC.start - assert_equal('a' * 30, str, "[Bug #16151]") - end end diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 67f38c2e91..4a08829473 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1075,18 +1075,6 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| assert_equal :deprecated, warning[0][1] end - def test_warn_deprecated_to_remove_backwards_compatibility_category - warning = capture_warning_warn { Object.new.tainted? } - - assert_match(/deprecated/, warning[0]) - end - - def test_warn_deprecated_to_remove_category - warning = capture_warning_warn(category: true) { Object.new.tainted? } - - assert_equal :deprecated, warning[0][1] - end - def test_kernel_warn_uplevel warning = capture_warning_warn {warn("test warning", uplevel: 0)} assert_equal("#{__FILE__}:#{__LINE__-1}: warning: test warning\n", warning[0]) |