Issue #20231 has been reported by ioquatix (Samuel Williams).
----------------------------------------
Bug #20231: Don't wait in io_binwrite_string if not necessary.
https://bugs.ruby-lang.org/issues/20231
* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Backport: 3.2: REQUIRED, 3.3: REQUIRED
----------------------------------------
PR: https://github.com/ruby/ruby/pull/9792
Writing to a buffered IO can result in the entire internal buffer being flushed, which causes `io_binwrite_string_internal` to return 0. In that case, we were setting `errno = EAGAIN`. This causes `rb_io_maybe_wait_writable` to be invoked, however we should immediately retry `io_binwrite_string_internal` instead.
The reason why calling `rb_io_maybe_wait_writable` is a bad idea in general, is that not all IO can go via this mechanism in every situation - in other words, `kqueue` does not support `kevent("/dev/null", writable)` and returns errno=22 `EINVAL`. The same applies to some kinds of pipes, TTYs, etc.
Indirectly responsible for <https://github.com/socketry/async/issues/301>.
--
https://bugs.ruby-lang.org/
Issue #20403 has been reported by kjtsanaktsidis (KJ Tsanaktsidis).
----------------------------------------
Bug #20403: TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback can flake if TCP port is in use
https://bugs.ruby-lang.org/issues/20403
* Author: kjtsanaktsidis (KJ Tsanaktsidis)
* Status: Open
* Assignee: kjtsanaktsidis (KJ Tsanaktsidis)
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The test TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback wants to make a TCP and UDP DNS server on the same port. It achieves this by binding to a random UDP port (with `:0`), and then trying to bind to that TCP port. However, just because the UDP port was free, does not mean the TCP port was, so this can fail.
This leads to test failures like this one: https://github.com/ruby/ruby/actions/runs/8497267556/job/23275642160
```
1) Error:
TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback:
Errno::EACCES: Permission denied - bind(2) for "127.0.0.1" port 49701
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:48:in 'TCPServer#initialize'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:48:in 'IO.new'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:48:in 'TestResolvDNS#with_tcp'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:181:in 'block in TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:61:in 'TestResolvDNS#with_udp'
D:/a/ruby/ruby/src/test/resolv/test_dns.rb:179:in 'TestResolvDNS#test_query_ipv4_address_truncated_tcp_fallback'
Finished tests in 401.425882s, 64.4851 tests/s, 15534.2649 assertions/s.
25886 tests, 6235856 assertions, 0 failures, 1 errors, 502 skips
```
(note - it's EACCESS, not EADDRINUSE, because of this issue on Windows, I think: https://stackoverflow.com/questions/48478869/cannot-bind-to-some-ports-due-…)
--
https://bugs.ruby-lang.org/
Issue #20245 has been reported by peterzhu2118 (Peter Zhu).
----------------------------------------
Bug #20245: Crash when checking symbol encoding
https://bugs.ruby-lang.org/issues/20245
* Author: peterzhu2118 (Peter Zhu)
* Status: Open
* Priority: Normal
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: REQUIRED, 3.3: REQUIRED
----------------------------------------
GitHub PR: https://github.com/ruby/ruby/pull/9871
We sometimes pass in a fake string to sym_check_asciionly. This can crash if sym_check_asciionly raises because it creates a CFP with the fake string as the receiver which will crash if GC tries to mark the CFP.
For example, the following script crashes:
```ruby
GC.stress = true
Object.const_defined?("\xC3")
```
--
https://bugs.ruby-lang.org/
Issue #20190 has been reported by tompng (tomoya ishida).
----------------------------------------
Bug #20190: `invalid_encoding_string << number` should be valid encoding in some case, but does not
https://bugs.ruby-lang.org/issues/20190
* Author: tompng (tomoya ishida)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.4.0dev (2024-01-09T07:07:19Z master db476cc71c) [x86_64-linux]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
In some encoding, appending ascii char might change invalid encoding string to valid. But it does not.
~~~ruby
# encoding: utf-8
valid = '表'.encode('sjis')
valid.bytes
# => [0x95, 0x5c]
s = valid.byteslice(0, 1)
p s.valid_encoding? #=> false
s << 0x5c
p s == valid #=> true
p s.valid_encoding? #=> should be true, but false
~~~
pull request: https://github.com/ruby/ruby/pull/9553
--
https://bugs.ruby-lang.org/
Issue #20098 has been reported by tompng (tomoya ishida).
----------------------------------------
Bug #20098: Wrong regexp match in ruby 3.2 and 3.3
https://bugs.ruby-lang.org/issues/20098
* Author: tompng (tomoya ishida)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +MN [arm64-darwin22]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
These regexp all matches in ruby 3.1.4, but not in ruby 3.3.0.
~~~ruby
p /a((.|.)|bc){,4}z/.match? 'abcbcbcbcz'
p /a(b+?c*){4,5}z/.match? 'abbbccbbbccbcbcz' # matches in ruby 3.2.2
p /a(b+?(.|.)){2,3}z/.match? 'abbbcbbbcbbbcz'
p /a(b*?(.|.)[bc]){2,5}z/.match? 'abcbbbcbcccbcz'
~~~
Adding backref (to disable optimization) makes them match.
~~~ruby
p /()\1a((.|.)|bc){,4}z/.match? 'abcbcbcbcz'
p /()\1a(b+?c*){4,5}z/.match? 'abbbccbbbccbcbcz'
p /()\1a(b+?(.|.)){2,3}z/.match? 'abbbcbbbcbbbcz'
p /()\1a(b*?(.|.)[bc]){2,5}z/.match? 'abcbbbcbcccbcz'
~~~
Found in this script https://gist.github.com/tompng/aa0706a181e9187bd79e8cec5a5f3c97
--
https://bugs.ruby-lang.org/
Issue #20399 has been reported by kddnewton (Kevin Newton).
----------------------------------------
Bug #20399: Ripper doesn't respect implicit -x
https://bugs.ruby-lang.org/issues/20399
* Author: kddnewton (Kevin Newton)
* Status: Open
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
For the given script:
```ruby
#!/bin/sh
# -*- ruby -*-
exec "${RUBY-ruby}" "-x" "$0" "$@" && [ ] if false
#!ruby
# This needs ruby 2.0, Subversion and Git.
# As a Ruby committer, run this in an SVN repository
# to commit a change.
require 'tempfile'
require 'net/http'
```
I would expect all of the various Ripper APIs (`lex`, `sexp`, `sexp_raw`, `new.parse`, etc.) to start parsing on line 4, because that's what the parser does. Instead, it starts parsing on line 1.
--
https://bugs.ruby-lang.org/