summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2023-06-30Don't check for null pointer in calls to freePeter Zhu
According to the C99 specification section 7.20.3.2 paragraph 2: > If ptr is a null pointer, no action occurs. So we do not need to check that the pointer is a null pointer. Notes: Merged: https://github.com/ruby/ruby/pull/8004
2023-06-29More dependencies for ripperNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7999
2023-06-28Fix memory leak in RipperPeter Zhu
The following script leaks memory in Ripper: ```ruby require "ripper" 20.times do 100_000.times do Ripper.parse("") end puts `ps -o rss= -p #{$$}` end ``` Notes: Merged: https://github.com/ruby/ruby/pull/7985
2023-06-28[ruby/fiddle] Mark Closure, Function and Handle as write barrierJean byroot Boussier
protected (https://github.com/ruby/fiddle/pull/129) They don't have a mark function, so they don't need any change. https://github.com/ruby/fiddle/commit/9bbc732aef Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-06-28[ruby/fiddle] Implement write barriers for Fiddle::PointerJean byroot Boussier
(https://github.com/ruby/fiddle/pull/127) Save from having to mark them on every minor. https://github.com/ruby/fiddle/commit/153c09c99f Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2023-06-28[ruby/fiddle] Fix a typoSutou Kouhei
https://github.com/ruby/fiddle/commit/4c0c5da1a5
2023-06-28[ruby/fiddle] Add support for converting "C" (one character string) to charSutou Kouhei
GitHub: fix https://github.com/ruby/fiddle/pull/96 I wanted to add a test for this but I couldn't find a function that has a "char" argument in libc... Reported by kojix2. Thanks!!! https://github.com/ruby/fiddle/commit/2c863ef8ba
2023-06-28[ruby/fiddle] Add support for more "short" variantsSutou Kouhei
https://github.com/ruby/fiddle/commit/2b22bb9d74
2023-06-28[ruby/fiddle] Add support for "long" variantsSutou Kouhei
GitHub: fix https://github.com/ruby/fiddle/pull/100 Reported by David M. Lary. Thanks!!! https://github.com/ruby/fiddle/commit/516333dd78
2023-06-28[ruby/fiddle] Add a helper method for reading/writing memoryAaron Patterson
(https://github.com/ruby/fiddle/pull/123) This commit adds two new methods, `Fiddle::Pointer.read` and `Fiddle::Pointer.write`. Both methods take an address, and will read or write bytes at that address respectively. For example we can read from an address without making a Pointer object: ```ruby Fiddle::Pointer.read(address, 5) # read 5 bytes ``` We can also write to an address without allocating a Pointer object: ```ruby Fiddle::Pointer.write(address, "bytes") # write 5 bytes ``` This allows us to read / write memory at arbitrary addresses without instantiating a new `Fiddle::Pointer` object. Examples where this API would be useful [1](https://github.com/tenderlove/tenderjit/blob/f03481d28bff4d248746e596929b0841de65f181/lib/tenderjit/fiddle_hacks.rb#L26-L28) [2](https://github.com/tenderlove/ruby/blob/77c8daa2d40dd58eeb3785ce17dea2ee38f308d1/lib/ruby_vm/rjit/c_pointer.rb#L193) [3](https://github.com/tenderlove/ruby/blob/77c8daa2d40dd58eeb3785ce17dea2ee38f308d1/lib/ruby_vm/rjit/c_pointer.rb#L284) I also added a writer method for the same reasons as the reader. --------- https://github.com/ruby/fiddle/commit/04238cefed Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2023-06-19[ruby/openssl] add OpenSSL Provider supportqwyng
https://github.com/ruby/openssl/commit/189c167e40 [rhe: tool/update-deps --fix to update ext/openssl/depend]
2023-06-19[ruby/openssl] pkey: use unsigned type for bit fieldsKazuki Yamaguchi
clang generates a warning: ../../../../ext/openssl/ossl_pkey.c:326:22: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] arg->interrupted = 1; ^ ~ 1 error generated. https://github.com/ruby/openssl/commit/4b2ba7b022
2023-06-19[ruby/openssl] Drop support for Ruby 2.6Kazuki Yamaguchi
Ruby 2.6 has reached EOL on 2022-03. Requiring Ruby 2.7 allows us to use C99 syntax. https://github.com/ruby/openssl/commit/f6ba75e51e
2023-06-19[ruby/openssl] extconf.rb: apply RUBY_OPENSSL_EXT{C,LD}FLAGS after checking ↵Kazuki Yamaguchi
features RUBY_OPENSSL_EXTCFLAGS and RUBY_OPENSSL_EXTLDFLAGS have been added for the primary purpose of appending custom warning flags during development and CI. Since checking programs generated by mkmf may not be completely warning-free, we don't want to apply -Werror that may be supplied from those environment variables. https://github.com/ruby/openssl/commit/2a95b971d5
2023-06-19[ruby/openssl] Workaround: Fix OpenSSL::PKey.read that cannot parse PKey in ↵Jun Aruga
the FIPS mode. This commit is a workaround to avoid the error below that the `OpenSSL::PKey.read` fails with the OpenSSL 3.0 FIPS mode. ``` $ openssl genrsa -out key.pem 4096 $ ruby -e "require 'openssl'; OpenSSL::PKey.read(File.read('key.pem'))" -e:1:in `read': Could not parse PKey (OpenSSL::PKey::PKeyError) from -e:1:in `<main>' ``` The root cause is on the OpenSSL side. The `OSSL_DECODER_CTX_set_selection` doesn't apply the selection value properly if there are multiple providers, and a provider (e.g. "base" provider) handles the decoder implementation, and another provider (e.g. "fips" provider) handles the keys. The workaround is to create `OSSL_DECODER_CTX` variable each time without using the `OSSL_DECODER_CTX_set_selection`. https://github.com/ruby/openssl/commit/5ff4a31621
2023-06-19[ruby/openssl] Implement Write Barrier for all OpenSSL typesJean Boussier
The vast majority have no reference so it's just a matter of setting the flags. For the couple exception, they have very little references so it's easy. https://github.com/ruby/openssl/commit/2c7c6de69e
2023-06-19[ruby/openssl] Append flags from environment variables.Jun Aruga
According to the `mkmf.rb#init_mkmf`, there are command line options below. * `--with-cflags` to set the `cflags` * `--with-ldflags` to set the `ldflags` For example the following command compiles with the specified flags. Note that `MAKEFLAGS` is to print the compiler command lines. ``` $ MAKEFLAGS="V=1" \ bundle exec rake compile -- \ --with-cflags="-Wundef -Werror" \ --with-ldflags="-fstack-protector" ``` However, I couldn't find command line options to append the flags. And this commit is to append the `cflags` and `ldflags` by the environment variables. ``` $ MAKEFLAGS="V=1" \ RUBY_OPENSSL_EXTCFLAGS="-Wundef -Werror" \ RUBY_OPENSSL_EXTLDFLAGS="-fstack-protector" \ bundle exec rake compile ``` https://github.com/ruby/openssl/commit/b551eb86f6
2023-06-12[ruby/psych] Comment out the code used to expand the file list [ci skip]Nobuyoshi Nakada
https://github.com/ruby/psych/commit/715f3bfad0
2023-06-12Add missing dependenciesNobuyoshi Nakada
2023-06-12[Feature #19719] Universal Parseryui-knk
Introduce Universal Parser mode for the parser. This commit includes these changes: * Introduce `UNIVERSAL_PARSER` macro. All of CRuby related functions are passed via `struct rb_parser_config_struct` when this macro is enabled. * Add CI task with 'cppflags=-DUNIVERSAL_PARSER' for ubuntu. Notes: Merged: https://github.com/ruby/ruby/pull/7927
2023-06-12[ruby/psych] Update spec filesNobuyoshi Nakada
https://github.com/ruby/psych/commit/ba6fc48591
2023-06-08Add deprecations for public `struct rb_io` members. (#7916)Samuel Williams
* Add deprecations for public struct rb_io members. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-06-08racc/cparse is extracted from ruby/ruby repositoryHiroshi SHIBATA
2023-06-08Try to promote racc as bundled gemsHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/7877
2023-06-08[ruby/psych] Drop to support Ruby 2.4 because the latest version of ↵Hiroshi SHIBATA
core_assertions only support Ruby 2.5+ https://github.com/ruby/psych/commit/6ec316b7fa
2023-06-06Unify length field for embedded and heap strings (#7908)Peter Zhu
* Unify length field for embedded and heap strings The length field is of the same type and position in RString for both embedded and heap allocated strings, so we can unify it. * Remove RSTRING_EMBED_LEN Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-06-05Revert "Revert "Fix cvar caching when class is cloned""eileencodes
This reverts commit 10621f7cb9a0c70e568f89cce47a02e878af6778. This was reverted because the gc integrity build started failing. We have figured out a fix so I'm reopening the PR. Original commit message: Fix cvar caching when class is cloned The class variable cache that was added in ruby#4544 changed the behavior of class variables on cloned classes. As reported when a class is cloned AND a class variable was set, and the class variable was read from the original class, reading a class variable from the cloned class would return the value from the original class. This was happening because the IC (inline cache) is stored on the ISEQ which is shared between the original and cloned class, therefore they share the cache too. To fix this we are now storing the `cref` in the cache so that we can check if it's equal to the current `cref`. If it's different we don't want to read from the cache. If it's the same we do. Cloned classes don't share the same cref with their original class. This will need to be backported to 3.1 in addition to 3.2 since the bug exists in both versions. We also added a marking function which was missing. Fixes [Bug #19379] Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/7900
2023-06-03Ripper does not depend on Bison [ci skip]yui-knk
It also uses Lrama then no dependency on Bison. Notes: Merged: https://github.com/ruby/ruby/pull/7896
2023-06-02[ruby/stringio] Development of 3.0.8 started.Hiroshi SHIBATA
https://github.com/ruby/stringio/commit/1587d3698e
2023-06-02No need to define "BISON" on extconf.rbyui-knk
"BISON" is defined in "ext/ripper/depend". Notes: Merged: https://github.com/ruby/ruby/pull/7878
2023-06-01Revert "Fix cvar caching when class is cloned"Aaron Patterson
This reverts commit 77d1b082470790c17c24a2f406b4fec5d522636b.
2023-06-01Fix cvar caching when class is clonedeileencodes
The class variable cache that was added in https://github.com/ruby/ruby/pull/4544 changed the behavior of class variables on cloned classes. As reported when a class is cloned AND a class variable was set, and the class variable was read from the original class, reading a class variable from the cloned class would return the value from the original class. This was happening because the IC (inline cache) is stored on the ISEQ which is shared between the original and cloned class, therefore they share the cache too. To fix this we are now storing the `cref` in the cache so that we can check if it's equal to the current `cref`. If it's different we don't want to read from the cache. If it's the same we do. Cloned classes don't share the same cref with their original class. This will need to be backported to 3.1 in addition to 3.2 since the bug exists in both versions. We also added a marking function which was missing. Fixes [Bug #19379] Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/7265
2023-06-01[ruby/stringio] Avoid direct struct usage.Samuel Williams
(https://github.com/ruby/stringio/pull/54) We will eventually want to refactor this, but for now this is compatible enough.
2023-06-01Restores the changes in `io-console` without breaking backwards ↵Samuel Williams
compatibility. (#7882) This reverts commit 35da41b29bf0a1a8fd2cd7e1d7fcb036ca8c2c7c. This updates `io-console` to avoid accessing the internal details of `rb_io_t` and instead use `rb_io_descriptor` and `rb_io_path` etc. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-06-01Hide the usage of `rb_io_t` where possible. (#7880)Samuel Williams
This retries the compatible parts of the previously reverted PR so we can continue to update related code without breaking backwards compatibility. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-06-01Revert https://github.com/ruby/io-console/pull/43Hiroshi SHIBATA
This reverts commit 1889133c04f337fec3969cb5040a544088249046 and commit 764207e47ce38d1b73774a8e65114c87bc888298. Followed up with https://github.com/ruby/ruby/commit/85dcc4866d9ff29834596e9186cc97d622ee06f8
2023-06-01Revert "Hide most of the implementation of `struct rb_io`. (#6511)"NARUSE, Yui
This reverts commit 18e55fc1e1ec20e8f3166e3059e76c885fc9f8f2. fix [Bug #19704] https://bugs.ruby-lang.org/issues/19704 This breaks compatibility for extension libraries. Such changes need a discussion.
2023-05-30[ruby/io-nonblock] Add TruffleRuby support and add it in CIBenoit Daloze
* Do not use a C extension on TruffleRuby for these 3 methods. https://github.com/ruby/io-nonblock/commit/1b8e52abfa
2023-05-30[ruby/io-nonblock] Use the correct pattern for the fallback of ↵Benoit Daloze
rb_io_descriptor() * See https://github.com/ruby/io-console/pull/43/commits/d1d9aef45ceb14365fdf0ebee3e5ea06f27da682 https://github.com/ruby/io-nonblock/commit/dadb42422b
2023-05-30Hide most of the implementation of `struct rb_io`. (#6511)Samuel Williams
* Add rb_io_path and rb_io_open_descriptor. * Use rb_io_open_descriptor to create PTY objects * Rename FMODE_PREP -> FMODE_EXTERNAL and expose it FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but FMODE_EXTERNAL is clearer about what the file descriptor represents and aligns with language in the IO::Buffer module. * Ensure that rb_io_open_descriptor closes the FD if it fails If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be responsible for closing your file, eventually, if you pass it to rb_io_open_descriptor, even if it raises an exception. * Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P * Expose `rb_io_closed_p`. * Add `rb_io_mode` to get IO mode. --------- Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com> Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2023-05-29[ruby/cgi] Add TruffleRuby support and add it in CIBenoit Daloze
https://github.com/ruby/cgi/commit/1240fec9c9
2023-05-29[ruby/etc] Use the correct pattern for the fallback of rb_io_descriptor()Benoit Daloze
* See https://github.com/ruby/io-console/pull/43/commits/d1d9aef45ceb14365fdf0ebee3e5ea06f27da682 https://github.com/ruby/etc/commit/5185685003
2023-05-29[ruby/openssl] Remove usage of IO internals.Samuel Williams
2023-05-29[ruby/io-console] Remove trailing whitespace.Samuel Williams
https://github.com/ruby/io-console/commit/55f1586463
2023-05-29[ruby/io-console] Remove usage of IO internals.Samuel Williams
(https://github.com/ruby/io-console/pull/43) https://github.com/ruby/io-console/commit/4b839a504f Co-authored-by: Benoit Daloze <eregontp@gmail.com>
2023-05-28[ruby/io-nonblock] Remove usage of IO internals.Samuel Williams
(https://github.com/ruby/io-nonblock/pull/11) https://github.com/ruby/io-nonblock/commit/caa2b94d19
2023-05-28[ruby/io-nonblock] Revert "Remove usage of IO internals."Samuel Williams
This reverts commit https://github.com/ruby/io-nonblock/commit/9772b6dcb63c. https://github.com/ruby/io-nonblock/commit/08cabf78e1
2023-05-28[ruby/io-nonblock] Remove usage of IO internals.Samuel Williams
https://github.com/ruby/io-nonblock/commit/9772b6dcb6
2023-05-28[ruby/io-wait] Remove usage of IO internals.Samuel Williams
(https://github.com/ruby/io-wait/pull/25) https://github.com/ruby/io-wait/commit/e5854b46c7
2023-05-28[ruby/etc] Remove usage of IO internals.Samuel Williams
(https://github.com/ruby/etc/pull/26) https://github.com/ruby/etc/commit/ea15eceb13