Граф коммитов

16896 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA 03b82d1865 [rubygems/rubygems] util/rubocop -A --only Style/SingleLineMethods
https://github.com/rubygems/rubygems/commit/fa2e835ed2
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA d2cebb4e31 [rubygems/rubygems] util/rubocop -A --only Style/NumericLiterals
https://github.com/rubygems/rubygems/commit/860669b08a
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 712d6e675b [rubygems/rubygems] util/rubocop -A --only Style/RedundantInterpolation
https://github.com/rubygems/rubygems/commit/add44e56eb
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 0b632b9cdd [rubygems/rubygems] util/rubocop -A --only Style/ClassCheck
https://github.com/rubygems/rubygems/commit/1c3356a872
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 567db6064b [rubygems/rubygems] util/rubocop -A --only Style/NestedParenthesizedCalls
https://github.com/rubygems/rubygems/commit/a875fdb535
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 3d4c3f9e4f [rubygems/rubygems] util/rubocop -A --only Style/ParallelAssignment
https://github.com/rubygems/rubygems/commit/5c88c77873
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 4bb5ce8188 [rubygems/rubygems] util/rubocop -A --only Style/StringLiteralsInInterpolation
https://github.com/rubygems/rubygems/commit/cb554f6eb7
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 83f9aa8f02 [rubygems/rubygems] util/rubocop -A --only Style/Alias
https://github.com/rubygems/rubygems/commit/fba6e94de9
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA ae81ff0c9b [rubygems/rubygems] util/rubocop -A --only Layout/MultilineBlockLayout
https://github.com/rubygems/rubygems/commit/9aa6101942
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 26d6604343 [rubygems/rubygems] util/rubocop -A --only Layout/MultilineMethodCallBraceLayout
https://github.com/rubygems/rubygems/commit/acb0548bf6
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 41f304d5bf [rubygems/rubygems] util/rubocop -A --only Layout/SpaceInsideStringInterpolation
https://github.com/rubygems/rubygems/commit/a06f8ae3bb
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 3233b1fe3f [rubygems/rubygems] util/rubocop -A --only Layout/SpaceInLambdaLiteral
https://github.com/rubygems/rubygems/commit/e76088b699
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA f8daae91c4 [rubygems/rubygems] util/rubocop -A --only Layout/SpaceBeforeSemicolon
https://github.com/rubygems/rubygems/commit/c92c6d8e85
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 4b285e5c6f [rubygems/rubygems] util/rubocop -A --only Layout/AssignmentIndentation
https://github.com/rubygems/rubygems/commit/8e64298989
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 9ffd73523d [rubygems/rubygems] util/rubocop -A --only Layout/EmptyLinesAroundExceptionHandlingKeywords
https://github.com/rubygems/rubygems/commit/ad1fe68d97
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 583fbc627c [rubygems/rubygems] util/rubocop -A --only Layout/EmptyLinesAroundModuleBody
https://github.com/rubygems/rubygems/commit/48c88466b7
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA c480a0c46a [rubygems/rubygems] util/rubocop -A --only Layout/LeadingCommentSpace
https://github.com/rubygems/rubygems/commit/4d680320e3
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA d9f92511ad [rubygems/rubygems] util/rubocop -A --only Layout/SpaceInsidePercentLiteralDelimiters
https://github.com/rubygems/rubygems/commit/c6de27fc6d
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 85fd33c526 [rubygems/rubygems] util/rubocop -A --only Layout/SpaceInsideArrayPercentLiteral
https://github.com/rubygems/rubygems/commit/75abd2e504
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA dab1d0ed20 [rubygems/rubygems] util/rubocop -A --only Layout/EmptyLineBetweenDefs
https://github.com/rubygems/rubygems/commit/00117e69cc
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 7c1d590a8a [rubygems/rubygems] util/rubocop -A --only Layout/SpaceBeforeComma
https://github.com/rubygems/rubygems/commit/4a5b70b508
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 23150e0274 [rubygems/rubygems] util/rubocop -A --only Layout/MultilineHashBraceLayout
https://github.com/rubygems/rubygems/commit/bf33d106d0
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 05208c3875 [rubygems/rubygems] util/rubocop -A --only Lint/UnusedBlockArgument
https://github.com/rubygems/rubygems/commit/d8efd919db
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 65752b61e7 [rubygems/rubygems] util/rubocop -A --only Performance/Count
https://github.com/rubygems/rubygems/commit/46d5d6d1d3
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA 2dddac0475 [rubygems/rubygems] util/rubocop -a test/rubygems/helper.rb and styling
https://github.com/rubygems/rubygems/commit/fe331736d4
2023-03-17 18:50:55 +09:00
Hiroshi SHIBATA b09973a995 [rubygems/rubygems] Also removed condition of RUBY_PATCHLEVEL
https://github.com/rubygems/rubygems/commit/16f381be4b
2023-03-17 18:50:55 +09:00
David Rodríguez dd0f0a5e6e [rubygems/rubygems] Fix `gem uninstall` with `--install-dir`
https://github.com/rubygems/rubygems/commit/ac23687353
2023-03-17 18:50:55 +09:00
David Rodríguez 123bedd295 [rubygems/rubygems] Extract some common logic to a test helper
https://github.com/rubygems/rubygems/commit/ef4741b7cb
2023-03-17 18:50:55 +09:00
David Rodríguez 5733828734 [rubygems/rubygems] Fix `rake check_manifest` when `rake` is `--user-installed`'d
Otherwise we get

```
✗ rake TEST=test/rubygems/test_project_sanity.rb
Loaded suite /Users/deivid/.gem/ruby/3.2.0/gems/rake-13.0.6/lib/rake/rake_test_loader
Started
E
============================================================================================================================================================================================================
Error: test_manifest_is_up_to_date(TestProjectSanity):
  RuntimeError: There was an error running `rake check_manifest`: /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems.rb:263:in `find_spec_for_exe': can't find gem rake (>= 0.a) with executable rake (Gem::GemNotFoundException)
  	from /Users/deivid/.asdf/installs/ruby/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems.rb:282:in `activate_bin_path'
  	from /Users/deivid/.asdf/installs/ruby/3.2.1/bin/rake:25:in `<main>'
/Users/deivid/Code/rubygems/rubygems/test/rubygems/test_project_sanity.rb:27:in `test_manifest_is_up_to_date'
     24:
     25:         raise "Expected Manifest.txt to be up to date, but it's not. Run `rake update_manifest` to sync it."
     26:       else
  => 27:         raise "There was an error running `rake check_manifest`: #{out}"
     28:       end
     29:     end
     30:   end
============================================================================================================================================================================================================
.
Finished in 0.188192 seconds.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2 tests, 1 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
50% passed
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
10.63 tests/s, 5.31 assertions/s
rake aborted!
```

https://github.com/rubygems/rubygems/commit/29829933a6
2023-03-17 18:50:55 +09:00
David Rodríguez 37c2e903e8 [rubygems/rubygems] Show error when `rake check_manifest` fails for unknown reason
https://github.com/rubygems/rubygems/commit/98de85c11e
2023-03-17 18:50:55 +09:00
lukeg d2c6dca8f4 Fix small issues concerning namespacing in test-all suite
* Fix temporary methods on Object leaking across test cases.
* Remove temporary classes/modules leaking across test cases.
2023-03-17 08:46:37 +09:00
Takashi Kokubun a8e7fee801 Revert "core_assertions.rb: Refine `assert_linear_performance`"
This reverts commit cae4342dd5.

This is failing a lot of CIs and nobody is actively looking into fixing
it. Let me revert this until we have a solution to it.
2023-03-16 09:22:42 -07:00
Alan Wu 2f81bb793f Add thread and ractor counts to bug reports
This is useful for crash triaging. It also helps to hint extension
developers about the misuse of `rb_thread_call_without_gvl()`.

Example:

    $ ./miniruby -e 'Ractor.new{Ractor.receive};
        Thread.new{sleep}; Process.kill:SEGV,Process.pid'
    <snip>
    -- Threading information ---------------------------------------------------
    Total ractor count: 2
    Ruby thread count for this ractor: 2
2023-03-16 10:46:30 -04:00
Mau Magnaguagno 89f7acba3c [rubygems/rubygems] Improve TarTestCase#calc_checksum
https://github.com/rubygems/rubygems/commit/97add0d1d7
2023-03-16 12:55:01 +00:00
Nobuyoshi Nakada cae4342dd5
core_assertions.rb: Refine `assert_linear_performance`
* Use an `Enumerable` as factors, instead of three arguments.
2023-03-16 18:51:02 +09:00
Nobuyoshi Nakada 0b303c6830 [ruby/openssl] Relax error message check for OpenSSL 3.1
A tentative measures fo https://github.com/ruby/openssl/issues/606.

With OpenSSL 3.1.0, the error message at connection using "self-signed
certificate" seems to return `SSL_R_TLSV1_ALERT_UNKNOWN_CA` instead of
`SSL_R_CERTIFICATE_VERIFY_FAILED`.

https://github.com/ruby/openssl/commit/fc4629d246
2023-03-16 17:17:46 +09:00
Hiroshi SHIBATA a90302adec [rubygems/rubygems] Added OpenSSL namespace explicitly
https://github.com/rubygems/rubygems/commit/bf4382e7a7
2023-03-15 11:21:21 +00:00
Koichi Sasada 6462c1a042 `Hash#dup` for kwsplat arguments
On `f(*a, **kw)` method calls, a rest keyword parameter is identically
same Hash object is passed and it should make `#dup`ed Hahs.

fix https://bugs.ruby-lang.org/issues/19526
2023-03-15 18:05:13 +09:00
Samuel Williams 7fd53eeb46
Remove SIGCHLD `waidpid`. (#7527)
* Remove `waitpid_lock` and related code.

* Remove un-necessary test.

* Remove `rb_thread_sleep_interruptible` dead code.
2023-03-15 19:48:27 +13:00
Hiroshi SHIBATA 31137dc67f [rubygems/rubygems] Removed test for
https://github.com/rubygems/rubygems/pull/6444, I have no idea to
migrate this test to bundler example
yet

https://github.com/rubygems/rubygems/commit/0d869019bf
2023-03-15 03:35:54 +00:00
Peter Zhu 3dc8cde700 Fix crash during compaction
[Bug #19529]

The fix for [Bug #19529] in commit 548086b contained a bug that crashes
on the following script:

```
wm = ObjectSpace::WeakMap.new
obj = Object.new
100.times do
  wm[Object.new] = obj
  GC.start
end
GC.compact
```
2023-03-14 23:18:11 -04:00
Jean Boussier 548086b34e ObjectSpace::WeakMap: fix compaction support
[Bug #19529]

`rb_gc_update_tbl_refs` can't be used on `w->obj2wmap` because it's
not a `VALUE -> VALUE` table, but a `VALUE -> VALUE *` table, so
we need some dedicated iterator.
2023-03-14 16:49:23 +01:00
Samuel Williams ac65ce16e9
Revert SIGCHLD changes to diagnose CI failures. (#7517)
* Revert "Remove special handling of `SIGCHLD`. (#7482)"

This reverts commit 44a0711eab.

* Revert "Remove prototypes for functions that are no longer used. (#7497)"

This reverts commit 4dce12bead.

* Revert "Remove SIGCHLD `waidpid`. (#7476)"

This reverts commit 1658e7d966.

* Fix change to rjit variable name.
2023-03-14 20:07:59 +13:00
dependabot[bot] 5868a7843a [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.65 to 0.9.67.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.65...v0.9.67)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-14 04:08:17 +00:00
Hiroshi SHIBATA c58759f494
Removed to load jit_support.rb
It's removed at 4445b9e2a2
2023-03-14 12:51:58 +09:00
Takashi Kokubun d8344559b2 RJIT: Simplify how Capstone is used in tests 2023-03-13 20:42:19 -07:00
Stan Lo 1095baed34 [ruby/irb] Support inspecting BasicObject
(https://github.com/ruby/irb/pull/541)

https://github.com/ruby/irb/commit/1dc2a406a3
2023-03-13 14:31:37 +00:00
TSUYUSATO Kitsune dddc542e9b
[Bug #19476]: correct cache index computation for repetition (#7457) 2023-03-13 18:31:13 +09:00
git 7686687a79 * remove trailing spaces. [ci skip] 2023-03-13 06:46:54 +00:00
TSUYUSATO Kitsune e22c4e8877
[Bug #19467] correct cache points and counting failure on `OP_ANYCHAR_STAR_PEEK_NEXT` (#7454) 2023-03-13 15:46:41 +09:00
Nobuyoshi Nakada 7ce4b716bd
Add test for linear performance 2023-03-12 18:50:39 +09:00
Takashi Kokubun 3efe4639ec RJIT: Handle Mod 10 for CMP r/m64, r64 2023-03-11 23:47:11 -08:00
Takashi Kokubun 9c220bf5e1 RJIT: Use lambda constants to match operands 2023-03-11 23:35:58 -08:00
Takashi Kokubun e4caf59cc1 Move yjit_force_enabled? to JITSupport
for consistency
2023-03-11 20:59:03 -08:00
Takashi Kokubun 4445b9e2a2 Remove unused methods from JITSupport 2023-03-11 20:56:29 -08:00
Takashi Kokubun 195e32977f Skip test_udp_server on s390x RHEL 7.1
It seems like it never succeeds on this CI.
2023-03-11 20:51:49 -08:00
Hiroshi SHIBATA f7b215af0e [rubygems/rubygems] Added another case of extconf.rb
https://github.com/rubygems/rubygems/commit/3d0fa3dee8
2023-03-11 04:44:44 +00:00
Hiroshi SHIBATA 9801ad47bd [rubygems/rubygems] Added test for
https://github.com/rubygems/rubygems/pull/6444

https://github.com/rubygems/rubygems/commit/7d6ece5c92
2023-03-11 04:44:44 +00:00
Takashi Kokubun 93e34fe42e RJIT: Write initial tests for Assembler 2023-03-10 14:57:37 -08:00
Takashi Kokubun 76808b1ee4 RJIT: Start testing Assembler 2023-03-10 13:57:52 -08:00
Takashi Kokubun ac5f983f7d
RJIT: Break up and enable test_version (#7495) 2023-03-10 10:07:52 -08:00
Aaron Patterson 365fed6369
Revert "Allow classes and modules to become too complex"
This reverts commit 69465df424.
2023-03-10 08:50:43 -08:00
Hiroshi SHIBATA 5e27d82dd0 [rubygems/rubygems] rubocop -a test/rubygems/test_gem.rb
https://github.com/rubygems/rubygems/commit/4d20ed7e32
2023-03-10 05:16:52 +00:00
Hiroshi SHIBATA f1c9f89ff8 [rubygems/rubygems] Disable side-effect of GEM_HOME configuration
https://github.com/rubygems/rubygems/commit/c43328ab03
2023-03-10 05:16:52 +00:00
Hiroshi SHIBATA 15739c66b7 [rubygems/rubygems] Added only missing extensions option into pristine command
https://github.com/rubygems/rubygems/commit/cfd0e615d7
2023-03-10 03:51:16 +00:00
Nobuyoshi Nakada a7bc000eaa
Revert and refine tests for uninitialized queue
`Queue` and `SizedQueue` still check array members.  Only the test of
`ConditionVariable` is useless.
2023-03-10 12:03:31 +09:00
Nobuyoshi Nakada 0a466e3072
Remove stale tests
These tests were added at a198bb3929,
when these classes were `Struct`s.  Since these classes have been
rewritten, these tests no longer make sense.
2023-03-10 11:54:59 +09:00
HParker 69465df424 Allow classes and modules to become too complex
This makes the behavior of classes and modules when there are too many instance variables match the behavior of objects with too many instance variables.
2023-03-09 15:34:49 -08:00
KJ Tsanaktsidis 7bd7aee02e Fix interpreter crash caused by RUBY_INTERNAL_EVENT_NEWOBJ + Ractors
When a Ractor is created whilst a tracepoint for
RUBY_INTERNAL_EVENT_NEWOBJ is active, the interpreter crashes. This is
because during the early setup of the Ractor, the stdio objects are
created, which allocates Ruby objects, which fires the tracepoint.
However, the tracepoint machinery tries to dereference the control frame
(ec->cfp->pc), which isn't set up yet and so crashes with a null pointer
dereference.

Fix this by not firing GC tracepoints if cfp isn't yet set up.
2023-03-09 09:46:14 +01:00
Nobuyoshi Nakada cf08a85b85 [rubygems/rubygems] Ensure that `TempIO` is closed
https://github.com/rubygems/rubygems/commit/dc7b9db514
2023-03-09 06:19:56 +00:00
lukeg 2ecdefab7d Make sure TestDefaultGems#test_validate_gemspec runs even when Dir.pwd != srcdir
For instance, when running tests in build directory like:

$ make test-all TESTOPTS="../ruby/test"
2023-03-09 13:18:07 +09:00
Samuel Williams 1658e7d966
Remove SIGCHLD `waidpid`. (#7476)
* Remove `waitpid_lock` and related code.

* Remove un-necessary test.

* Remove `rb_thread_sleep_interruptible` dead code.
2023-03-09 16:05:47 +13:00
Peter Zhu e1bd45624c Fix crash when allocating classes with newobj hook
We need to zero out the whole slot when running the newobj hook for a
newly allocated class because the slot could be filled with garbage,
which would cause a crash if a GC runs inside of the newobj hook.

For example, the following script crashes:

```
require "objspace"

GC.stress = true

ObjectSpace.trace_object_allocations {
  100.times do
    Class.new
  end
}
```

[Bug #19482]
2023-03-08 08:47:18 -05:00
Martin Emde 85a1738ab3 [rubygems/rubygems] Add TarReader::Entry#seek to seek within the tar file entry
TarReader#each previously implemented a partial version of seek.
This code moved to Entry#seek for use from TarReader#each.

Entry#close now returns nil instead of true, like IO#close.

Closing an Entry now seeks to the end of the Entry, seeking past
any remaining zero byte tar file padding and moving the io to the
correcty position to read the next file in the archive.

Uses seek for Entry#rewind and #pos=, fixing the tar->gzip->tar nested
rewind that would break previous to this change.

Add Entry.open that behaves more like File.open.

https://github.com/rubygems/rubygems/commit/f5149565d5
2023-03-07 20:21:43 +00:00
Josef Šimánek dc33d32f12
Use proper memoized var name for Gem.state_home. 2023-03-07 16:52:28 +09:00
David Rodríguez 5d790264ea [rubygems/rubygems] Remove hardcoded master branch references
Let RubyGems use the default branch defined by each repo.

https://github.com/rubygems/rubygems/commit/54bd3e9ebd
2023-03-07 16:51:35 +09:00
David Rodríguez bd0f2c7958 [rubygems/rubygems] Let git source use default cloned repo branch
https://github.com/rubygems/rubygems/commit/d8af770379
2023-03-07 16:51:34 +09:00
Takashi Kokubun 23ec248e48 s/mjit/rjit/ 2023-03-06 23:44:01 -08:00
Takashi Kokubun 2e875549a9 s/MJIT/RJIT/ 2023-03-06 23:44:01 -08:00
Samuel Williams 7abe47b85a
Improve robustness of `io_wait` implementation. (#7456)
- Restore correct handling of `duration`.
- Don't delete from `@readable` or `@writable` unless it was added.
- A little more documentation.
2023-03-07 19:38:58 +13:00
Takashi Kokubun f68580890f Stop building mjit_build_dir.so 2023-03-06 22:14:44 -08:00
Takashi Kokubun a1ad5a2165 Omit test_version for Cirrus for now 2023-03-05 23:28:59 -08:00
Takashi Kokubun 91f1dc532c Remove an obsoleted test 2023-03-05 23:28:59 -08:00
Takashi Kokubun 5ab8cf3f0d Skip a failing shape test 2023-03-05 22:11:20 -08:00
Takashi Kokubun 40ffc1e0f4 Drop existing MJIT tests 2023-03-05 22:11:20 -08:00
tomoya ishida 0463c5806a [ruby/irb] Improve method completion for string and regexp that
includes word break characters
(https://github.com/ruby/irb/pull/523)

* Improve method completion for string and regexp that includes word break characters

* Remove completion-test's assert_not_include because candidates no longer include every possible methods

* Add comment about string's method completion regexp

Co-authored-by: Stan Lo <stan001212@gmail.com>

* Add comment about regexp's method completion regexp

Co-authored-by: Stan Lo <stan001212@gmail.com>

---------

https://github.com/ruby/irb/commit/aa8128c533

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-03-06 05:52:46 +00:00
Hiroshi SHIBATA bab809d98f [rubygems/rubygems] Introduce Gem::Specification.find_by_full_name for finding conbination of name and version for gemspec
https://github.com/rubygems/rubygems/commit/0430551215
2023-03-05 23:52:28 +00:00
Stan Lo 191e4ae33f [ruby/irb] Drop chained methods' completion support
(https://github.com/ruby/irb/pull/529)

Consider completion for this example: `foo.bar.b`

Without type information, it is hard to know the return value of the `bar`
method, so the current implementation interates through `ObjectSpace` to
get all possible candidates for the second method.

In small projects, the performance and accuracy are acceptable. But in
bigger projects, the performance is unacceptable and the accuracy is mostly
poor.

So this commit drops the support for chained methods' completion.
2023-03-04 15:34:49 +00:00
tomoya ishida 6f81e38d1d [ruby/reline] Fix completion with multiline
(https://github.com/ruby/reline/pull/513)

https://github.com/ruby/reline/commit/d76c482c5f
2023-03-04 05:56:00 +00:00
Kevin Menard 8e13e705f9 [ruby/irb] Remove no longer necessary TruffleRuby test exclusions.
(https://github.com/ruby/irb/pull/527)

https://github.com/ruby/irb/commit/8473d0bc0f

Co-authored-by: Stan Lo <stan.lo@shopify.com>
2023-03-03 15:25:29 +00:00
tomoya ishida b49053a6be [ruby/irb] Avoid slow symbol completion when completion target is an
empty symbol
(https://github.com/ruby/irb/pull/534)

https://github.com/ruby/irb/commit/35697f3ef3
2023-03-03 13:41:21 +00:00
tomoya ishida a2b776a9b7 [ruby/irb] Fix prompt test not to change STDIO.external_encoding
(https://github.com/ruby/irb/pull/535)

https://github.com/ruby/irb/commit/09f16259db
2023-03-03 10:18:51 +00:00
Nobuyoshi Nakada 680bd9027f [Bug #19471] `Regexp.compile` should handle keyword arguments
As well as `Regexp.new`, it should pass keyword arguments to the
`Regexp#initialize` method.
2023-03-03 15:27:37 +09:00
David Rodríguez 90b74d8c65 [rubygems/rubygems] Fix warning about ambiguous `/`
```
/path/to/rubygems/test/rubygems/test_gem_commands_exec_command.rb:745: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator
```

https://github.com/rubygems/rubygems/commit/e6a538b5c8
2023-03-03 13:43:59 +09:00
David Rodríguez 7fea848568 [rubygems/rubygems] Fix warnings about unused variable
```
/path/to/rubygems/test/rubygems/test_gem_commands_exec_command.rb:180: warning: assigned but unused variable - platforms
```

https://github.com/rubygems/rubygems/commit/7e022cb5e3
2023-03-03 13:43:59 +09:00
David Rodríguez b6d914c722 [rubygems/rubygems] Fix warning about ambiguous `*`
```
/path/to/rubygems/test/rubygems/test_gem_commands_exec_command.rb:42: warning: `*' interpreted as argument prefix
```

https://github.com/rubygems/rubygems/commit/0806ebf4e0
2023-03-03 13:43:58 +09:00
Nobuyoshi Nakada bd17bea6c5 [ruby/irb] Fix warnings because of `@context.main.delete`
If the main object of the context has `#delete` method, the following
warning is printed.

```
irb: warn: can't alias delete from irb_delete.
```

https://github.com/ruby/irb/commit/00b39be61f
2023-03-03 02:44:35 +00:00
David Rodríguez 4467084098 [rubygems/rubygems] Enable `Layout/DefEndAlignment`
https://github.com/rubygems/rubygems/commit/4403613fae
2023-03-02 21:13:12 +00:00
tomoya ishida 556439613a [ruby/irb] Handle long inspect and control character in prompt
string
(https://github.com/ruby/irb/pull/528)

* Handle long inspect and control characters in prompt string

* Add constants for prompt truncate length, omission and replace pattern

* Simply compare string instead of regexp in prompt truncation test
2023-03-02 13:53:44 +00:00
Jeremy Evans 04cfb26bd3 Remove support for the Regexp.new 3rd argument
This was deprecated in Ruby 3.2.

Fixes [Bug #18797]
2023-03-01 23:42:47 -08:00
Stan Lo 9ddd73060b [ruby/irb] Display and prioritise instance methods in `ls
<module/class>`
(https://github.com/ruby/irb/pull/496)

https://github.com/ruby/irb/commit/e3d21f9329
2023-02-28 14:36:12 +00:00
lukeg d2c38aa823 A file was missing in test/excludes for TestArraySubclass 2023-02-28 11:04:32 +09:00
lukeg ba55706fb6 fix test/rubygems/test_gem_package_task.rb when in -j mode
This test skipped sometimes due to failure to load 'rake/packagetask'.
This is due to manipulation of $LOAD_PATH by other rubygems tests. If
rake is loaded before any rubygems tests run, then it works fine.

To reproduce the skipping behavior:
  $ make test-all TESTOPTS="-j6 --test-order=sorted test/rubygems/test_*.rb"
2023-02-28 06:34:27 +09:00
Alan Wu 0eb634ae73 YJIT: Detect and reject `send(:alias_for_send, :foo)`
Previously, YJIT failed to put the stack into the correct shape when
`BasicObject#send` calls an alias method for the send method itself.
This can manifest as strange `NoMethodError`s in the final non-send
receiver, as [seen][1] with the kt-paperclip gem. I also found a case
where it makes YJIT fail the stack size assertion while compiling
`leave`.

YJIT's `BasicObject#__send__` implementation already rejects sends to
`send`, but didn't detect sends to aliases of `send`. Adjust the
detection and reject these cases.

Fixes [Bug #19464]

[1]: https://github.com/Shopify/yjit/issues/306
2023-02-27 11:12:22 -05:00
Stan Lo 0aa50a03b1 [ruby/irb] Provide more useful message when
`IRB::Inspector#inspect_value` errors
(https://github.com/ruby/irb/pull/511)

**Before**

```
irb(main):001:0> c = Cat.new "foo"
(Object doesn't support #inspect)
=>
```

**After**

```
irb(main):001:0> c = Cat.new "foo"
An error occurred when inspecting the object: #<NoMethodError: undefined method `is_a?' for foo:Cat

      if obj.is_a?(String)
            ^^^^^^>
Result of Kernel#inspect: #<Cat:0x0000000109090d80 @name="foo">
=>
```
2023-02-27 11:07:19 +00:00
tomoya ishida 4f611df3f7 [ruby/reline] Fix wrong indent number in prompt. whole_lines has
duplicated line.
(https://github.com/ruby/reline/pull/460)

* whole_lines should consider prev_line_index, and must not duplicate last_line

* Add test for lines passed to dynamic prompt proc

* Refactor whole_lines parameters used in test helper

* Remove whole_line's arguments
2023-02-27 10:21:30 +00:00
Hiroshi SHIBATA db0a4c8923 Prefer to use File.foreach instead of IO.foreach 2023-02-27 18:49:18 +09:00
Hiroshi SHIBATA d3d8cd304f Prefer to use File.readlines instead of IO.readlines 2023-02-27 18:49:18 +09:00
tomoya ishida 92ed8e6f3f [ruby/reline] Fix the cause of test_yamatanooroti randomly failing
(https://github.com/ruby/reline/pull/474)

* Add repeated input-delete test that fails on HEAD

* Use raw mode while readmultiline
2023-02-27 08:44:02 +00:00
Yusuke Endoh b6704201a3 Add all-ruby-quine as a sample code
This sample code works on all release versions of Ruby, from Ruby 0.49.
2023-02-27 11:20:42 +09:00
Samuel Williams 57bc3f2f46
Add `IO::Buffer.string` for efficient string creation. (#7364) 2023-02-25 18:40:26 +13:00
Alan Wu 132934b82b
YJIT: Generate Block::entry_exit with block entry PC
Previously, when Block::entry_exit is requested from any instruction
that is not the first one in the block, we generated the exit with an
incorrect PC. We should always be using the PC for the entry of the
block for Block::entry_exit.

It was a simple typo. The bug was [introduced][1] while we were
refactoring to use the current backend. Later, we had a chance to spot
this issue while [preparing][2] to enable unused variable warnings, but
didn't spot the issue.

Fixes [Bug #19463]

[1]: 27fcab995e
[2]: 31461c7e0e
2023-02-24 16:18:53 -05:00
Peter Zhu 3e09822407 Fix incorrect line numbers in GC hook
If the previous instruction is not a leaf instruction, then the PC was
incremented before the instruction was ran (meaning the currently
executing instruction is actually the previous instruction), so we
should not increment the PC otherwise we will calculate the source
line for the next instruction.

This bug can be reproduced in the following script:

```
require "objspace"

ObjectSpace.trace_object_allocations_start
a =

  1.0 / 0.0
p [ObjectSpace.allocation_sourceline(a), ObjectSpace.allocation_sourcefile(a)]
```

Which outputs: [4, "test.rb"]

This is incorrect because the object was allocated on line 10 and not
line 4. The behaviour is correct when we use a leaf instruction (e.g.
if we replaced `1.0 / 0.0` with `"hello"`), then the output is:
[10, "test.rb"].

[Bug #19456]
2023-02-24 14:10:09 -05:00
Stan Lo 07403de5a8 [ruby/irb] Cleanup completion tests
(https://github.com/ruby/irb/pull/520)

* Remove redundant completion test

The test case was introduced to guard an old implementation, which relied
on `Module#name`. Commit:

8827d18274

However, the current implementation has avoided calling `Module#name`
completely, so the test case is no longer necessary. Commit:

88311ce3c8

* Remove unnecessary pend
2023-02-24 13:34:40 +00:00
Akinori MUSHA 5d5ff6e5ed [ruby/set] Set#merge does not take keyword arguments as a Hash
https://github.com/ruby/set/commit/ca1c9532a9
2023-02-24 11:48:08 +00:00
Akinori MUSHA 454ac4cbb2 [ruby/set] Set#merge takes many enumerable objects like Hash#merge! does
https://github.com/ruby/set/commit/becaca994d
2023-02-24 11:48:07 +00:00
Jean Boussier 2a5354e593 Implement ObjectSpace::WeakKeyMap basic allocator
[Feature #18498]
2023-02-23 16:01:57 +01:00
Nobuyoshi Nakada b112ae9971
Skip failing test on MSWin 2023-02-22 22:14:26 +09:00
Samuel Giddins 6232e1b9c0 [rubygems/rubygems] Skip extension test on jruby
https://github.com/rubygems/rubygems/commit/38ee82c297
2023-02-22 08:42:21 +00:00
Samuel Giddins 151ae9790f [rubygems/rubygems] Better teardown
https://github.com/rubygems/rubygems/commit/5fa0ebf09b
2023-02-22 08:42:20 +00:00
Samuel Giddins a17b1b19b1 [rubygems/rubygems] Always join with a string
Gem.path_separator can also be a regexp...

https://github.com/rubygems/rubygems/commit/7e6e56a5f3
2023-02-22 08:42:20 +00:00
Samuel Giddins 616a7e1f6c [rubygems/rubygems] Nil out Gem.configuration after tests
https://github.com/rubygems/rubygems/commit/3135ad91d4
2023-02-22 08:42:19 +00:00
Samuel Giddins ae5deb1ebc [rubygems/rubygems] Use assert_raise instead of assert_raises
For ruby-core compat

https://github.com/rubygems/rubygems/commit/c8f85c91a8
2023-02-22 08:42:19 +00:00
Samuel Giddins 931db21208 [rubygems/rubygems] Add tests covering pre-releases for gem exec
https://github.com/rubygems/rubygems/commit/f6877c29b9
2023-02-22 08:42:18 +00:00
Samuel Giddins 80bfa1b30a [rubygems/rubygems] Fix resetting env in gem exec, and make sure it is set for gem exec gem
https://github.com/rubygems/rubygems/commit/13a6dd4992
2023-02-22 08:42:18 +00:00
Samuel Giddins 2dd9698350 [rubygems/rubygems] Allow gem exec gem
https://github.com/rubygems/rubygems/commit/a767f7b9be
2023-02-22 08:42:17 +00:00
Samuel Giddins 47d4f73ee7 [rubygems/rubygems] Remove platform option for gem exec
Also fix native extensions that load dependencies

https://github.com/rubygems/rubygems/commit/a06f9870c7
2023-02-22 08:42:17 +00:00
Samuel Giddins 612ebd10c0 [rubygems/rubygems] Ensure dependencies are updated by default when running gem exec
https://github.com/rubygems/rubygems/commit/664f3e1e5f
2023-02-22 08:42:16 +00:00
Samuel Giddins d81be0609b [rubygems/rubygems] Add specs for gem exec
https://github.com/rubygems/rubygems/commit/3078e5834e
2023-02-22 08:42:16 +00:00
Hiroshi SHIBATA 015bf5c461
Removed accidentally commits with ruby/readline-ext
Partly reverted 1ddda4c0d7
2023-02-22 10:20:20 +09:00
Hiroshi SHIBATA fc59b58715 [ruby/readline-ext] test_readline.rb only needs EnvUtil
https://github.com/ruby/readline-ext/commit/9245965ecd
2023-02-22 01:18:26 +00:00
Hiroshi SHIBATA 088919065e [ruby/readline-ext] Omit some tests with macOS platform
https://github.com/ruby/readline-ext/commit/efe2be6e4c
2023-02-22 01:18:25 +00:00
Hiroshi SHIBATA 1ddda4c0d7 [ruby/readline-ext] Import EnvUtils and related test libraries
https://github.com/ruby/readline-ext/commit/f034697a48
2023-02-22 01:18:25 +00:00
Stan Lo 50e77b6a9c [ruby/irb] Improve RubyLex's tests
(https://github.com/ruby/irb/pull/484)

* Improve assert_indenting helper

Instead of putting assertions inside the `auto_indent` block, we
can just make `auto_indent` return the calculated space count, and use
it for assertion outside of the `auto_indent` block call.

This simplifies the setup code and makes the intention easier to
understand.

* Introduce assert_row_indenting helper

1. Helper users shouldn't need to write 2 assertions for the current and
   the next line's indentation.
2. With this new approach, we can generate clearer error message for
   both cases:

When the current line's space count doesn't match

```
  Incorrect spaces calculation for line:

  ```
> def each_top_level_statement
  ```

  All lines:

  ```
  def each_top_level_statement
  ```

<0> expected but was
<nil>
```

When the next line's space count doesn't match

```
  Incorrect spaces calculation for line after the current line:

  ```
  def each_top_level_statement
>
  ```

  All lines:

  ```
  def each_top_level_statement
  ```

<3> expected but was
<2>
```

* Replace assert_indenting with assert_row_indenting
2023-02-21 19:38:09 +00:00
Peter Zhu 93ac7405b8 Add marking and sweeping time to GC.stat
There is a `time` key in GC.stat that gives us the total time spent in
GC. However, we don't know what proportion of the time is spent between
marking and sweeping. This makes it difficult to tune the GC as we're
not sure where to focus our efforts on.

This PR adds keys `marking_time` and `sweeping_time` to GC.stat for the
time spent marking and sweeping, in milliseconds.

[Feature #19437]
2023-02-21 08:05:31 -05:00
Charles Oliver Nutter 4c7726516c [ruby/strscan] Mask out this test on JRuby/Windows
See https://github.com/jruby/jruby/issues/7644 for the root issue,
which will require fixes to JRuby's regular expression engine,
JOni.

https://github.com/ruby/strscan/commit/29a65abff2
2023-02-21 19:31:39 +09:00
Sutou Kouhei 76a4cdfb02 [ruby/strscan] test: Run test more with fixed anchor mode
(https://github.com/ruby/strscan/pull/60)

fix https://github.com/ruby/strscan/pull/56
2023-02-21 19:31:38 +09:00
OKURA Masafumi 260bc7cdfa [ruby/strscan] Add test case to `test_string`
(https://github.com/ruby/strscan/pull/58)

`string` returns the original string after `scan` is called. Current
test doesn't check this behavior and now it's covered.
2023-02-21 19:31:38 +09:00
Sutou Kouhei a350ef9f7a [ruby/csv] test: use mailing list ID instead of unavailable URL
https://github.com/ruby/csv/commit/04862ccf87
2023-02-21 19:31:29 +09:00
Vivek Bharath Akupatni 2ac1efc0f3 [ruby/csv] Use https links instead of http
(https://github.com/ruby/csv/pull/274)

https://github.com/ruby/csv/commit/e2a06929a8
2023-02-21 19:31:29 +09:00
Hiroshi SHIBATA 38fa8eb4cb Merge rubygems/bundler master
Pick from e9304aed7e
2023-02-21 19:28:12 +09:00
dependabot[bot] ba2bd6d0f1 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.64 to 0.9.65.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.64...v0.9.65)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-21 10:05:41 +00:00
Yusuke Endoh 6384f7981c Prevent "warning: ambiguity between regexp and two divisions"
http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20230221T031004Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20230221T031004Z/ruby/test/rubygems/test_gem_ext_cargo_builder.rb:90: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `/' operator
```
2023-02-21 13:46:11 +09:00
Takashi Kokubun ecd0cdaf82
YJIT: Fix assertion for partially mapped last pages (#7337)
Follows up [Bug #19400]
2023-02-20 09:06:09 -08:00
Yusuke Endoh 8f868a1a65 Update some tests for the new message format of NoMethodError 2023-02-20 10:33:06 +09:00
Eric Wong 924ab1b7fd test/readline/test_readline.rb: skip a test x86_64-linux-(x32|i[3-6]86)
I run a 32-bit (x86) userspace on a 64-bit kernel to save memory
and this test fails for the same reason it does on pure 32-bit
platforms.

Followup-to: 6cf7c0a48f (test/readline/test_readline.rb: skip a test on i686-linux, 2021-11-09)
2023-02-19 22:39:28 +00:00
Yusuke Endoh 29f88b9fea [ruby/error_highlight] Support the new message format of NameError in Ruby 3.3
https://bugs.ruby-lang.org/issues/18285
https://github.com/ruby/ruby/pull/6950

https://github.com/ruby/error_highlight/commit/a7c2da052e
2023-02-19 10:29:56 +00:00
Yusuke Endoh 4dc2cb3c1a [ruby/did_you_mean] Support the new message format of NameError in
Ruby 3.3
(https://github.com/ruby/did_you_mean/pull/184)

This change accepts the following change of the message of NameError in
a test.

https://bugs.ruby-lang.org/issues/18285#note-37

```
old: undefined method `sizee' for #<File:...>
new: undefined method `sizee' for an instance of File
```
2023-02-19 07:10:47 +00:00
Maciej Rzasa 36e3d46d35 [ruby/bigdecimal] Handle correctly #remainder with infinity. Fixes
https://github.com/ruby/bigdecimal/pull/187

https://github.com/ruby/bigdecimal/commit/4b8572d452
2023-02-17 17:46:27 +00:00
Nobuyoshi Nakada dd28c55a7c
[Bug#19445] Fix keyword splat in enumerator
Extracted arguments do not have keyword hash to splat.
2023-02-17 10:57:22 +09:00
Alan Wu a4b7ec1229 YJIT: Fix false assumption that String#+@ => ::String
Could return a subclass.

[Bug #19444]
2023-02-16 18:50:42 -05:00
Alan Wu c178926fbe YJIT: jit_prepare_routine_call() for String#+@ missing
We saw SEGVs due to this when running with StackProf, which needs a
correct PC for RUBY_INTERNAL_EVENT_NEWOBJ, the same event used for
ObjectSpace allocation tracing.

[Bug #19444]
2023-02-16 18:50:42 -05:00
Haldun Bayhantopcu 0b4b2cd1ee Fix removing ivars from clases and modules.
Co-authored-by: Adam Hess <hparker@github.com>
2023-02-15 15:43:46 -08:00
Benoit Daloze 70d84a5f3d [ruby/timeout] Simplify test
https://github.com/ruby/timeout/commit/db017da726
2023-02-15 19:25:05 +00:00
Rick Blommers 610375edfc [ruby/timeout] Don't move the timer_thread when it's enclosed
Don't move the timer_thread to ThreadGroup::Default, when it's
created in an enclosed ThreadGroup.
Prevents the exception: "add" can't move from the enclosed thread group"

https://github.com/ruby/timeout/commit/eb889d2c8b
2023-02-15 19:25:05 +00:00
dependabot[bot] e5e506095c [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.61 to 0.9.64.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.61...v0.9.64)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-14 13:59:32 +00:00
Nobuyoshi Nakada 45f0e3a673
[Bug #19259] `Data#with` should call `initialize` method 2023-02-14 12:02:07 +09:00
tomoya ishida f313514563 [ruby/irb] Fix colorize backtick symbol
(https://github.com/ruby/irb/pull/508)

https://github.com/ruby/irb/commit/dd7f25cd45

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-02-12 20:27:32 +00:00
Koichi Sasada be94808282 use correct svar even if env is escaped
This patch is follo-up of 0a82bfe.
Without this patch, if env is escaped (Proc'ed), strange svar
can be touched.

This patch tracks escaped env and use it.
2023-02-10 17:55:25 +09:00
Satadru Pramanik, DO, MPH, MEng 94aed6ece5 [ruby/fileutils] Add mkdir_p to FileUtils.install
(https://github.com/ruby/fileutils/pull/104)

* Add mkdir_p to FileUtils.install

* Adjust raise message.

* adjust raise language

* handle trailing slash in dest

* simplify

* Add tests
2023-02-10 03:37:39 +00:00
Mike Perham 194520f80e [ruby/logger] Add Logger#with_level{...} for block-scoped log level.
(https://github.com/ruby/logger/pull/85)

* Update lib/logger/severity.rb

https://github.com/ruby/logger/commit/7aabb0b4aa
2023-02-10 01:08:49 +00:00
eileencodes b9e6580135 Copy cvar table on clone
When a class with a class variable is cloned we need to also copy the
cvar cache table from the original table to the clone. I found this bug
while working on fixing [Bug #19379]. While this does not fix that bug
directly it is still a required change to fix another bug revealed by
the fix in https://github.com/ruby/ruby/pull/7265

This needs to be backported to 3.2.x and 3.1.x.

Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2023-02-09 11:24:32 -08:00
Stan Lo 970e7cdec3 [ruby/irb] Make tests more compatible with TruffleRuby
(https://github.com/ruby/irb/pull/514)

* Improve encoding error test case

The test input IRB currently uses happen to hit a compatibility bug in
TruffleRuby, which has been documented in
https://github.com/oracle/truffleruby/issues/2848

Although it'll eventually be fixed, we can make the test case support TruffleRuby
now by tweaking it just a little bit.

Co-authored-by: Kevin Menard <kevin@nirvdrum.com>

* Remove redundant TruffleRuby omits/pends

Co-authored-by: Kevin Menard <kevin@nirvdrum.com>

* Use a different way to test warning emission

The test case was added in d08ef68d2d
to verify that IRB emits Ruby warning as expected.

But the subject it uses relies on CRuby's regexp engine, which isn't always
used in other language implementations, like TruffleRuby. That's why we
ended up skipping TruffleRuby in this test case.

Since the test isn't about regexp itself, we can change the testing subject
and just remove the special condition for TruffleRuby.

Co-authored-by: Kevin Menard <kevin@nirvdrum.com>

---------

https://github.com/ruby/irb/commit/6fdf4f3e97

Co-authored-by: Kevin Menard <kevin@nirvdrum.com>
2023-02-09 15:33:37 +00:00
Nobuyoshi Nakada da4464b824
[Bug #19426] Fix endless `Range#step` with `#succ` method 2023-02-09 20:37:34 +09:00
Jean byroot Boussier 8ce2fb9bbb Only emit circular dependency warning for owned thread shields
[Bug #19415]

If multiple threads attemps to load the same file concurrently
it's not a circular dependency issue.

So we check that the existing ThreadShield is owner by the current
fiber before warning about circular dependencies.
2023-02-08 09:50:00 +01:00
Jean Boussier 3ab3455145 Add RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS to pre-init pools granularly
The old RUBY_GC_HEAP_INIT_SLOTS isn't really usable anymore as
it initalize all the pools by the same factor, but it's unlikely
that pools will need similar sizes.

In production our 40B pool is 5 to 6 times bigger than our 80B pool.
2023-02-08 09:26:07 +01:00
Jean Boussier 1e71143976 Use more agressive RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR for GC tests 2023-02-07 22:33:12 +01:00
dependabot[bot] c84184d50b [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.58 to 0.9.61.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.58...v0.9.61)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 23:38:12 +00:00
zzak 773d56b1c1 [ruby/rdoc] Add test coverage for -C flag
https://github.com/ruby/rdoc/commit/564be08f4b
2023-02-06 23:09:06 +00:00
Jean byroot Boussier c19defd026 Revert "Only emit circular dependency warning for owned thread shields"
This reverts commit fa49651e05.
2023-02-06 23:30:35 +01:00
Jean Boussier fa49651e05 Only emit circular dependency warning for owned thread shields
[Bug #19415]

If multiple threads attemps to load the same file concurrently
it's not a circular dependency issue.

So we check that the existing ThreadShield is owner by the current
fiber before warning about circular dependencies.
2023-02-06 19:35:38 +01:00
Jemma Issroff 28da990984 Limit maximum number of IVs on a shape on T_OBJECTS
Create SHAPE_MAX_NUM_IVS (currently 50) and limit all shapes of
T_OBJECTS to that number of IVs. When a shape with a T_OBJECT has more than 50 IVs, fall back to the
obj_too_complex shape which uses hash lookup for ivs.

Note that a previous version of this commit
78fcc9847a was reverted in
88f2b94065 because it did not account for
non-T_OBJECTS
2023-02-06 08:40:51 -08:00
tompng 91f353b1c3 [ruby/reline] Fix line rendering when newline is added at the end of the buffer
https://github.com/ruby/reline/commit/7d61b3df9a
2023-02-06 14:23:59 +00:00
Sorah Fukumori 8a29419b7f [ruby/reline] test_dumb_terminal: "ruby" command is not always available
Fixes the same issue at https://github.com/ruby/ruby/pull/5417

`ruby` is not always available in certain build environments and
configure options (e.g. --program-suffix)

This patch tries to choose an appropriate command line for spawning a
fresh Ruby process, based on EnvUtil implementation in ruby/ruby's test
suite.

Plus when this library is directly mirrored into ruby/ruby, prefer EnvUtil
available there over the implementation in this library's test suite.

https://github.com/ruby/reline/commit/278327d2e9
2023-02-05 20:31:37 +00:00
Stan Lo 295fc59eda [ruby/irb] Add tests for workspaces commands
(https://github.com/ruby/irb/pull/512)

https://github.com/ruby/irb/commit/874dbcad81
2023-02-04 22:31:17 +00:00
Nobuyoshi Nakada 0a02c51a06 [rubygems/rubygems] Ensure that `TempIO` is closed
https://github.com/rubygems/rubygems/commit/0cbb7b5370
2023-02-04 19:38:55 +00:00
Nobuyoshi Nakada e37bf46ed5 [rubygems/rubygems] Fix Tempfile leaks
https://github.com/rubygems/rubygems/commit/f95d1a87ce
2023-02-04 19:38:55 +00:00
zzak e04d20bc48 [ruby/rdoc] Add rdoc:coverage default task
https://github.com/ruby/rdoc/commit/157fbaf575
2023-02-03 23:41:06 +00:00
Martin Emde 0853703ec6 [rubygems/rubygems] Test to show non-standard behavior of zero byte files in archive
Added more tests for some of the other behavior as well.
Tests were missing for readpartial with a buffer, and reading
remaining bytes after a partial read, using StringIO as reference.

https://github.com/rubygems/rubygems/commit/d600a657b1
2023-02-02 17:17:33 +00:00
Takashi Kokubun 1c5bd01363
Add a test for svar #7225 (#7228) 2023-02-01 21:47:45 -08:00
Nobuyoshi Nakada fad48fefe1 [Bug #19399] Parsing invalid heredoc inside block parameter
Although this is of course invalid as Ruby code, allow to just parse
and tokenize.
2023-02-02 12:20:10 +09:00
Peter Zhu c6f84e9189 [Bug #19398] Memory leak in WeakMap
There's a memory leak in ObjectSpace::WeakMap due to not freeing
the `struct weakmap`. It can be seen in the following script:

```
100.times do
  10000.times do
    ObjectSpace::WeakMap.new
  end

  # Output the Resident Set Size (memory usage, in KB) of the current Ruby process
  puts `ps -o rss= -p #{$$}`
end
```
2023-02-01 13:23:55 -05:00
Hiroshi SHIBATA 375f527ded [rubygems/rubygems] Introduce to specify deprecated version for rubygems_deprecate_command.
We sometimes to remove minor command without bumping major version. This feature
  helps this deprecation process.

https://github.com/rubygems/rubygems/commit/41301cd2a8
2023-02-01 16:44:55 +00:00
Takashi Kokubun e11067ebbf
YJIT: Fix BorrowMutError on BOP invalidation (#7212) 2023-01-31 15:26:56 -05:00
Charles Oliver Nutter 29133794a3
[ruby/psych] Update for stricter 1.2 syntax
This allows these tests to pass on SnakeYAML Engine -- which is a
1.2-only YAML library -- while still passing on libyaml 1.1.

https://github.com/ruby/psych/commit/f44269fc9b
2023-01-31 13:14:05 +09:00
David Rodríguez 022acb9593 [rubygems/rubygems] Don't load Bundler from RubyGems tests
https://github.com/rubygems/rubygems/commit/c2e4cb7b5e
2023-01-31 10:49:08 +09:00
Nobuyoshi Nakada 3a7367ccc3 mkconfig: Map `includedir` only for system ruby
Only when installing to the system path on macOS, prepend '$(SDKROOT)'
and remap `includedir`.
Fix https://github.com/rbenv/ruby-build/discussions/2123
2023-01-31 06:33:16 +09:00
Takashi Kokubun 2e0f3b5546
YJIT: Fix BorrowMutError on GC.compact (#7176)
YJIT: Fix BorrowMutError
2023-01-30 11:16:33 -08:00
Mat Sadler b4defea362 [rubygems/rubygems] install rust extensions into expected directory nesting
https://github.com/rubygems/rubygems/commit/85ea86d348
2023-01-30 17:39:47 +00:00
Mat Sadler ca951f6719 [rubygems/rubygems] use cargo to get crate name
the final copying of the extension into place has been slimmed
down, reflecting that it only needs to copy a single file, rather
than replicating the more involved process used for a C ext

this also refactors #build so that #cargo_crate_name only needs
to be called once, and hopefully the build flow is easier to
understand

https://github.com/rubygems/rubygems/commit/5a0d7f2e6c
2023-01-30 17:39:47 +00:00
Mat Sadler 0c2b43462f [rubygems/rubygems] remove unused files in cargo builder test fixtures
https://github.com/rubygems/rubygems/commit/233847513b
2023-01-30 17:39:46 +00:00
Jeremy Evans eccfc978fd Fix parsing of regexps that toggle extended mode on/off inside regexp
This was broken in ec3542229b. That commit
didn't handle cases where extended mode was turned on/off inside the
regexp.  There are two ways to turn extended mode on/off:

```
/(?-x:#y)#z
/x =~ '#y'

/(?-x)#y(?x)#z
/x =~ '#y'
```

These can be nested inside the same regexp:

```
/(?-x:(?x)#x
(?-x)#y)#z
/x =~ '#y'
```

As you can probably imagine, this makes handling these regexps
somewhat complex. Due to the nesting inside portions of regexps,
the unassign_nonascii function needs to be recursive.  In
recursive mode, it needs to track both opening and closing
parentheses, similar to how it already tracked opening and
closing brackets for character classes.

When scanning the regexp and coming to `(?` not followed by `#`,
scan for options, and use `x` and `i` to determine whether to
turn on or off extended mode.  For `:`, indicting only the
current regexp section should have the extended mode
switched, recurse with the extended mode set or unset. For `)`,
indicating the remainder of the regexp (or current regexp portion
if already recursing) should turn extended mode on or off, just
change the extended mode flag and keep scanning.

While testing this, I noticed that `a`, `d`, and `u` are accepted
as options, in addition to `i`, `m`, and `x`, but I can't see
where those options are documented.  I'm not sure whether or not
handling  `a`, `d`, and `u` as options is a bug.

Fixes [Bug #19379]
2023-01-30 08:51:12 -08:00
Jean Boussier 3f54d09a5b bignum.c: rb_int_parse_cstr handle `0` strings
[Bug #19390]

We shouldn't check the string length when skipping zeros, as the
string might only contains zero characters, resulting in an empty string.
2023-01-30 14:42:40 +01:00
Hiroshi SHIBATA b432867429
Skip OpenSSL::TestHMAC#test_dup when running with RHEL9 2023-01-30 16:55:14 +09:00
Nobuyoshi Nakada 21dced8b01 [ruby/stringio] [Bug #19389] Fix chomping with longer separator
https://github.com/ruby/stringio/commit/eb322a9716
2023-01-28 13:00:08 +00:00
Benoit Daloze 47b66a5acd [ruby/bigdecimal] Add truffleruby in CI
https://github.com/ruby/bigdecimal/commit/5a25e26e08
2023-01-27 11:07:06 +00:00
Hiroshi SHIBATA 967dec5d61
[ruby/openssl] Added CoreAssertions
https://github.com/ruby/openssl/commit/520601e11d

  This commits swtich to use ruby/ruby's envutil.rb instead of
  vendored in openssl repo.
2023-01-27 11:30:13 +09:00
Andrew Konchin 5afc830130
[ruby/openssl] Do not require test file in a forked process in tests
https://github.com/ruby/openssl/commit/ae784673d7
2023-01-27 11:30:13 +09:00
Samuel Giddins 70829928cb [rubygems/rubygems] Deprecate Gem::List
It is unused, we will remove it in the next major version

https://github.com/rubygems/rubygems/commit/c3f6c27d6d
2023-01-26 21:41:48 +00:00
Nobuyoshi Nakada 5a73e131d7 Add tests for variables in `END` block shared with the toplevel 2023-01-24 16:36:33 +09:00
dependabot[bot] 98081ac7cc [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.56 to 0.9.58.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.56...v0.9.58)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-24 01:35:42 +00:00
dependabot[bot] e23e8f4a6b [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.56 to 0.9.58.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.56...v0.9.58)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-23 22:14:19 +00:00
Jean Boussier 8fded5f5d1 [ruby/psych] Fix RestrictedYAMLTree allowing the Symbol class should allow all symbols
Ref: https://github.com/ruby/psych/pull/495

That's how it works for `safe_load`:
```ruby
>> YAML.safe_load(':foo', permitted_classes: [Symbol])
=> :foo
```

So `safe_dump` should mirror that.

https://github.com/ruby/psych/commit/592a75a656
2023-01-23 02:07:23 +00:00
Kouhei Yanagita 20a85ab611
Fix Integer#ceildiv to respect #coerce (#7118)
Fixes [Bug #19343]
2023-01-22 18:53:02 +09:00
Samuel Williams f5ea43a2e6
More coverage tests & specs. (#7171)
* Add spec for eval and line coverage.

* Add test for main file coverage.
2023-01-22 13:49:13 +13:00
tompng 76e3d853ab [ruby/reline] Add autoindent test for indent after bracket and newline
https://github.com/ruby/reline/commit/3f3da7d0e2
2023-01-20 13:40:16 +00:00
Nobuyoshi Nakada 53cd5796c5 [rubygems/rubygems] Clean test output
The output from the command is mixed in this test, even when
successful.
Use the output as a part of the message on failure instead.

https://github.com/rubygems/rubygems/commit/960509a133
2023-01-20 10:39:57 +00:00
Shugo Maeda cce3960964 [Feature #19314] Add new arguments of String#bytesplice
bytesplice(index, length, str, str_index, str_length) -> string
  bytesplice(range, str, str_range) -> string

In these forms, the content of +self+ is replaced by str.byteslice(str_index, str_length) or str.byteslice(str_range); however the substring of +str+ is not allocated as a new string.
2023-01-20 18:02:37 +09:00
Peter Zhu 0949cd7107 [ci skip] Add ticket label to test 2023-01-19 16:26:32 -05:00
lukeg f66804e6f7 don't allow setting class variable on module that's frozen [Bug #19341] 2023-01-19 16:25:20 -05:00
Shugo Maeda f7b72462aa
String#bytesplice should return self
In Feature #19314, we concluded that the return value of String#bytesplice
should be changed from the source string to the receiver, because the source
string is useless and confusing when extra arguments are added.

This change should be included in Ruby 3.2.1.
2023-01-19 17:13:07 +09:00
Samuel Williams edd00697a8
Test some missing coverage too. (#7041) 2023-01-19 11:59:51 +13:00
tompng 976d72a9f5 [ruby/reline] Add scrollbar scroll-to-bottom test and fix existing scrollbar rendeing test
https://github.com/ruby/reline/commit/268e02b155
2023-01-18 14:49:28 +00:00
tomoya ishida 2d7e639549 [ruby/reline] multiline_repl do not need to depend on RubyLex
(https://github.com/ruby/reline/pull/502)

* multiline_repl do not need to depend on RubyLex

* Add auto indent test
2023-01-18 05:28:18 +00:00
Kaíque Kandy Koga 46066d0b96
Change ArgumentError message when Comparable#clamp receives min value higher than max value 2023-01-17 21:25:11 -08:00
dependabot[bot] 9399352a43 [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.54 to 0.9.56.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.54...v0.9.56)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-17 09:57:05 +00:00
Peter Zhu ed6fbb79e1 Fix crash when defining ivars on special constants
[Bug #19339]
2023-01-17 04:51:15 -05:00
dependabot[bot] d7af0f6082 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.54 to 0.9.56.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.54...v0.9.56)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-17 07:19:03 +00:00
Nobuyoshi Nakada 71ce7e1825
[Bug #19335] `Integer#remainder` should respect `#coerce` (#7120)
Also `Numeric#remainder` should.
2023-01-15 13:03:27 +09:00
HASUMI Hitoshi 5b26f76ad9 [ruby/reline] Correspond to refactored RubyLex
(https://github.com/ruby/reline/pull/498)

* Correspond to refactored RubyLex

ref: https://github.com/ruby/irb/pull/503

* Fix test_yamatanooroti
2023-01-14 09:19:41 +00:00
Stan Lo cb9b885e78 [ruby/irb] Store context in RubyLex
Some background for this refactor:

1. Through a RubyLex instance's lifetime, the context passed to its methods
   should be the same.
   Given that `Context` is only initialised in `Irb#initialize`,
   this should be true.

2. When `RubyLex` is initialised, the context object should be accessible.
   This is also true in all 3 of `RubyLex.new`'s invocations.

With the above observations, we should be able to store the context in `RubyLex`
as an instance variable. And doing so will make `RubyLex`'s instance methods
easier to use and maintain.

https://github.com/ruby/irb/commit/5c8d3df2df
2023-01-14 09:19:09 +00:00
Matt Valentine-House bb5fddd070 Remove MIN_PRE_ALLOC_SIZE from Strings.
This optimisation is no longer helpful now that we use VWA to allocate
strings in larger size pools where they can be embedded.
2023-01-13 10:31:35 -05:00
Yusuke Endoh 94d6d6d93f [ruby/error_highlight] Identify which node in `Foo::Bar::Baz` causes a NameError
In Ruby 3.2 or later, a nested constant access like `Foo::Bar::Baz` is
compiled to one instruction by the optimization https://github.com/ruby/ruby/pull/6187

We try to spot which sub-node caues a NameError in question based on the
constant name. We will give up if the same constant name is accessed in
a nested access (`Foo::Foo`).

Fixes https://github.com/ruby/error_highlight/pull/31

https://github.com/ruby/error_highlight/commit/0a4db7da0a
2023-01-13 08:25:09 +00:00
Nobuyoshi Nakada 5b36fefc4e
Skip time-related assertions on /dev/null 2023-01-13 12:26:16 +09:00
Koichi Sasada 2e7bceb34e Do not use VM stack for splat arg on cfunc
On the cfunc methods, if a splat argument is given, all array elements
are expanded on the VM stack and it can cause SystemStackError.
The idea to avoid it is making a hidden array to contain all parameters
and use this array as an argv.

This patch is reviesed version of https://github.com/ruby/ruby/pull/6816
The main change is all changes are closed around calling cfunc logic.

Fixes [Bug #4040]

Co-authored-by: Jeremy Evans <code@jeremyevans.net>
2023-01-13 09:30:29 +09:00
Stan Lo 207f8d0027 [ruby/irb] Avoid calling private methods on the main object
(https://github.com/ruby/irb/pull/498)

When the main object is frozen, `IRB` wraps a `SimpleDelegator` around it.
But because `SimpleDelegator` doesn't delegate private methods, methods like
`require_relative` or `const_get` would cause error, which are needed for
lazily loading commands.

This commit works around this limitation by avoiding those private method calls
when setting up command execution.
2023-01-12 11:49:16 +00:00
Jean Boussier a8537eae2a [ruby/mutex_m] Avoid anonymous eval
It makes it hard to locate code when profiling etc.

https://github.com/ruby/mutex_m/commit/8760ab19ec
2023-01-12 05:41:59 +00:00
tomoya ishida 0abb4b6348 [ruby/reline] Pass unmodifined lines(that does not include escape
sequence) to check_multiline_prompt
(https://github.com/ruby/reline/pull/458)

* pass unmodified lines to check_multiline_prompt

* Add test to check that output modified by output_modifier_proc is not passed to prompt_proc
2023-01-12 00:14:53 +00:00
Jean Boussier bcdc058e50 [ruby/racc] Get rid of anonymous eval calls
Things declared in anonymous eval are always annoying to locate.
(profilers, etc)

https://github.com/ruby/racc/commit/f304205256
2023-01-12 07:52:29 +09:00
Masataka Pocke Kuwabara 11e15b4d48 [ruby/racc] Make racc Ractor compatible
https://github.com/ruby/racc/commit/1948de9d1d
2023-01-12 07:52:25 +09:00
Stan Lo c693dfd7ef [ruby/irb] Drop unused arguments in `RubyLex`
(https://github.com/ruby/irb/pull/504)

* Simplify `RubyLex#set_prompt`

It's optional argument is never used by any caller.

* Remove the optional `p` argument from `RubyLex#set_input`

The argument is only used in a test case, which can be easily replaced by
a block argument.
2023-01-11 21:26:18 +00:00
Benoit Daloze 6abe20e87b Remove Encoding#replicate 2023-01-11 13:41:41 +01:00
Phillip Hellewell d831b1d5ce [ruby/reline] Reset IOGate in test_reset
https://github.com/ruby/reline/commit/331c1094ef
2023-01-11 11:38:51 +00:00
Phillip Hellewell 4222083cbd [ruby/reline] Change IOGate back to GeneralIO
Staying with ANSI can cause side effects with other tests.

https://github.com/ruby/reline/commit/ba36067802
2023-01-11 11:38:50 +00:00
Jean Boussier 3161fd4372 [ruby/psych] Get rid of anonymous eval calls
Things declared in anonymous eval are always annoying to locate.

https://github.com/ruby/psych/commit/38871ad4e5
2023-01-11 10:08:13 +00:00
Koichi Sasada 8c2b6926d2 Skip unfixed assertion about objspace/dump_all
```
{"address":"0x7f8c03e9fcf0", "type":"STRING", "shape_id":10, "slot_size":40, "class":"0x7f8c00dbed98", "frozen":true, "embedded":true, "fstring":true, "bytesize":5, "value":"TEST2", "encoding":"US-ASCII", "coderange":"7bit", "memsize":40, "flags":{"wb_protected":true}}
{"address":"0x7f8c03e9ffc0", "type":"STRING", "shape_id":0, "slot_size":40, "class":"0x7f8c00dbed98", "embedded":true, "bytesize":5, "value":"TEST2", "encoding":"US-ASCII", "coderange":"7bit", "memsize":40, "flags":{"wb_protected":true}}
{"address":"0x7f8c03e487c0", "type":"STRING", "shape_id":0, "slot_size":40, "class":"0x7f8c00dbed98", "embedded":true, "bytesize":5, "value":"TEST2", "encoding":"UTF-8", "coderange":"unknown", "file":"-", "line":4, "method":"dump_my_heap_please", "generation":1, "memsize":40, "flags":{"wb_protected":true}}
  1) Failure:
TestObjSpace#test_dump_all [/tmp/ruby/src/trunk-gc-asserts/test/objspace/test_objspace.rb:622]:
number of strings.
<2> expected but was
<3>.
```

This failure only occurred on a ruby built with `DEFS=\"-DRGENGC_CHECK_MODE=2\""`
and only on a specific machine (Docker container) and difficult to reproduce,
so skip this failure to check other failures.
2023-01-11 18:09:48 +09:00
Alan Wu aeddc19340
YJIT: Save PC and SP before calling leaf builtins (#7090)
Previously, we did not update `cfp->sp` before calling the C function of
ISEQs marked with `Primitive.attr! "inline"` (leaf builtins). This
caused the GC to miss temporary values on the stack in case the function
allocates and triggers a GC run. Right now, there is only a few leaf
builtins in numeric.rb on Integer methods such as `Integer#~`. Since
these methods only allocate when operating on big numbers, we missed
this issue.

Fix by saving PC and SP before calling the functions -- our usual
protocol for calling C functions that may allocate on the GC heap.

[Bug #19316]
2023-01-10 11:11:10 -05:00
Phillip Hellewell 97f8f2c470 [ruby/reline] Add key binding for Delete
https://github.com/ruby/reline/commit/603eacee22
2023-01-10 12:18:14 +00:00
Hiroshi SHIBATA a43f1d90c2 Merge RubyGems and Bundler master
from 0635c1423d
2023-01-10 15:53:07 +09:00
dependabot[bot] 97d52a8ea2 [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.53 to 0.9.54.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.53...v0.9.54)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-10 02:20:54 +00:00
dependabot[bot] 93b2de8278 [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.53 to 0.9.54.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.53...v0.9.54)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-09 18:43:03 +00:00
Peter Zhu 2ad081f799 Assert that resizing arrays will re-embed them 2023-01-09 08:49:29 -05:00
Peter Zhu 682b45d489 Assert that resizing objects will re-embed them 2023-01-09 08:49:29 -05:00
Peter Zhu 3be2acfafd Fix re-embedding of strings during compaction
The reference updating code for strings is not re-embedding strings
because the code is incorrectly wrapped inside of a
`if (STR_SHARED_P(obj))` clause. Shared strings can't be re-embedded
so this ends up being a no-op. This means that strings can be moved to a
large size pool during compaction, but won't be re-embedded, which would
waste the space.
2023-01-09 08:49:29 -05:00
Nobuyoshi Nakada 9d078fe477 [ruby/zlib] Fix the test broken in older versions
https://github.com/ruby/zlib/commit/fc89ff9ef0
2023-01-09 09:58:43 +00:00
Nobuyoshi Nakada 1cdf8ab07b
[Bug #19323] Raise `RangeError` instead of integer overflow 2023-01-08 20:54:48 +09:00
Nobuyoshi Nakada cee5beab1d [Bug #19312] Return end-of-input at `__END__` 2023-01-06 13:13:07 +01:00
yui-knk 979dd02e2f Check if the argument is Thread::Backtrace::Location object
[Bug #19262]
2023-01-06 09:22:09 +09:00
Peter Zhu 2056c0a7c6 Add embedded status to dumps of T_OBJECT
This commit adds `"embedded":true` in ObjectSpace.dump for T_OBJECTs
that are embedded.
2023-01-05 16:00:36 -05:00
Benoit Daloze 03dd37775a Raise an ArgumentError for unknown pack/unpack directive
* [Bug #19150]
2023-01-05 19:05:03 +01:00
Stan Lo f9148d1580 [ruby/irb] Group command test cases with class
(https://github.com/ruby/irb/pull/491)

Currently, IRB has 35 test cases for 10 non-debugging commands, with the
rest 10 commands untested. So in the long-term, it could have around 70
test cases for all existing commands.

With this number of test cases, I think it's easier to manage them by grouping
them in classes (by command).
2023-01-05 13:06:23 +00:00
Peter Zhu 837ef8911c Fix crash in TracePoint c_call for removed method
trace_arg->id is the ID of the original method of an aliased method. If
the original method is removed, then the lookup will fail. We should use
trace_arg->called_id instead, which is the ID of the aliased method.

Fixes [Bug #19305]
2023-01-04 14:59:40 -05:00
Alan Wu 43ff0c2c48 YJIT: Fix `yield` into block with >=30 locals on ARM
It's a register spill issue. Fix by moving the Qnil fill snippet to
after registers are released.

[Bug #19299]
2023-01-03 16:17:50 -05:00
Matt Valentine-House 0dc989d031 Fix Error in GC Compaction specs
Previously if any of the tests that move objects between size pools
failed to move anything, then the call to stats.dig would return `nil`
which would then cause assert_operator to error.

This should be a test Failure, rather than an Error so this commit uses
a default value of 0 if stats.dig fails to find a key.

Also refactor object movement tests to use stats.dig, rather than :[]
2023-01-03 08:47:48 -05:00
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

https://github.com/ruby/irb/commit/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
https://github.com/rubygems/rubygems/commit/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)

https://github.com/ruby/irb/commit/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
https://github.com/ruby/irb/commit/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.

https://github.com/ruby/irb/commit/b3203bc784
2022-12-26 13:04:04 -08:00
Stan Lo 148eb05ec1 [ruby/irb] Remove unnecessary test setup
https://github.com/ruby/irb/commit/cc6e6d26b6
2022-12-26 13:04:03 -08:00
st0012 8038bf239a [ruby/irb] Add test for the help command
https://github.com/ruby/irb/commit/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
https://github.com/rubygems/rubygems/commit/fac241d4ef
2022-12-26 19:08:55 +00:00
Gustavo Ribeiro 08f6196bda [rubygems/rubygems] add global flag (-C) to change execution directory
https://github.com/rubygems/rubygems/commit/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
https://github.com/ruby/irb/commit/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 https://github.com/ruby/openssl/commit/f2e2a5e5ed8e ("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.

https://github.com/ruby/openssl/commit/ccc1594492
2022-12-26 15:09:21 +09:00
Junichi Ito cea6951ecf [ruby/optparse] Add symbolize_names to getopts
https://github.com/ruby/optparse/commit/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.

https://github.com/ruby/rdoc/commit/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
https://github.com/ruby/rdoc/commit/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

https://github.com/ruby/openssl/commit/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().]

https://github.com/ruby/openssl/commit/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
https://github.com/ruby/openssl/commit/a3d230d4e0
2022-12-23 09:39:15 +09:00