Issue #19742 has been reported by ioquatix (Samuel Williams).
----------------------------------------
Bug #19742: Introduce `Module#anonymous?`
https://bugs.ruby-lang.org/issues/19742
* Author: ioquatix (Samuel Williams)
* Status: Open
* Priority: Normal
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
As a follow-on <from https://bugs.ruby-lang.org/issues/19521>, I'd like propose we introduce `Module#anonymous?`.
In some situations, like logging/formatting, serialisation/deserialization, debugging or meta-programming, we might like to know if a class is a proper constant or not.
However, this brings about some other issues which might need to be discussed.
After assigning a constant, then removing it, the internal state of Ruby still believes that the class name is permanent, even thought it's no longer true.
e.g.
```
m = Module.new
m.anonymous? # true
M = m
m.anonyomous # false
Object.send(:remove_const, :M)
M # uninitialized constant M (NameError)
M.anonymous? # false
```
Because RCLASS data structure is not updated after the constant is removed, internally the state still has a "permanent class name".
I want to use this proposal to discuss this issue and whether there is anything we should do about such behaviour (or even if it's desirable).
Proposed PR: https://github.com/ruby/ruby/pull/7966
cc @fxn
--
https://bugs.ruby-lang.org/
Issue #20096 has been reported by jay4rubydev (Jay M).
----------------------------------------
Bug #20096: Ruby 3.2.2 win32/registry: Junk appended to Windows Registry String Value
https://bugs.ruby-lang.org/issues/20096
* Author: jay4rubydev (Jay M)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mswin64_140]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
Ruby Version:
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mswin64_140]
Compiler: MSVC 2019 - Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30147 for x64.
Issue: win32/registry adds junk to Windows Registry String Value
Code:
require 'win32/registry'
win_oracle_key = "SOFTWARE\\MicroSoft"
reg=Win32::Registry::HKEY_LOCAL_MACHINE.open(win_oracle_key, Win32::Registry::KEY_ALL_ACCESS)
inst_loc_key = "inst_loc"
inv_dir="C:\\Program Files\\Tester\\ModuleInfo"
reg[inst_loc_key] = inv_dir
Result:
Registry contains:
C:\Program Files\Tester\ModuleInfo爀
Observation: Looks like memory overread
Expected Result - without the junk:
C:\Program Files\Tester\ModuleInfo
After changing the code in registry.rb:
From:
def write(name, type, data)
termsize = 0
case type
when REG_SZ, REG_EXPAND_SZ
data = data.encode(WCHAR)
termsize = WCHAR_SIZE
To:
def write(name, type, data)
termsize = 0
case type
when REG_SZ, REG_EXPAND_SZ
enc_data = data.encode(WCHAR)
# Add NULL WCHAR for string data and don't set the termsize because
# enc_data.bytesize will now include the size of the NULL character.
enc_data += WCHAR_NUL
# termsize = WCHAR_SIZE
...
--
https://bugs.ruby-lang.org/
Issue #19973 has been reported by tenderlovemaking (Aaron Patterson).
----------------------------------------
Bug #19973: Duplicate keyword argument names don't always warn
https://bugs.ruby-lang.org/issues/19973
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2023-10-24T19:38:50Z cleanup 3525a9bd22) [arm64-darwin23]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
Calling a method with duplicate keyword arguments doesn't warn when it could:
```ruby
def bar a:, b:
a + b
end
# Warning
bar(a: 1, b: 3, a: 2)
z = { b: 123 }
# No warning
bar(a: 1, **z, a: 2)
```
The first call to `bar` gives a warning about duplicate keyword args, but the second call doesn't. I think both cases should emit a warning.
--
https://bugs.ruby-lang.org/
Issue #19967 has been reported by nobu (Nobuyoshi Nakada).
----------------------------------------
Bug #19967: Already installed libruby.dylib is used for test on macOS
https://bugs.ruby-lang.org/issues/19967
* Author: nobu (Nobuyoshi Nakada)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Backport: 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED
----------------------------------------
On macOS, in the case of `--enable-shared` and `--disable-load-relative`, already install libruby.dylib is used during tests if exists.
This is because since [Bug #14992], `DYLD_FALLBACK_LIBRARY_PATH` is used instead of `DYLD_LIBRARY_PATH`.
The latter environment variable is used preferentially, whereas the former is used as a fallback, as the name implies.
--
https://bugs.ruby-lang.org/
Issue #20043 has been reported by tenderlovemaking (Aaron Patterson).
----------------------------------------
Bug #20043: `defined?` checks for method existence but only sometimes
https://bugs.ruby-lang.org/issues/20043
* Author: tenderlovemaking (Aaron Patterson)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2023-12-05T21:25:34Z master 56eccb350b) [arm64-darwin23]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
When an expression is passed to `defined?`, it will _sometimes_ check if a method in a sub-expression is defined and sometimes it won't.
For example:
```
$ ./miniruby -e'p defined?(a)'
nil
$ ./miniruby -e'p defined?([a])'
nil
```
In the above case, Ruby will check whether or not the method `a` is defined, and it returns `nil`. However, if you use a splat, it will not check:
```
$ ./miniruby -e'p defined?([*a])'
"expression"
```
The same thing seems to happen with method parameters:
```
$ ./miniruby -e'p defined?(itself)'
"method"
$ ./miniruby -e'p defined?(itself(a))'
nil
$ ./miniruby -e'p defined?(itself(*a))'
"method"
```
Oddly, `defined?` will check contents of arrays, but _won't_ check contents of hashes:
```
$ ./miniruby -e'p defined?([[[[a]]]])'
nil
$ ./miniruby -e'p defined?({ a => a })'
"expression"
```
I think all of the cases that refer to `a` should check whether or not `a` is defined regardless of splats or hashes.
--
https://bugs.ruby-lang.org/
Issue #19365 has been reported by luke-gru (Luke Gruber).
----------------------------------------
Bug #19365: Ractors can access non-shareable values through enumerators
https://bugs.ruby-lang.org/issues/19365
* Author: luke-gru (Luke Gruber)
* Status: Open
* Priority: Normal
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I don't think enumerators should be able to be passed to `Ractor.new`
```ruby
obj = Object.new # unshareable value
p obj
Ractor.new([obj].each) {|f| p f.first }.take
```
--
https://bugs.ruby-lang.org/
Issue #19395 has been reported by luke-gru (Luke Gruber).
----------------------------------------
Bug #19395: Process forking within non-main Ractor creates child stuck in busy loop
https://bugs.ruby-lang.org/issues/19395
* Author: luke-gru (Luke Gruber)
* Status: Open
* Priority: Normal
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
```ruby
def test_fork_in_ractor
r2 = Ractor.new do
pid = fork do
exit Ractor.count
end
pid
end
pid = r2.take
puts "Process #{Process.pid} waiting for #{pid}"
_pid, status = Process.waitpid2(pid) # stuck forever
if status.exitstatus != 1
raise "status is #{status.exitstatus}"
end
end
test_fork_in_ractor()
```
$ top # shows CPU usage is high for child process
--
https://bugs.ruby-lang.org/
Issue #19408 has been reported by luke-gru (Luke Gruber).
----------------------------------------
Bug #19408: Object no longer frozen after moved from a ractor
https://bugs.ruby-lang.org/issues/19408
* Author: luke-gru (Luke Gruber)
* Status: Open
* Priority: Normal
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I think frozen objects should still be frozen after a move.
```ruby
r = Ractor.new do
obj = receive
p obj.frozen? # should be true but is false
p obj
end
obj = [Object.new].freeze
r.send(obj, move: true)
r.take
```
--
https://bugs.ruby-lang.org/