Blame SOURCES/ruby-2.7.0-Initialize-ABRT-hook.patch

7958ac
From eca084e4079c77c061045df9c21b219175b05228 Mon Sep 17 00:00:00 2001
7958ac
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
7958ac
Date: Mon, 6 Jan 2020 13:56:04 +0100
7958ac
Subject: [PATCH] Initialize ABRT hook.
7958ac
7958ac
The ABRT hook used to be initialized by preludes via patches [[1], [2]].
7958ac
Unfortunately, due to [[3]] and especially since [[4]], this would
7958ac
require boostrapping [[5]].
7958ac
7958ac
To keep the things simple for now, load the ABRT hook via C.
7958ac
7958ac
[1]: https://bugs.ruby-lang.org/issues/8566
7958ac
[2]: https://bugs.ruby-lang.org/issues/15306
7958ac
[3]: https://bugs.ruby-lang.org/issues/16254
7958ac
[4]: https://github.com/ruby/ruby/pull/2735
7958ac
[5]: https://lists.fedoraproject.org/archives/list/ruby-sig@lists.fedoraproject.org/message/LH6L6YJOYQT4Y5ZNOO4SLIPTUWZ5V45Q/
7958ac
---
7958ac
 abrt.c    | 12 ++++++++++++
7958ac
 common.mk |  3 ++-
7958ac
 ruby.c    |  4 ++++
7958ac
 3 files changed, 18 insertions(+), 1 deletion(-)
7958ac
 create mode 100644 abrt.c
7958ac
7958ac
diff --git a/abrt.c b/abrt.c
7958ac
new file mode 100644
7958ac
index 0000000000..74b0bd5c0f
7958ac
--- /dev/null
7958ac
+++ b/abrt.c
7958ac
@@ -0,0 +1,12 @@
7958ac
+#include "internal.h"
7958ac
+
7958ac
+void
7958ac
+Init_abrt(void)
7958ac
+{
7958ac
+  rb_eval_string(
7958ac
+    "  begin\n"
7958ac
+    "    require 'abrt'\n"
7958ac
+    "  rescue LoadError\n"
7958ac
+    "  end\n"
7958ac
+  );
7958ac
+}
7958ac
diff --git a/common.mk b/common.mk
7958ac
index b2e5b2b6d0..f39f81da5c 100644
7958ac
--- a/common.mk
7958ac
+++ b/common.mk
7958ac
@@ -81,7 +81,8 @@ ENC_MK        = enc.mk
7958ac
 MAKE_ENC      = -f $(ENC_MK) V="$(V)" UNICODE_HDR_DIR="$(UNICODE_HDR_DIR)" \
7958ac
 		RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(mflags)
7958ac
 
7958ac
-COMMONOBJS    = array.$(OBJEXT) \
7958ac
+COMMONOBJS    = abrt.$(OBJEXT) \
7958ac
+                array.$(OBJEXT) \
7958ac
 		ast.$(OBJEXT) \
7958ac
 		bignum.$(OBJEXT) \
7958ac
 		class.$(OBJEXT) \
7958ac
diff --git a/ruby.c b/ruby.c
7958ac
index 60c57d6259..1eec16f2c8 100644
7958ac
--- a/ruby.c
7958ac
+++ b/ruby.c
7958ac
@@ -1489,10 +1489,14 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt)
7958ac
 
7958ac
 void Init_builtin_features(void);
7958ac
 
7958ac
+/* abrt.c */
7958ac
+void Init_abrt(void);
7958ac
+
7958ac
 static void
7958ac
 ruby_init_prelude(void)
7958ac
 {
7958ac
     Init_builtin_features();
7958ac
+    Init_abrt();
7958ac
     rb_const_remove(rb_cObject, rb_intern_const("TMP_RUBY_PREFIX"));
7958ac
 }
7958ac
 
7958ac
-- 
7958ac
2.24.1
7958ac