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

77911 Коммитов

Автор SHA1 Сообщение Дата
Samuel Williams b7ee51e81d
Expose `enum rb_io_event` flags without `_t` suffix. (#7887) 2023-06-01 22:54:08 +09:00
Samuel Williams 47a8de6095
Drop `_t` suffix from struct names. (#7886)
POSIX reserves `_t` suffix in types.
2023-06-01 21:46:10 +09:00
Nobuyoshi Nakada a5e1d549b5 [DOC] Mention the edge case of `any?`/`all?` 2023-06-01 21:44:53 +09:00
Peter Zhu a16cffe384 Simplify duplicated code
The capacity of the string can be calculated using the str_capacity
function.
2023-06-01 08:32:29 -04:00
Peter Zhu 8a8618d4f3 Don't refetch ptr and len
The call to RSTRING_GETMEM already fetched the pointer and length, so we
don't need to fetch it again.
2023-06-01 08:32:29 -04:00
Samuel Williams d5a5333168 [ruby/stringio] Avoid direct struct usage.
(https://github.com/ruby/stringio/pull/54)

We will eventually want to refactor this, but for now this is compatible
enough.
2023-06-01 11:41:19 +00:00
Benoit Daloze 957b6a491f rb_io_descriptor() is available since 3.1 2023-06-01 11:41:41 +02:00
Samuel Williams 64ec1813ac
Restores the changes in `io-console` without breaking backwards compatibility. (#7882)
This reverts commit 35da41b29b.

This updates `io-console` to avoid accessing the internal details of `rb_io_t`
and instead use `rb_io_descriptor` and `rb_io_path` etc.
2023-06-01 17:43:45 +09:00
KJ Tsanaktsidis edee9b6a12
Use a real Ruby mutex in rb_io_close_wait_list (#7884)
Because a thread calling IO#close now blocks in a native condvar wait,
it's possible for there to be _no_ threads left to actually handle
incoming signals/ubf calls/etc.

This manifested as failing tests on Solaris 10 (SPARC), because:

* One thread called IO#close, which sent a SIGVTALRM to the other
  thread to interrupt it, and then waited on the condvar to be notified
  that the reading thread was done.
* One thread was calling IO#read, but it hadn't yet reached the actual
  call to select(2) when the SIGVTALRM arrived, so it never unblocked
  itself.

This results in a deadlock.

The fix is to use a real Ruby mutex for the close lock; that way, the
closing thread goes into sigwait-sleep and can keep trying to interrupt
the select(2) thread.

See the discussion in: https://github.com/ruby/ruby/pull/7865/
2023-06-01 17:37:18 +09:00
Hiroshi SHIBATA d8f333491e [ruby/syntax_suggest] Use hard-coded filename for executables.
It's hard to handle between ruby/syntax_suggest and ruby/ruby at gemspec.

https://github.com/ruby/syntax_suggest/commit/0ee7496668
2023-06-01 14:46:52 +09:00
Samuel Williams a218ed5692
Hide the usage of `rb_io_t` where possible. (#7880)
This retries the compatible parts of the previously reverted PR so we can continue to update related code without breaking backwards compatibility.
2023-06-01 14:23:30 +09:00
Hiroshi SHIBATA 35da41b29b
Revert https://github.com/ruby/io-console/pull/43
This reverts commit 1889133c04 and
  commit 764207e47c.

  Followed up with 85dcc4866d
2023-06-01 09:36:55 +09:00
NARUSE, Yui 85dcc4866d Revert "Hide most of the implementation of `struct rb_io`. (#6511)"
This reverts commit 18e55fc1e1.

fix [Bug #19704]
https://bugs.ruby-lang.org/issues/19704
This breaks compatibility for extension libraries. Such changes
need a discussion.
2023-06-01 08:43:22 +09:00
Peter Zhu e4163112f6 More debug code to GC compaction test 2023-05-31 16:16:50 -04:00
Peter Zhu e8212c55f9 Fix flaky test in test_objspace.rb
Ensure that the frozen string is promoted to the old generation by
running the GC 4 times.
2023-05-31 14:03:30 -04:00
Benoit Daloze 55c9c658bd ruby/spec no longer supports 2.7 since it is EOL 2023-05-31 18:11:18 +02:00
Peter Zhu 1ac17693de Add debug code to GC compaction test
This test is flaky on some CI systems.
2023-05-31 09:22:52 -04:00
Nobuyoshi Nakada e502600fb9
Assertion on message length for the `-h` option 2023-05-31 15:15:59 +09:00
Hiroshi SHIBATA 3bc5f6b240
[rubygems/rubygems] tool_dir needs to handle ruby/ruby repo now
https://github.com/rubygems/rubygems/commit/550d90f4ba
2023-05-31 13:55:30 +09:00
Takashi Kokubun 1f74e25c3b
YJIT: Force showing a backtrace on panic (#7869) 2023-05-30 11:20:02 -04:00
Hiroshi SHIBATA 4bbeed6134 Merge RubyGems/Bundler master from 4076391fce5847689bf2ec402b17133fe4e32285 2023-05-30 21:50:07 +09:00
Benoit Daloze 30b960ba34 [ruby/io-nonblock] Add TruffleRuby support and add it in CI
* Do not use a C extension on TruffleRuby for these 3 methods.

https://github.com/ruby/io-nonblock/commit/1b8e52abfa
2023-05-30 12:39:26 +00:00
Benoit Daloze c7c8e4c96e [ruby/io-nonblock] Use the correct pattern for the fallback of rb_io_descriptor()
* See d1d9aef45c

https://github.com/ruby/io-nonblock/commit/dadb42422b
2023-05-30 12:39:25 +00:00
Jeremy Evans ec9364e500 [ruby/racc] Remove ErrorSymbolValue reference
I cannot find where this is defined.  I'm guessing neither this
nor the else branch is ever hit.  I only found out when testing
VM changes, which had a bug that exposed this.

https://github.com/ruby/racc/commit/8983d0c134
2023-05-30 01:43:48 +00:00
Samuel Williams 18e55fc1e1
Hide most of the implementation of `struct rb_io`. (#6511)
* Add rb_io_path and rb_io_open_descriptor.

* Use rb_io_open_descriptor to create PTY objects

* Rename FMODE_PREP -> FMODE_EXTERNAL and expose it

FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but
FMODE_EXTERNAL is clearer about what the file descriptor represents and
aligns with language in the IO::Buffer module.

* Ensure that rb_io_open_descriptor closes the FD if it fails

If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be
responsible for closing your file, eventually, if you pass it to
rb_io_open_descriptor, even if it raises an exception.

* Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P

* Expose `rb_io_closed_p`.

* Add `rb_io_mode` to get IO mode.

---------

Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>
2023-05-30 10:02:40 +09:00
dependabot[bot] 7ddcd0622f [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.77 to 0.9.78.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.77...v0.9.78)

---
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-05-29 21:24:22 +00:00
Benoit Daloze f61bd3ca80 [ruby/cgi] Add TruffleRuby support and add it in CI
https://github.com/ruby/cgi/commit/1240fec9c9
2023-05-29 19:33:38 +00:00
Benoit Daloze 610038f3bf [ruby/etc] Use the correct pattern for the fallback of rb_io_descriptor()
* See d1d9aef45c

https://github.com/ruby/etc/commit/5185685003
2023-05-29 19:31:55 +00:00
Benoit Daloze 99ce41564e Refactor guards for Time.new spec 2023-05-29 18:33:51 +02:00
Peter Zhu b7a26dfa16 Unify error messages of rb_num2ulong and rb_num2ull
The error messages were slightly different due, which causes different
behaviour on 32-bit and 64-bit systems.
2023-05-29 11:55:39 -04:00
Benoit Daloze c48d496e8c Update to ruby/spec@c3677cf 2023-05-29 15:27:57 +02:00
Samuel Williams 98f500d095
[ruby/openssl] Remove usage of IO internals. 2023-05-29 22:01:58 +09:00
Samuel Williams 764207e47c [ruby/io-console] Remove trailing whitespace.
https://github.com/ruby/io-console/commit/55f1586463
2023-05-29 12:37:49 +00:00
Samuel Williams 1889133c04 [ruby/io-console] Remove usage of IO internals.
(https://github.com/ruby/io-console/pull/43)

https://github.com/ruby/io-console/commit/4b839a504f

Co-authored-by: Benoit Daloze <eregontp@gmail.com>
2023-05-29 12:30:32 +00:00
Jun Aruga 57459b83a9
mkmf: Add the extra option `--with-verbose` to enable verbose mode. (#7863)
This commit is to add an extra option to enable verbose mode (V=1) in the
generated `Makefile` at runtime of the Ruby to print compiler command lines by
the commands below when building native extensions. It's possible to enable the
verbose mode by setting the environment variable `MAKEFLAGS="V=1"`[1]
implemented in GNU make. However, I wanted to make a consistent user-interface
not depending on the specific make's implementation.

```
$ ruby /path/to/extconf.rb -- --with-verbose
```

You can also add the extra option via rake-compiler gem.

```
$ rake compiler -- --with-verbose
```

If the extra option is not given, the value of the
`RbConfig::CONFIG["MKMF_VERBOSE"]` enabled by the configure option below is
used.

```
$ ./configure --enable-mkmf-verbose
```

For the unit tests, updated the following files.

* The `test/mkmf/test_configuration.rb` was created to test the cases with the
  `configuration` method and this implementation.
* Updated the `TestMkmf#assert_separately` to set the extra
  arguments in `test/mkmf/base.rb`. Updated tests using the `assert_separately`.
* Added tests for `MakeMakefile#with_config` in the `test/mkmf/test_config.rb`.

[1] https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html

Fixes [Bug #19695]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-05-29 10:09:32 +02:00
tomoya ishida d5ef373b11 [ruby/irb] Set maximum document dialog height by
preferred_dialog_height provided by Reline
(https://github.com/ruby/irb/pull/591)

https://github.com/ruby/irb/commit/df6907aca9
2023-05-28 09:20:18 +00:00
Samuel Williams 14abb799c9 [ruby/io-nonblock] Remove usage of IO internals.
(https://github.com/ruby/io-nonblock/pull/11)

https://github.com/ruby/io-nonblock/commit/caa2b94d19
2023-05-28 08:40:38 +00:00
Samuel Williams 55393645a1 [ruby/io-nonblock] Revert "Remove usage of IO internals."
This reverts commit https://github.com/ruby/io-nonblock/commit/9772b6dcb63c.

https://github.com/ruby/io-nonblock/commit/08cabf78e1
2023-05-28 08:01:50 +00:00
Samuel Williams 26dd9c5f0f [ruby/io-nonblock] Remove usage of IO internals.
https://github.com/ruby/io-nonblock/commit/9772b6dcb6
2023-05-28 07:49:33 +00:00
Samuel Williams 881757c03f [ruby/io-wait] Remove usage of IO internals.
(https://github.com/ruby/io-wait/pull/25)

https://github.com/ruby/io-wait/commit/e5854b46c7
2023-05-28 05:09:02 +00:00
Samuel Williams 00d6674636 [ruby/etc] Remove usage of IO internals.
(https://github.com/ruby/etc/pull/26)

https://github.com/ruby/etc/commit/ea15eceb13
2023-05-28 05:08:40 +00:00
tomoya ishida cf0b9e0db0 [ruby/reline] Fix scrolldown condition in dialog rendering
(https://github.com/ruby/reline/pull/541)

https://github.com/ruby/reline/commit/ad6faada3f
2023-05-27 15:07:29 +00:00
tomoya ishida 5d137a7f77 [ruby/reline] Use appropriate dialog height and reduce screen pushup
problem
(https://github.com/ruby/reline/pull/542)

* Provide preferred_dialog_height for dialog positioning

* Fix rendering test
2023-05-27 14:48:50 +00:00
Samuel Williams bf1bc5362e
Improve `read`/`write`/`pread`/`pwrite` consistency. (#7860)
* Documentation consistency.

* Improve consistency of `pread`/`pwrite` implementation when given length.

* Remove HAVE_PREAD / HAVE_PWRITE - it is no longer optional.
2023-05-27 18:48:47 +09:00
Peter Zhu c37ebfe08f Remove dead code in string.c
The STR_DEC_LEN macro is not used.
2023-05-26 13:34:26 -04:00
Nobuyoshi Nakada c6e4337a99
[DOC] No document under win32
Also .document was removed at 57bc4cfa28.
2023-05-27 02:07:47 +09:00
Masafumi Koba 94e5ecbbdd [ruby/rdoc] Improve `<summary>` CSS on sidebar
- Use a smaller font size for the toggle symbol. (Currently, it seems a little too large)
- Use the child combinator (`>`) to unify selectors.
- Use `margin-left` instead of whitespace within the `content` property.
- Use `::` instead of outdated `:` for the pseudo-element symbol.
  (See https://developer.mozilla.org/en-US/docs/Web/CSS/::before)

https://github.com/ruby/rdoc/commit/61ce0a7d75
2023-05-26 16:26:46 +00:00
Masafumi Koba 54b7ce0bff [ruby/rdoc] Improve layout CSS
- Use the `grid` property for the page layout.
  - https://caniuse.com/css-grid
- Adjust the `<main>` margin.
- Make the sidebar responsive and resizable.
  - https://caniuse.com/css-math-functions
  - https://caniuse.com/css-resize

Note all modern browsers support the new CSS properties and functions used by this change.

https://github.com/ruby/rdoc/commit/2db5097c41
2023-05-26 16:24:57 +00:00
Jeremy Evans 618a04d211
Document throw/catch in the control expressions document [ci skip]
This are implemented as Kernel methods and not keywords, but I
still think they are worth documenting with the other control
flow expressions.
2023-05-26 07:58:40 -07:00
Peter Zhu 4847b7ac28 T_HASH is no longer on transient heap 2023-05-26 09:24:23 -04:00