ruby-changes:70606
From: Nobuyoshi <ko1@a...>
Date: Mon, 27 Dec 2021 00:41:40 +0900 (JST)
Subject: [ruby-changes:70606] 39bc5de833 (master): Remove tainted and trusted features
https://git.ruby-lang.org/ruby.git/commit/?id=39bc5de833 From 39bc5de83394a380c9967df74e06c824186f8560 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 26 Dec 2021 18:07:12 +0900 Subject: Remove tainted and trusted features Already these had been announced to be removed in 3.2. --- error.c | 13 ---- hash.c | 7 --- include/ruby/internal/fl_type.h | 6 -- include/ruby/internal/intern/error.h | 2 - include/ruby/internal/intern/hash.h | 9 --- include/ruby/internal/intern/object.h | 68 --------------------- include/ruby/internal/intern/string.h | 64 -------------------- object.c | 98 ------------------------------- spec/ruby/optional/capi/ext/object_spec.c | 4 ++ spec/ruby/optional/capi/ext/rubyspec.h | 4 ++ spec/ruby/optional/capi/ext/string_spec.c | 4 ++ string.c | 15 ----- test/-ext-/string/test_fstring.rb | 14 ----- test/ruby/test_exception.rb | 12 ---- 14 files changed, 12 insertions(+), 308 deletions(-) diff --git a/error.c b/error.c index 926ec5adb9d..6a60919d5c7 100644 --- a/error.c +++ b/error.c @@ -3392,19 +3392,6 @@ rb_check_frozen(VALUE obj) https://github.com/ruby/ruby/blob/trunk/error.c#L3392 rb_check_frozen_internal(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) { diff --git a/hash.c b/hash.c index f788375a7e9..9b1f7624140 100644 --- a/hash.c +++ b/hash.c @@ -5043,13 +5043,6 @@ env_fetch(int argc, VALUE *argv, VALUE _) https://github.com/ruby/ruby/blob/trunk/hash.c#L5043 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 08405d6f30e..c51bd2e9d94 100644 --- a/include/ruby/internal/fl_type.h +++ b/include/ruby/internal/fl_type.h @@ -450,12 +450,6 @@ enum { https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/fl_type.h#L450 #undef RBIMPL_HAVE_ENUM_ATTRIBUTE 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 37d3b8592b5..b255abb82be 100644 --- a/include/ruby/internal/intern/error.h +++ b/include/ruby/internal/intern/error.h @@ -38,8 +38,6 @@ https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/error.h#L38 #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 9d2ce8279a4..3cce7f61c71 100644 --- a/include/ruby/internal/intern/hash.h +++ b/include/ruby/internal/intern/hash.h @@ -287,15 +287,6 @@ int rb_path_check(const char *path); https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/hash.h#L287 /* 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. * diff --git a/include/ruby/internal/intern/object.h b/include/ruby/internal/intern/object.h index 6bb4ccb2fee..19af49b140d 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); https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/object.h#L202 */ 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 2ee8496256a..3083125e560 100644 --- a/include/ruby/internal/intern/string.h +++ b/include/ruby/internal/intern/string.h @@ -122,37 +122,6 @@ VALUE rb_str_new_frozen(VALUE str); https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/string.h#L122 */ 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) https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/intern/string.h#L1367 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 @@ -1 (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/