Commit graph

16692 commits

Author SHA1 Message Date
tomoya ishida
34f8ca1714 [ruby/irb] Fix prompt and code mismatch
(https://github.com/ruby/irb/pull/386)

* fix prompt and code mismatch

* Add test for prompt and code mismatch bug

a5765d8177

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-01-02 19:25:11 +00:00
Nobuyoshi Nakada
5be0d42d2c
[Bug #19296] Precheck bits of time components 2023-01-02 23:29:19 +09:00
Nobuyoshi Nakada
291a4098cf
Add missing assertion 2023-01-02 23:17:27 +09:00
Nobuyoshi Nakada
3becc4a105
[Bug #19291] Rewind to the previous line
When rewinding looking ahead after newline token, also reset the last
line string, the pointers to it, and the location, not only the line
number.
2023-01-02 16:12:08 +09:00
Nobuyoshi Nakada
1912bf5461
Adjut indent [ci skip] 2023-01-02 16:12:08 +09:00
Jeremy Evans
0903a25179 Make IO#set_encoding with binary external encoding use nil internal encoding
This was already the behavior when a single `'external:internal'`
encoding specifier string was passed.  This makes the behavior
consistent for the case where separate external and internal
encoding specifiers are provided.

While here, fix the IO#set_encoding method documentation to
state that either the first or second argument can be a string
with an encoding name, and describe the behavior when the
external encoding is binary.

Fixes [Bug #18899]
2023-01-01 09:00:24 -08:00
Nobuyoshi Nakada
542e984d82
[Bug #19292] Re-initialize tm when wday or yday is not set 2023-01-01 16:39:00 +09:00
Peter Zhu
0bb07e5ba4 Fix test when Ruby is verbose
The test added in 90a80eb0 fails if Ruby is verbose, it outputs the
following line to stderr:

    RUBY_GC_HEAP_INIT_SLOTS=100 (default value: 10000)
2022-12-30 10:31:50 -05:00
Peter Zhu
90a80eb076 Fix integer underflow when using HEAP_INIT_SLOTS
There is an integer underflow when the environment variable
RUBY_GC_HEAP_INIT_SLOTS is less than the number of slots currently
in the Ruby heap.

[Bug #19284]
2022-12-30 09:01:50 -05:00
Nobuyoshi Nakada
36c4dda738 [rubygems/rubygems] Fix a typo
7c096a5df8
2022-12-30 13:10:41 +00:00
Kevin Murphy
b3d330c39e
Coverage.supported? recognizes oneshot_lines mode (#7040)
This adds oneshot_lines as a mode of coverage that is supported.
2022-12-29 21:23:25 +13:00
TSUYUSATO Kitsune
b726d60c98
Fix [Bug 19273], set correct value to outer_repeat on OP_REPEAT (#7035) 2022-12-28 20:03:25 +09:00
Koichi Sasada
3931921607 add debug print for the failure
http://ci.rvm.jp/results/trunk-gc-asserts@ruby-sp2-docker/4364584

```
  1) Failure:
TestObjSpace#test_dump_all [/tmp/ruby/src/trunk-gc-asserts/test/objspace/test_objspace.rb:599]:
number of strings.
<2> expected but was
<3>.
```
2022-12-28 15:46:16 +09:00
Stan Lo
140c93e2dc [ruby/irb] Add dynamic prompt test case for quoted heredoc
(https://github.com/ruby/irb/pull/486)

31cfbeacbb
2022-12-27 16:43:44 +00:00
Takashi Kokubun
d5985049c7 Sync IRB master: tool/sync_default_gems.rb irb
It looks like tool/sync_default_gems.rb is not capable of cherry-picking
commits from ruby/irb. I just executed `tool/sync_default_gems.rb irb`
to fix the sync status.

I'm not sure if what's the cause. It could be related to some diff that
doesn't exist in ruby/ruby, or it might be related to non-linear history
due to merge commits. For next time, I'd like to at least exclude the
second possibility, so I disabled merge commits in ruby/irb.
2022-12-26 13:10:37 -08:00
Nobuyoshi Nakada
d01bcf378b [ruby/irb] Suppress "switching inspect mode" messages
565eeb3c19
2022-12-26 13:04:04 -08:00
Stan Lo
87988756d0 [ruby/irb] Remove unnecessary warning check on help command
It's not an intentional behavior of the command and it behaves
differently in different environments. So checking it actually brings
more problem than benefit.

b3203bc784
2022-12-26 13:04:04 -08:00
Stan Lo
148eb05ec1 [ruby/irb] Remove unnecessary test setup
cc6e6d26b6
2022-12-26 13:04:03 -08:00
st0012
8038bf239a [ruby/irb] Add test for the help command
9cacb5f352
2022-12-26 13:04:03 -08:00
dependabot[bot]
82ca477886 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.52 to 0.9.53.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.52...v0.9.53)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 20:09:30 +00:00
Gustavo Ribeiro
f5a035daf9 [rubygems/rubygems] deprecate gem build -C flag
fac241d4ef
2022-12-26 19:08:55 +00:00
Gustavo Ribeiro
08f6196bda [rubygems/rubygems] add global flag (-C) to change execution directory
312fc36711
2022-12-26 19:08:55 +00:00
dependabot[bot]
28a1743650 [rubygems/rubygems] Bump rb-sys in /test/rubygems/test_gem_ext_cargo_builder/custom_name
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.52 to 0.9.53.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.52...v0.9.53)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 17:20:26 +00:00
Nobuyoshi Nakada
a968d783a3 [ruby/irb] Test colors with enabling colors
998b7a74fa
2022-12-26 15:28:38 +00:00
Kenta Murata
9f2378959e
numeric.c: Fix round_half_even for specific values (#7023)
Handle the integert and the float parts separately in round_half_even
to prevent error occursions in floating point calculation.
2022-12-26 21:02:47 +09:00
Nobuyoshi Nakada
b37e9c77fe
Suppress method redefinition warnings 2022-12-26 20:29:06 +09:00
Takashi Kokubun
fc03ba50f1 MJIT: Fix JIT code for multiple values in a single case
[Bug #19263]
2022-12-25 22:48:36 -08:00
Hiroshi SHIBATA
b7ad60a794 Merge RubyGems/Bundler master
from 72fd3dd209
2022-12-26 15:09:21 +09:00
Kazuki Yamaguchi
24c9adcaeb [ruby/openssl] test/openssl/test_pkey.rb: allow failures in test_s_generate_parameters
Commit f2e2a5e5ed ("test/openssl/test_pkey.rb: allow failures in
test_s_generate_parameters", 2022-12-23) was completely bogus. The
problem in OpenSSL 3.0.0-3.0.5 is that errors from the callback are
sometimes silently suppressed.

ccc1594492
2022-12-26 15:09:21 +09:00
Junichi Ito
cea6951ecf [ruby/optparse] Add symbolize_names to getopts
3e63d878f8
2022-12-26 15:09:21 +09:00
Takashi Kokubun
509da028c2
Rewrite Kernel#loop in Ruby (#6983)
* Rewrite Kernel#loop in Ruby

* Use enum_for(:loop) { Float::INFINITY }

Co-authored-by: Ufuk Kayserilioglu <ufuk@paralaus.com>

* Limit the scope to rescue StopIteration

Co-authored-by: Ufuk Kayserilioglu <ufuk@paralaus.com>
2022-12-25 21:46:29 -08:00
Nobuyoshi Nakada
4378de02f9
Test of environment variables order for HOME on Windows 2022-12-24 23:49:27 +09:00
Nobuyoshi Nakada
6a55b4601a
Add Dir.home test with encoding 2022-12-24 22:55:12 +09:00
Takashi Kokubun
b9332ac8e7
MJIT: Cancel all on disastrous situations (#7019)
I noticed this while running test_yjit with --mjit-call-threshold=1, 
which redefines `Integer#<`. When Ruby is monkey-patched, 
MJIT itself could be broken.

Similarly, Ruby scripts could break MJIT in many different ways. I
prepared the same set of hooks as YJIT so that we could possibly
override it and disable it on those moments. Every constant under
RubyVM::MJIT is private and thus it's an unsupported behavior though.
2022-12-24 01:13:40 -08:00
Hiroshi SHIBATA
f6620037ba Merge RubyGems-3.4.0 and Bundler-2.4.0 2022-12-24 16:57:07 +09:00
Nobuyoshi Nakada
d5635dfe36
Extract setup of environment variables 2022-12-24 11:29:11 +09:00
Samuel Williams
11ad9a42d7
Fix missing handling of offset argument in IO::Buffer pread and pwrite. (#7012) 2022-12-24 07:52:10 +13:00
Yusuke Endoh
a8485291bb test/test_trick.rb: Add tests for TRICK 2022 entries 2022-12-24 03:19:45 +09:00
Peter Zhu
1876cda972 Add tests for compacting shared arrays 2022-12-23 11:21:14 -05:00
Peter Zhu
7891f94071 Don't allow re-embedding frozen arrays
Frozen arrays should not move from heap allocated to embedded because
frozen arrays could be shared roots for other (shared) arrays. If the
frozen array moves from heap allocated to embedded it would cause issues
since the shared array would no longer know where to set the pointer
in the shared root.
2022-12-23 11:21:14 -05:00
Nobuyoshi Nakada
17b63ab6b1
[ruby/rdoc] Fix fragile tests
When the temporary path is long enough, the formatter may fold the
path and may hit a hyphen at the end of line, and miscounted.

5f46479543
2022-12-23 20:31:25 +09:00
Nobuyoshi Nakada
9c1f03a38a
Debug for zlinux CI [ci skip] 2022-12-23 16:57:15 +09:00
Nobuyoshi Nakada
792c50e917 [ruby/rdoc] Clean up home directories for each test
f067c174da
2022-12-23 11:05:09 +09:00
Kazuki Yamaguchi
75e7b85e3e [ruby/openssl] test/openssl/test_pkey.rb: allow failures in test_s_generate_parameters
The root cause has been fixed by OpenSSL 3.0.6, but Ubuntu 22.04's
OpenSSL package has not backported the patch yet.

Reference: https://github.com/ruby/openssl/issues/492

f2e2a5e5ed
2022-12-23 09:39:15 +09:00
Joe Truba
0e11d2c3f8 [ruby/openssl] pkey/ec: check private key validity with OpenSSL 3
The behavior of EVP_PKEY_public_check changed between OpenSSL 1.1.1
and 3.0 so that it no longer validates the private key. Instead, private
keys can be validated through EVP_PKEY_private_check and
EVP_PKEY_pairwise_check.

[ky: simplified condition to use either EVP_PKEY_check() or
EVP_PKEY_public_check().]

e38a63ab3d
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi
a4b4997c69 [ruby/openssl] test/openssl/test_ssl.rb: do not run SSL tests if not available
a3d230d4e0
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi
dd6f3276e0 [ruby/openssl] ssl: disable NPN support on LibreSSL
As noted in commit a2ed156cc9 ("test/test_ssl: do not run NPN tests
for LibreSSL >= 2.6.1", 2017-08-13), NPN is known not to work properly
on LibreSSL.

Disable NPN support on LibreSSL, whether OPENSSL_NO_NEXTPROTONEG is
defined or not.

NPN is less relevant today anyway. Let's also silence test suite when
it's not available.

289f6e0e1f
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi
7c073cc112 [ruby/openssl] test/openssl/test_asn1.rb: remove pend for unsupported LibreSSL versions
Commit af895bc559 ("asn1: avoid truncating OID in
OpenSSL::ASN1::ObjectId#oid", 2016-12-15) added this test case.

The OBJ_obj2txt() issue was fixed by LibreSSL 2.5.1 (released in 2017)
and is no longer relevant today.

6a188f1a29
2022-12-23 09:39:15 +09:00
Kazuki Yamaguchi
5591e4935d [ruby/openssl] test/openssl/test_asn1.rb: skip failing tests on LibreSSL 3.6.0
LibreSSL 3.6.0 expects the seconds part in UTCTime and GeneralizedTime
to be always present. LibreSSL 3.6.0 release note [1] says:

> - The ASN.1 time parser has been refactored and rewritten using CBS.
>   It has been made stricter in that it now enforces the rules from
>   RFC 5280.

[1] https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.6.0-relnotes.txt

bbc540fe83
2022-12-23 09:39:15 +09:00
Nobuyoshi Nakada
dc8c5bafcf
Clean intermediate source file in TestMJIT#test_jit_failure (#6994) 2022-12-22 13:06:31 -08:00