ruby-oci8 2.2.12 → 2.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c98e1080c073f6f2f2a67676f754259e8c20d2ef95d6abbb1015fd62df569d84
4
- data.tar.gz: 4a14e505c268c3a2b408c9f4881026dd32bbe6e4276df83c77483e0402bb32b1
3
+ metadata.gz: 1e144a61c64f6856db08e6e473ac4531dd008c967bad30f48bf6a6852c7fc623
4
+ data.tar.gz: e35589ae71e41de3d0b77ca04dfa4bc0aa761272915c5e4d2cabcb955b4923d8
5
5
  SHA512:
6
- metadata.gz: 1e73a635ede56087026f6b573c2f1f6624d7a265423a91ab1d7592534f6c132a1e4f1ca812e4a2651f690588f39c8c82040d20fcc9719fa0028a67c230e76e1d
7
- data.tar.gz: 57497720f51ed3d2062ed8dc5eb07b248d3b19326e7c83a2cd508aaec0e7f3d33b658eb0605134776913cffc631e57b9e6b97d8b6367e5cf59dd83d24e0c749d
6
+ metadata.gz: 474b19d0d1a92f1cd52e0b12babeff15c4ccdeb076a3b523b61ad8d7fdc9b0bab99715af698b83cf841b114880f111e727f0dbd8e583ca4263b30fb28a2621f7
7
+ data.tar.gz: '079389be6f6662ae81795da0c0e4c7ba81bee27a1724032cf2c7de652f5282d0201d4f3ffec9eaa6e74d2e068abb96097912d3417d5c65cb084ed02c51e6d89b'
data/NEWS CHANGED
@@ -1,5 +1,31 @@
1
1
  # @markup markdown
2
2
 
3
+ 2.2.14 (2024-08-06)
4
+ ===================
5
+
6
+ Fixed issues
7
+ ------------
8
+
9
+ - Fix SIGSEGV when nokogiri is loaded before oci8 (GH-263 - Linux only)
10
+
11
+ 2.2.13 (2024-07-27)
12
+ ===================
13
+
14
+ - Binary gems for Windows x64 and x86 supports ruby 2.7 - 3.3 inclusive.
15
+
16
+ Fixed issues
17
+ ------------
18
+
19
+ - Fix various issues about `OCI8.properties[:tcp_keepalive_time]` on macOS arm64. The feature was removed on the platform
20
+ and it raises `NotImplementedError` instead now.
21
+ - Fix SIGSEGV when using truffleruby. It seems to be caused by `xfree()` outside of ruby threads.
22
+
23
+ Changes
24
+ -------
25
+
26
+ - Change the format of fifth numeral of Oracle version number as two digit zero-padding number
27
+ when the Oracle version is 23 or upper. For example "23.4.0.24.05".
28
+
3
29
  2.2.12 (2022-12-30)
4
30
  ===================
5
31
 
@@ -39,7 +39,7 @@ by the `tcp_keepalive_time` property.
39
39
  It is supported on the following platforms since ruby-oci8 2.2.4.
40
40
 
41
41
  * Linux i386 and x86_64
42
- * macOS
42
+ * macOS x86_64
43
43
  * Windows x86 and x64
44
44
  * Solaris x86_64
45
45
 
data/ext/oci8/extconf.rb CHANGED
@@ -155,6 +155,7 @@ when /darwin/
155
155
  else
156
156
  plthook_src = "plthook_elf.c"
157
157
  end
158
+
158
159
  FileUtils.copy(File.dirname(__FILE__) + "/" + plthook_src, CONFTEST_C)
159
160
  if xsystem(cc_command(""))
160
161
  FileUtils.rm_f("#{CONFTEST}.#{$OBJEXT}")
data/ext/oci8/oci8.c CHANGED
@@ -437,7 +437,7 @@ typedef struct {
437
437
 
438
438
  static void *complex_logoff_prepare(oci8_svcctx_t *svcctx)
439
439
  {
440
- complex_logoff_arg_t *cla = xmalloc(sizeof(complex_logoff_arg_t));
440
+ complex_logoff_arg_t *cla = malloc(sizeof(complex_logoff_arg_t));
441
441
  cla->svchp = svcctx->base.hp.svc;
442
442
  cla->usrhp = svcctx->usrhp;
443
443
  cla->srvhp = svcctx->srvhp;
@@ -479,7 +479,7 @@ static void *complex_logoff_execute(void *arg)
479
479
  if (cla->svchp != NULL) {
480
480
  OCIHandleFree(cla->svchp, OCI_HTYPE_SVCCTX);
481
481
  }
482
- xfree(cla);
482
+ free(cla);
483
483
  return (void*)(VALUE)rv;
484
484
  }
485
485
 
data/ext/oci8/oci8.h CHANGED
@@ -29,11 +29,12 @@ extern "C"
29
29
  * hexadecimal -> dotted version number hexadecimal -> dotted version number
30
30
  * 0c102304 -> 12.1.2.3.4 12012034 -> 18.1.2.3.4
31
31
  * ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
32
- * 0c ------------' | | | | 2 bytes 12 ------------' | | | | 2 bytes
33
- * 1 --------------' | | | 1 byte 01 -------------' | | | 2 bytes
34
- * 02 --------------' | | 2 bytes 2 --------------' | | 1 byte
35
- * 3 ---------------' | 1 byte 03 --------------' | 2 bytes
36
- * 04 ---------------' 2 bytes 4 ---------------' 1 byte
32
+ * 0c ------------' | | | | 8 bits 12 ------------' | | | | 8 bits
33
+ * 1 --------------' | | | 4 bits 01 -------------' | | | 8 bits
34
+ * 02 --------------' | | 8 bits 2 --------------' | | 4 bits
35
+ * 3 ---------------' | 4 bits 03 --------------' | 8 bits
36
+ * 04 ---------------' 8 bits 4 ---------------' 4 bits
37
+ * total 32 bits total 32 bits
37
38
  */
38
39
  #define ORAVERNUM(major, minor, update, patch, port_update) \
39
40
  (((major) >= 18) ? (((major) << 24) | ((minor) << 16) | ((update) << 12) | ((patch) << 4) | (port_update)) \
data/ext/oci8/oci8lib.c CHANGED
@@ -9,6 +9,7 @@
9
9
  #endif
10
10
  #if defined(HAVE_PLTHOOK) && !defined(WIN32)
11
11
  #include <dlfcn.h>
12
+ #include <sys/mman.h>
12
13
  #include "plthook.h"
13
14
  #endif
14
15
 
@@ -135,6 +136,8 @@ static void rebind_internal_symbols(void)
135
136
  void **addr;
136
137
  const char *prefix;
137
138
  size_t prefix_len;
139
+ int prot;
140
+ size_t page_size = sysconf(_SC_PAGESIZE);
138
141
 
139
142
  #ifdef RTLD_FIRST
140
143
  flags |= RTLD_FIRST; /* for macOS */
@@ -161,7 +164,7 @@ static void rebind_internal_symbols(void)
161
164
  plthook_close(ph);
162
165
  return;
163
166
  }
164
- while (plthook_enum(ph, &pos, &name, &addr) == 0) {
167
+ while (plthook_enum_with_prot(ph, &pos, &name, &addr, &prot) == 0) {
165
168
  void *funcaddr;
166
169
  if (prefix_len != 0) {
167
170
  if (strncmp(name, prefix, prefix_len) != 0) {
@@ -179,7 +182,17 @@ static void rebind_internal_symbols(void)
179
182
  * PLT entries are forcedly modified to point to itself not
180
183
  * to use functions in other libraries.
181
184
  */
185
+ #define ALIGN_ADDR(addr) ((void*)((size_t)(addr) & ~(page_size - 1)))
186
+ if ((prot & PROT_WRITE) == 0) {
187
+ /* when the region containing addr isn't writable, make it writable temporarily */
188
+ if (mprotect(ALIGN_ADDR(addr), page_size, PROT_READ | PROT_WRITE) != 0) {
189
+ continue;
190
+ }
191
+ }
182
192
  *addr = funcaddr;
193
+ if ((prot & PROT_WRITE) == 0) {
194
+ mprotect(ALIGN_ADDR(addr), page_size, prot);
195
+ }
183
196
  }
184
197
  }
185
198
  plthook_close(ph);
@@ -675,28 +688,7 @@ void *oci8_find_symbol(const char *symbol_name)
675
688
 
676
689
  void *oci8_check_typeddata(VALUE obj, const oci8_handle_data_type_t *data_type, int error_if_closed)
677
690
  {
678
- #ifdef HAVE_RB_DATA_TYPE_T_FUNCTION
679
691
  oci8_base_t *hp = Check_TypedStruct(obj, &data_type->rb_data_type);
680
- #else
681
- oci8_base_t *hp;
682
- const char *expected_type_name = data_type->rb_data_type.wrap_struct_name;
683
- const rb_data_type_t *rb_data_type;
684
- const rb_data_type_t *expected_rb_data_type = &data_type->rb_data_type;
685
-
686
- if (TYPE(obj) != T_DATA || !rb_obj_is_kind_of(obj, oci8_cOCIHandle)) {
687
- rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
688
- rb_obj_classname(obj), expected_type_name);
689
- }
690
- hp = DATA_PTR(obj);
691
- rb_data_type = &hp->data_type->rb_data_type;
692
- while (rb_data_type != expected_rb_data_type) {
693
- if (rb_data_type == NULL) {
694
- rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
695
- rb_obj_classname(obj), expected_type_name);
696
- }
697
- rb_data_type = rb_data_type->parent;
698
- }
699
- #endif
700
692
  if (error_if_closed && hp->closed) {
701
693
  rb_raise(eOCIException, "%s was already closed.",
702
694
  rb_obj_classname(obj));
data/ext/oci8/oraconf.rb CHANGED
@@ -130,6 +130,8 @@ class MiniSOReader
130
130
  @cpu = :ia64
131
131
  when 62
132
132
  @cpu = :x86_64
133
+ when 183
134
+ @cpu = :aarch64
133
135
  else
134
136
  raise "Invalid ELF archtype: #{archtype}"
135
137
  end
@@ -379,6 +381,8 @@ EOS
379
381
  @@ld_envs = %w[PATH]
380
382
  so_ext = 'dll'
381
383
  check_proc = make_proc_to_check_cpu(is_32bit ? :i386 : :x86_64)
384
+ when /aarch64-linux/
385
+ check_proc = make_proc_to_check_cpu(:aarch64)
382
386
  when /i.86-linux/
383
387
  check_proc = make_proc_to_check_cpu(:i386)
384
388
  when /ia64-linux/
data/ext/oci8/oradate.c CHANGED
@@ -61,18 +61,7 @@ typedef struct ora_date ora_date_t;
61
61
  if (sec < 0 || 59 < sec) \
62
62
  rb_raise(rb_eRangeError, "Out of range for second %d (expect 0 .. 59)", sec)
63
63
 
64
- #ifdef HAVE_RB_DATA_TYPE_T_FUNCTION
65
64
  #define check_oradate(obj) ((ora_date_t*)Check_TypedStruct((obj), &odate_data_type))
66
- #else
67
- static ora_date_t *check_oradate(VALUE obj)
68
- {
69
- if (!rb_obj_is_kind_of(obj, cOraDate)) {
70
- rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)",
71
- rb_obj_classname(obj), rb_class2name(cOraDate));
72
- }
73
- return DATA_PTR(obj);
74
- }
75
- #endif
76
65
 
77
66
  static size_t odate_memsize(const void *ptr)
78
67
  {
data/ext/oci8/plthook.h CHANGED
@@ -59,8 +59,14 @@ int plthook_replace(plthook_t *plthook, const char *funcname, void *funcaddr, vo
59
59
  void plthook_close(plthook_t *plthook);
60
60
  const char *plthook_error(void);
61
61
 
62
+ /* enumerate entries with memory protection information (bitwise-OR of PROT_READ, PROT_WRITE and PROT_EXEC)
63
+ *
64
+ * source: plthook_elf.c and plthook_osx.c
65
+ */
66
+ int plthook_enum_with_prot(plthook_t *plthook, unsigned int *pos, const char **name_out, void ***addr_out, int *prot);
67
+
62
68
  #ifdef __cplusplus
63
- }; /* extern "C" */
69
+ } /* extern "C" */
64
70
  #endif
65
71
 
66
72
  #endif