Commit graph

16692 commits

Author SHA1 Message Date
Nobuyoshi Nakada
1758eade57 [ruby/date] Anchor at beginning of numbers
https://hackerone.com/reports/1254844

7ffe25e458
2022-02-25 19:52:31 +09:00
Peter Zhu
3df16924b4 [Feature #18249] Implement ABI checking
Header file include/ruby/internal/abi.h contains RUBY_ABI_VERSION which
is the ABI version. This value should be bumped whenever an ABI
incompatible change is introduced.

When loading dynamic libraries, Ruby will compare its own
`ruby_abi_version` and the `ruby_abi_version` of the loaded library. If
these two values don't match it will raise a `LoadError`. This feature
can also be turned off by setting the environment variable
`RUBY_RUBY_ABI_CHECK=0`.

This feature will prevent cases where previously installed native gems
fail in unexpected ways due to incompatibility of changes in header
files. This will force the developer to recompile their gems to use the
same header files as the built Ruby.

In Ruby, the ABI version is exposed through
`RbConfig::CONFIG["ruby_abi_version"]`.
2022-02-22 09:55:21 -05:00
Tim Pope
37d5890e49 [ruby/reline] Fix support for emacs-ctlx and emacs-meta keymaps
The existing implementation, given the below .inputrc, erroneously
creates a "C-v" key binding:

	set keymap emacs-ctlx
	"\C-v": "[C-x C-v was pressed]"

This fixes it to instead create a "C-x C-v" keybinding.

719f52d231
2022-02-22 18:52:52 +09:00
Hiroshi SHIBATA
a49aae2c5e [rubygems/rubygems] Resolve cleaned-up error with temporary gemhome
623162ad2b
2022-02-22 13:32:59 +09:00
Yusuke Endoh
5099f64fa4 Add a test for Exception#detailed_message 2022-02-22 11:55:40 +09:00
Yusuke Endoh
89e446683e test/ruby/test_rubyoptions.rb: Make it pass on Windows 2022-02-22 11:55:40 +09:00
Yusuke Endoh
f207f7a193 Do not escape error message
[Feature #18367]
2022-02-22 11:55:40 +09:00
Shugo Maeda
c8817d6a3e
Add String#byteindex, String#byterindex, and MatchData#byteoffset (#5518)
* Add String#byteindex, String#byterindex, and MatchData#byteoffset [Feature #13110]

Co-authored-by: NARUSE, Yui <naruse@airemix.jp>
2022-02-19 19:10:00 +09:00
Kazuki Tsujimoto
db6b23c76c
Find pattern is no longer experimental [Feature #18585] 2022-02-19 18:45:49 +09:00
Akinori MUSHA
dd3501bb95 Make Set a builtin feature [Feature #16989] 2022-02-18 11:56:24 +09:00
Jeremy Evans
4c366ec977 Add Thread.each_caller_location
This method takes a block and yields Thread::Backtrace::Location
objects to the block.  It does not take arguments, and always
starts at the default frame that caller_locations would start at.

Implements [Feature #16663]
2022-02-17 08:54:07 -08:00
Kazuhiro NISHIYAMA
dfe7faa6b6
exclude name must be Regexp or Symbol
fdf0f8d814/tool/lib/test/unit.rb (L1273-L1290)
2022-02-17 19:04:16 +09:00
Nobuyoshi Nakada
b4fd0e0c73
Exclude TestThread#test_signal_at_join on FreeBSD 13 for now [ci skip] 2022-02-13 17:39:57 +09:00
Nobuyoshi Nakada
844a8355a1 [ruby/rdoc] Load YAML library for each test
a93e1bcd68
2022-02-12 17:13:06 +09:00
Nobuyoshi Nakada
3b3fb73d61 [ruby/rdoc] Dump plain objects as RDoc::Options
So that the generated `.rdoc_options` file is loadable.

6cf6e1647b
2022-02-12 16:15:08 +09:00
Nobuyoshi Nakada
11f3882173 [ruby/rdoc] Fix a test method name
8166b84cf3
2022-02-12 16:02:17 +09:00
Ulysse Buonomo
5348a34504 [ruby/rdoc] Relative loading for easier development (https://github.com/ruby/rdoc/pull/821)
This patch makes sure we only load relative code. Hence when coding or
testing rdoc, we'll be sure to always be using the correct code.

Discussion started at https://github.com/ruby/rdoc/pull/817.

Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com>

aa41bd48eb

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-02-12 15:06:06 +09:00
Yusuke Endoh
118769d028 test/ruby/test_exception.rb: prevent "assigned but unused variable" 2022-02-12 00:36:01 +09:00
Espartaco Palma
9b768012f6
[ruby/ipaddr] Fix exception calling to_range' after freeze'
77fe1fca0a
2022-02-10 17:18:05 +09:00
Jean Boussier
100253c7f0
[ruby/ipaddr] Ipaddr#native must also coerce @mask_addr
Before it would be left as an IPv6 mask causing `to_range` to fail.

```
>> IPAddr.new("::2").native.to_range
/opt/rubies/3.0.3/lib/ruby/3.0.0/ipaddr.rb:479:in `set': invalid address (IPAddr::InvalidAddressError)
```

af485192f3
2022-02-10 17:18:05 +09:00
Jeremy Evans
fd710d7e99 Fix Range#include? for beginless exclusive string ranges
Previously, include? would return true for the end of the range,
when it should return false because the range is exclusive.

Research and Analysis by Victor Shepelev.

Fixes [Bug #18577]
2022-02-09 19:47:28 -08:00
John Hawthorn
05b1944c53 objspace: Hide identhash containing internal objs
Inside ObjectSpace.reachable_objects_from we keep an internal identhash
in order to de-duplicate reachable objects when wrapping them as
InternalObject. Previously this hash was not hidden, making it possible
to leak references to those internal objects to Ruby if using
ObjectSpace.each_object.

This commit solves this by hiding the hash. To simplify collection of
values, we instead now just use the hash as a set of visited objects,
and collect an Array (not hidden) of values to be returned.
2022-02-09 17:32:43 -08:00
Yusuke Endoh
496591de96 st.c: Do not clear entries_bound when calling Hash#shift for empty hash
tab->entries_bound is used to check if the bins are full in
rebuild_table_if_necessary.

Hash#shift against an empty hash assigned 0 to tab->entries_bound, but
didn't clear the bins. Thus, the table is not rebuilt even when the bins
are full. Attempting to add a new element into full-bin hash gets stuck.

This change stops clearing tab->entries_bound in Hash#shift.
[Bug #18578]
2022-02-10 00:14:27 +09:00
Nobuyoshi Nakada
ec6d1cf28f [ruby/rdoc] Get rid of ruby-mode.el confusions
63fac51198
2022-02-09 22:22:45 +09:00
Nobuyoshi Nakada
994b3f1dc6 [ruby/rdoc] Allow cross references to negation operator method
69cafb213a
2022-02-09 19:41:12 +09:00
Nobuyoshi Nakada
8db06fe2c9 [ruby/rdoc] Allow cross references to logical operator methods
17c0da304d
2022-02-09 19:41:11 +09:00
Soutaro Matsumoto
cbd54cba03 [ruby/rdoc] Skip parentheses on singleton class declaration
b6c6d4f978
2022-02-09 18:45:05 +09:00
Nobuyoshi Nakada
88b1d21dbb [ruby/rdoc] Allow cross references to backtick method
52c33157f1
2022-02-09 18:44:41 +09:00
Nobuyoshi Nakada
202f690a5e [ruby/rdoc] Allow cross references to operator methods
Make operator methods, e.g., `Regexp#=~`, `Integer#<=>`, cross
reference targets.

5d332a4128
2022-02-09 18:44:40 +09:00
Nobuyoshi Nakada
dec96dd897 [ruby/rdoc] Support all struct definition functions
Currently only `rb_struct_define_without_accessor` is supported by
https://github.com/ruby/rdoc/pull/73.  We should support other
three functions too.

d42288f06c
2022-02-09 18:43:07 +09:00
John Hawthorn
c79d2e5474 Fix TAG_THROW through require [Bug #18562]
Previously this was being incorrectly swapped with TAG_RAISE in the next
line. This would end up checking the T_IMEMO throw_data to the exception
handling (which calls Module#===). This happened to not break existing
tests because Module#=== returned false when klass is NULL.

This commit handles throw from require correctly by jumping to the tag
retaining the TAG_THROW state.
2022-02-05 18:10:19 -08:00
Matt Valentine-House
9fab2c1a1a Add the size pool slot size to the output of ObjectSpace.dump/dump_all 2022-02-03 15:07:35 -05:00
Peter Zhu
af321ea727 Move total_freed_pages to size pool 2022-02-03 15:06:55 -05:00
Peter Zhu
a9221406aa Move total_allocated_pages to size pool 2022-02-03 15:06:55 -05:00
Jeremy Evans
7529c53891 [ruby/net-http] Do not set SNI hostname if connecting to IP address
RFC 6066, section 3, explicitly disallows the use of an IP address
as an SNI server name.  So check if the connection is being made
to an IP address using the resolv regexps, and do not set an SNI
hostname in that case.

Recent changes to LibreSSL make it more strictly follow RFC 6066,
resulting an s.hostname= raising an error if passed an IP address.
When such verions of LibreSSL are used, this change not only fixes
the net/http tests, it also fixes tests for webrick and open-uri,
which both make SSL connections to 127.0.0.1 using net/http in
their tests.

Avoid warning in the openssl extension by unsetting
@ssl_context.verify_hostname if connecting to an IP address.
Make changes so that the post_connection_check still happens
when connecting to an IP address, which is necessary to keep
checking that the certificate returned includes the IP address,
which one of the tests depends on.

Revert the previous change that modified the regexp used for
checking the error message.

fa68e64bee
2022-02-03 05:10:21 +09:00
Peter Zhu
7b77d46671 Decouple GC slot sizes from RVALUE
Add a new macro BASE_SLOT_SIZE that determines the slot size.

For Variable Width Allocation (compiled with USE_RVARGC=1), all slot
sizes are powers-of-2 multiples of BASE_SLOT_SIZE.

For USE_RVARGC=0, BASE_SLOT_SIZE is set to sizeof(RVALUE).
2022-02-02 09:52:04 -05:00
Hiroshi SHIBATA
ec906191ab
Restore workaround for test_rubygems.rb, It still fails with chkbuild encironment 2022-02-01 12:21:53 +09:00
David Rodríguez
517d7c3221 Sync latest Bundler & RubyGems 2022-02-01 08:09:23 +09:00
Koichi Sasada
e75bd8df51 pend some tests while using to_binary
ISeqs from ISeq#to_binary/load do not support `keep_script_lines`
now so some tests should be pending tests with
`RUBY_ISEQ_DUMP_DEBUG=to_binary`
2022-01-31 03:47:03 +09:00
Nobuyoshi Nakada
44c44b9b4a
Ignore warnings at reading debug info for now
Something seems changed on FreeBSD 13.
2022-01-29 22:59:39 +09:00
Mike Dalessio
b90e56e624 mkmf: pkg_config accepts multiple options 2022-01-29 15:22:52 +09:00
Mike Dalessio
24c7e75ded test: backfill coverage for MakeMakefile.pkg_config 2022-01-29 15:22:52 +09:00
Peter Zhu
018036c282 Remove assert_equal that will never be run
`@s1.set_len(3)` will raise so the `assert_equal` will never be ran.
2022-01-28 13:33:03 -05:00
Nobuyoshi Nakada
e89d80702b Fix memory leak at the same named alias [Bug #18516]
When aliasing a method to the same name method, set a separate bit
flag on that method definition, instead of the reference count
increment.  Although this kind of alias has no actual effect at
runtime, is used as the hack to suppress the method re-definition
warning.
2022-01-27 15:46:08 +09:00
Nobuyoshi Nakada
7ff1bf3178
An alias can suppress method redefinition warning 2022-01-27 14:28:29 +09:00
Jesse Chavez
99d02caed3 [ruby/logger] Fix log rotation inter-process lock failed.
Issue only occurs in JRuby 9.3.0.0 and Windows and the full
console output is:

log rotation inter-process lock failed. D:\log.txt -> D:\log.txt.0: The process cannot access the file because it is being used by another process.
log writing failed. closed stream
log writing failed. closed stream
...

19fc734638
2022-01-27 12:33:06 +09:00
Peter Zhu
663833b08f [wasm] Disallow compaction
WebAssembly doesn't support signals so we can't use read
barriers so we can't use compaction.
2022-01-24 09:21:08 -05:00
Kenta Murata
7db195d521
[ruby/bigdecimal] Fix the maximum precision of the quotient
Fixes https://github.com/ruby/bigdecimal/pull/220

127a1b5a31
2022-01-24 10:56:30 +09:00
Kenta Murata
506728d0b8
[ruby/bigdecimal] Fix typo
79c09b4dac
2022-01-24 10:56:25 +09:00
Seth Boyles
c1a6ff046d [ruby/psych] Add strict_integer option to parse numbers with commas as strings
Authored-by: Seth Boyles <sethboyles@gmail.com>

75bebb37b8
2022-01-22 10:00:51 +09:00