Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112023-01-02T13:38:57ZRuby Issue Tracking System
Redmine Ruby master - Bug #19296 (Closed): Time.new's argument check is incompletehttps://bugs.ruby-lang.org/issues/192962023-01-02T13:38:57Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p><code>Time.new</code> seems to be performing some sort of argument checking, but I found some strings that can bypass this validation and craft erroneous Time value.</p>
<ul>
<li>month</li>
</ul>
<pre><code>'12'.upto('20').each do |m|
str = "2023-#{m}-01"
puts str
begin
p Time.new str
rescue => e
p e
end
puts
end
</code></pre>
<pre><code># result
2023-12-01
2023-12-01 00:00:00 +0900
2023-13-01
#<ArgumentError: mon out of range>
2023-14-01
#<ArgumentError: mon out of range>
2023-15-01
#<ArgumentError: mon out of range>
2023-16-01
#<ArgumentError: mon out of range>
2023-17-01
2023-01-01 00:00:00 +0900
2023-18-01
2023-02-01 00:00:00 +0900
2023-19-01
2023-03-01 00:00:00 +0900
2023-20-01
2023-04-01 00:00:00 +0900
</code></pre>
<ul>
<li>day</li>
</ul>
<pre><code>$ ruby -e 'p Time.new("2023-01-31")'
2023-01-31 00:00:00 +0900
$ ruby -e 'p Time.new("2023-01-32")'
<internal:timev>:398:in `initialize': mday out of range (ArgumentError)
from -e:1:in `new'
from -e:1:in `<main>'
$ ruby -e 'p Time.new("2023-01-33")'
2023-01-01 00:00:00 +0900
$ ruby -e 'p Time.new("2023-01-34")
2023-01-02 00:00:00 +0900
</code></pre>
<p>In conclusion, month seeems to raise only when the given value is <= 16, and day seems to be checked for <= 32 only.</p> Ruby master - Bug #19293 (Closed): The new Time.new(String) API is nice... but we still need a st...https://bugs.ruby-lang.org/issues/192932023-01-01T15:07:27Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>The Ruby 3.2 style <code>Time.new(String)</code> API works very well so far, but since the original <code>Time.new(Integer, Integer, Integer...)</code> API actually accepts String objects as its arguments, there's one ambiguous case as follows:<br>
<code>Time.new('20230123') #=> 20230123-01-01 00:00:00 +0900</code></p>
<p>Then the problem that I'm facing is that we cannot tell if <code>Time.new</code> would parse the given String as ISO8601-ish or just a year, and in order to avoid this ambiguity, we still need to somehow parse the String beforehand in our application side (like we're doing this way in Ruby on Rails <a href="https://github.com/rails/rails/blob/c49b8270/activemodel/lib/active_model/type/helpers/time_value.rb#L64-L70" class="external">https://github.com/rails/rails/blob/c49b8270/activemodel/lib/active_model/type/helpers/time_value.rb#L64-L70</a>), then dispatch to the new <code>Time.new</code> only when the String is validated to be conforming the ISO format. Otherwise, if we just optimistically pass in given Strings to <code>Time.new</code>, we'll occasionally get a Time object with an unintended buggy value.</p>
<p>Therefore, it unfortunately seems that my feature request on <a class="issue tracker-2 status-1 priority-4 priority-default" title="Feature: A variation of Time.iso8601 that can parse yyyy-MM-dd HH:mm:ss (Open)" href="https://bugs.ruby-lang.org/issues/16005">#16005</a> still continues... I have to keep proposing that we need either of the following:</p>
<ol>
<li>
<p>A trustworthy version of ISO8601 parser method perhaps with another name than <code>.new</code> that accepts strict ISO8601-ish String only (but with the T delimiter, I still don't know what the proper name of this format is).</p>
</li>
<li>
<p>Change <code>Time.new(Integer-ish, Integer-ish, Integer-ish...)</code> not to accept Integer-ish Strings but to accept only Integers. But I can imagine that this direction is very unlikely acceptable, due to the incompatibility.</p>
</li>
</ol> Ruby master - Bug #19292 (Closed): Time object's wday, yday, and isdst returns broken value (and ...https://bugs.ruby-lang.org/issues/192922022-12-31T21:38:44Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').wday"<br>
7</p>
<p>$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').yday"<br>
0</p>
<p>$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').isdst"<br>
-e:1:in <code>isdst': isdst is not set yet (RuntimeError) from -e:1:in </code>'</p>
<p>$ ruby -e "p Time.new(2023, 1, 1, 0, 0, 0, in: 'UTC').to_a"<br>
[0, 0, 0, 1, 1, 2023, 7, 0, true, "UTC"]</p>
<p>where the expected <code>to_a</code> value should be:<br>
[0, 0, 0, 1, 1, 2023, 0, 1, false, "UTC"]</p>
<p>This bug seems to be happening on the following conditions:</p>
<ul>
<li>On any given date and time, regardless of past or future</li>
<li>Either on <code>Time.new(Integer, Integer, ...)</code> style or <code>Time.new(String)</code> style</li>
<li>Only when <code>in: 'UTC'</code> kwarg was given. Other formats like <code>in: '+0000'</code> or <code>in: 0</code> seems to be OK</li>
<li>On all Ruby versions that accept kwarg <code>in:</code> (3.1, 3.2, and 3.3)</li>
</ul> Ruby master - Feature #19287 (Open): Let DelegateClass respect the original method's arity in cas...https://bugs.ruby-lang.org/issues/192872022-12-30T03:15:02Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>As reported in <a class="issue tracker-1 status-1 priority-4 priority-default" title="Bug: Method (with no param) delegation with *, **, and ... is slow (Open)" href="https://bugs.ruby-lang.org/issues/19165">#19165</a>, method delegation with *, **, and ... adds some overhead for a method that takes no argument. And current implementation of delegations in forwardable and delegate basically define all methods to take splat parameters.</p>
<p>But, with regard to DelegateClass, we can investigate the arity of the target methods in the initializer, then we can define the delegation method not to take the splat for zero arity methods.</p>
<p>A benchmark on trunk today results in 37% runtime performance improvement on a such method.</p>
<p>Benchmark:<br>
Warming up --------------------------------------<br>
old 551.697k i/100ms<br>
new 721.906k i/100ms<br>
Calculating -------------------------------------<br>
old 6.511M (± 0.8%) i/s - 33.102M in 5.084530s<br>
new 8.925M (± 1.0%) i/s - 44.758M in 5.015619s</p>
<p>Comparison:<br>
new: 8924652.2 i/s<br>
old: 6510691.1 i/s - 1.37x (± 0.00) slower</p>
<p>Patch: <a href="https://github.com/ruby/ruby/pull/7045" class="external">https://github.com/ruby/ruby/pull/7045</a></p> Ruby master - Bug #19286 (Closed): What should kwargs' arity be?https://bugs.ruby-lang.org/issues/192862022-12-30T03:08:32Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>Hello, guys. It's time for a quick Ruby quiz.</p>
<p>Q: What is this method's arity?<br>
def f(a:, b:)<br>
end</p>
<p>It requires two arguments, hence it should be 2?<br>
Or if we call this method with one argument, the error message says "wrong number of arguments (given 1, expected 0; required keywords: a, b) (ArgumentError)", which means the arity is 0, maybe?</p>
<p>A: The answer is,<br>
$ all-ruby -e 'p method(def f(a:, b:) end).arity'<br>
ruby-2.1.0-preview1 0<br>
...<br>
ruby-2.1.0 0<br>
ruby-2.1.1 -1<br>
ruby-2.1.2 1<br>
...<br>
ruby-3.1.0 1</p>
<p>it's been 1 since 2.1.2. But why 1? Why not 2 nor 0?</p>
<p>I asked this question to the ruby-core people, and ko1's answer was that even he has no idea what the number 1 means.<br>
<img src="https://bugs.ruby-lang.org/attachments/download/9383/random_-_ruby-lang_-_Slack.png" alt="" loading="lazy"></p>
<p>So I thought it'd be worth asking this question here.</p> Ruby master - Bug #19165 (Open): Method (with no param) delegation with *, **, and ... is slowhttps://bugs.ruby-lang.org/issues/191652022-12-01T08:49:16Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>I found that method delegation via Forwardable is much slower than normal method call when delegating a method that does not take parameters.</p>
<p>Here's a benchmark that explains what I mean.</p>
<pre><code>require 'forwardable'
require 'pp'
require 'benchmark/ips'
class Obj
extend Forwardable
attr_accessor :other
def initialize
@other = Other.new
end
def foo_without_splat
@other.foo
end
def foo_with_splat(*)
@other.foo(*)
end
def foo_with_splat_with_name(*args)
@other.foo(*args)
end
def foo_with_splat_and_double_splat(*, **)
@other.foo(*, **)
end
def foo_with_triple_dots(...)
@other.foo(...)
end
delegate :foo => :@other
end
class Other
def foo() end
end
o = Obj.new
Benchmark.ips do |x|
x.report 'simple call' do
o.other.foo
end
x.report 'delegate without splat' do
o.foo_without_splat
end
x.report 'delegate with splat' do
o.foo_with_splat
end
x.report 'delegate with splat with name' do
o.foo_with_splat_with_name
end
x.report 'delegate with splat and double splat' do
o.foo_with_splat_and_double_splat
end
x.report 'delegate with triple dots' do
o.foo_with_triple_dots
end
x.report 'delegate via forwardable' do
o.foo
end
end
(result)
simple call 38.918M (± 0.9%) i/s - 194.884M
delegate without splat
31.933M (± 1.6%) i/s - 159.611M
delegate with splat 10.269M (± 1.6%) i/s - 51.631M
delegate with splat with name
9.888M (± 1.0%) i/s - 49.588M
delegate with splat and double splat
4.117M (± 0.9%) i/s - 20.696M
delegate with triple dots
4.169M (± 0.9%) i/s - 20.857M
delegate via forwardable
9.204M (± 2.1%) i/s - 46.295M
</code></pre>
<p>It shows that Method delegation with a splat is 3-4 times slower (regardless of whether the parameter is named or not), and delegation with a triple-dot literal is 9-10 times slower than a method delegation without an argument.<br>
This may be because calling a method taking a splat always assigns an Array object even when no actual argument was given, and calling a method taking triple-dots assigns five Array objects and two Hash objects (this is equivalent to <code>*, **</code>).</p>
<p>Are there any chance reducing these object assignments and making them faster? My concern is that the Rails framework heavily uses this kind of method delegations, and presumably it causes unignorable performance overhead.</p> Ruby master - Bug #19159 (Closed): ObjectSpace segfaultshttps://bugs.ruby-lang.org/issues/191592022-11-29T13:10:23Zmatsuda (Akira Matsuda)ronnie@dio.jp
<pre><code>$ ruby -e 'p ObjectSpace.each_object.to_a'
</code></pre>
<p>segfaults on my M1MBP as follows:</p>
<pre><code>$ ruby -e 'p ObjectSpace.each_object.to_a'
-e:1: [BUG] Segmentation fault at 0x0000000000000000
ruby 3.2.0dev (2022-11-29T09:23:00Z master 67ae3e9738) +YJIT [arm64-darwin21]
-- Crash Report log information --------------------------------------------
See Crash Report log file in one of the following locations:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
c:0005 p:---- s:0017 e:000016 CFUNC :inspect
c:0004 p:---- s:0014 e:000013 CFUNC :inspect
c:0003 p:---- s:0011 e:000010 CFUNC :p
c:0002 p:0009 s:0006 e:000005 EVAL -e:1 [FINISH]
c:0001 p:0000 s:0003 E:0005a0 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
-e:1:in `<main>'
-e:1:in `p'
-e:1:in `inspect'
-e:1:in `inspect'
-- Machine register context ------------------------------------------------
x0: 0x0000000000000000 x1: 0x0000000000000004 x2: 0x0000000000000001
x3: 0x0000000104090e94 x4: 0x0000000000000275 x5: 0x0000000000000ad1
x6: 0x0000000000000020 x7: 0x000000016ef18a00 x18: 0x0000000000000000
x19: 0x0000000000000000 x20: 0x0000000000000001 x21: 0x0000000000000004
x22: 0x0000000104090e98 x23: 0x0000000000000001 x24: 0x0000000000000000
x25: 0x0000000000000001 x26: 0x0000000158127f00 x27: 0x00006000032ab4b0
x28: 0x0000000055550083 lr: 0x000000010108a058 fp: 0x000000016ef1a0f0
sp: 0x000000016ef1a0b0
-- C level backtrace information -------------------------------------------
~/.rbenv/versions/3.2.0-dev/bin/ruby(rb_vm_bugreport+0x2410000000009ac) [0x24100010115a564]
~/.rbenv/versions/3.2.0-dev/bin/ruby(rb_bug_for_fatal_signal) [0x9b16000100f7fe68]
~/.rbenv/versions/3.2.0-dev/bin/ruby(sig_do_nothing) [0x646c0001010b9638]
/usr/lib/system/libsystem_platform.dylib(_sigtramp+0x664c000000000038) [0x664c0001a77f34a4]
[0x38]
-- Other runtime information -----------------------------------------------
* Loaded script: -e
* Loaded features:
0 enumerator.so
1 thread.rb
2 fiber.so
3 rational.so
4 complex.so
5 ruby2_keywords.rb
6 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/enc/encdb.bundle
7 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/enc/trans/transdb.bundle
8 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/rbconfig.rb
9 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/compatibility.rb
10 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/defaults.rb
11 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/deprecate.rb
12 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/errors.rb
13 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/unknown_command_spell_checker.rb
14 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/exceptions.rb
15 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/basic_specification.rb
16 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/stub_specification.rb
17 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/platform.rb
18 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/util/list.rb
19 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/version.rb
20 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/requirement.rb
21 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/specification.rb
22 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/util.rb
23 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/dependency.rb
24 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_gem.rb
25 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/monitor.bundle
26 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/monitor.rb
27 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb
28 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_warn.rb
29 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems.rb
30 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/rubygems/path_support.rb
31 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/error_highlight/version.rb
32 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/error_highlight/base.rb
33 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/error_highlight/formatter.rb
34 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/error_highlight/core_ext.rb
35 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/error_highlight.rb
36 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/version.rb
37 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/core_ext/name_error.rb
38 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/levenshtein.rb
39 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/jaro_winkler.rb
40 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/spell_checker.rb
41 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
42 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
43 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/spell_checkers/name_error_checkers.rb
44 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/spell_checkers/method_name_checker.rb
45 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/spell_checkers/key_error_checker.rb
46 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/spell_checkers/null_checker.rb
47 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/tree_spell_checker.rb
48 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/spell_checkers/require_path_checker.rb
49 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/spell_checkers/pattern_key_name_checker.rb
50 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean/formatter.rb
51 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/did_you_mean.rb
52 ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/syntax_suggest/core_ext.rb
* Process memory map:
100ee4000-101390000 r-x ~/.rbenv/versions/3.2.0-dev/bin/ruby
101390000-1013ac000 r-- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1013ac000-1013b0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1013b0000-1013c0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1013c0000-1015a8000 r-- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1015a8000-1016a8000 r-- /usr/lib/dyld
1016a8000-1016b0000 rw- /usr/lib/dyld
1016b0000-1016b4000 r-- /usr/lib/dyld
1016b4000-1016b8000 r-- /usr/lib/dyld
1016b8000-1016bc000 rw- /usr/lib/dyld
1016bc000-1016c0000 --- /usr/lib/dyld
1016c0000-1016c8000 rw- /usr/lib/dyld
1016c8000-1016cc000 --- /usr/lib/dyld
1016cc000-1016d0000 --- /usr/lib/dyld
1016d0000-1016d8000 rw- /usr/lib/dyld
1016d8000-1016dc000 --- /usr/lib/dyld
1016dc000-1016e0000 --- /usr/lib/dyld
1016e0000-1016e8000 rw- /usr/lib/dyld
1016e8000-1016ec000 --- /usr/lib/dyld
1016ec000-1016f0000 r-- /usr/lib/dyld
1016f0000-1016f4000 r-- /usr/lib/dyld
1016f4000-1016f8000 rw- /usr/lib/dyld
1016f8000-1016fc000 r-- /usr/lib/dyld
1016fc000-10173c000 rw- /usr/lib/dyld
101740000-101750000 rw- /usr/lib/dyld
10175c000-1017bc000 r-x /usr/lib/dyld
1017bc000-1017d4000 r-- /usr/lib/dyld
1017d4000-1017d8000 rw- /usr/lib/dyld
1017d8000-101810000 r-- /usr/lib/dyld
101810000-101868000 r-x /opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmp.10.dylib
101868000-10186c000 r-- /opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmp.10.dylib
10186c000-101870000 rw- /opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmp.10.dylib
101870000-101880000 r-- /opt/homebrew/Cellar/gmp/6.2.1_1/lib/libgmp.10.dylib
101880000-101884000 r-x ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/enc/encdb.bundle
101884000-101888000 r-- ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/enc/encdb.bundle
101888000-10188c000 r-- ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/enc/encdb.bundle
101890000-1018a0000 rw- ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/enc/trans/transdb.bundle
1018a0000-1018a4000 r-x ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/enc/trans/transdb.bundle
1018a4000-1018a8000 r-- ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/enc/trans/transdb.bundle
1018a8000-1018ac000 r-- ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/enc/trans/transdb.bundle
1018b0000-1018c0000 rw- ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/monitor.bundle
1018c0000-1018c4000 r-x ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/monitor.bundle
1018c4000-1018c8000 r-- ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/monitor.bundle
1018c8000-1018cc000 rw- ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/monitor.bundle
1018cc000-1018d0000 r-- ~/.rbenv/versions/3.2.0-dev/lib/ruby/3.2.0+3/arm64-darwin21/monitor.bundle
1018d0000-1018e0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1018f0000-101900000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
101910000-101920000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
101920000-102920000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102930000-102940000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102950000-102960000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102970000-102980000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102980000-102984000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102984000-102a28000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102a28000-102a2c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102a2c000-102ad0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102ad0000-102ad4000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102ad4000-102b78000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102b78000-102b7c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102b7c000-102c20000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102c20000-102c24000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102c24000-102cc8000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102cc8000-102ccc000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102ccc000-102d70000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102d70000-102d74000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102d74000-102e18000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102e18000-102e1c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102e1c000-102ec0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102ec0000-102ec4000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102ec4000-102f68000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102f68000-102f6c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
102f6c000-103010000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103010000-103014000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103014000-1030b8000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1030b8000-1030bc000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1030bc000-103160000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103160000-103164000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103164000-103208000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103208000-10320c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
10320c000-1032b0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1032b0000-1032b4000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1032b4000-103358000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103358000-10335c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
10335c000-103400000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103400000-103404000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103404000-1034a8000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1034a8000-1034ac000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1034ac000-103550000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103550000-103554000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103554000-1035f8000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1035f8000-1035fc000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1035fc000-1036a0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1036a0000-1036a4000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1036a4000-103748000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103748000-10374c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
10374c000-1037f0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1037f0000-1037f4000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1037f4000-103898000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103898000-10389c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
10389c000-103940000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103940000-103944000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103944000-1039e8000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1039e8000-1039ec000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1039ec000-103a90000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103a90000-103a94000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103a94000-103b38000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103b38000-103b3c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103b3c000-103be0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103be0000-103be4000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103be4000-103c88000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103c88000-103c8c000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103c8c000-103d30000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103d30000-103d34000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103d34000-103dd8000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103dd8000-103ddc000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103ddc000-103e80000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103e90000-103ea0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103eb0000-103ec0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103ed0000-103ee0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103ef0000-103f00000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103f10000-103f20000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103f30000-103f40000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103f50000-103f60000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103f70000-103f80000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103f90000-103fa0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103fb0000-103fc0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103fd0000-103fe0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
103ff0000-104000000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
104010000-104020000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
104030000-104040000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
104050000-104060000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
104070000-104080000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
104090000-1040a0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1040b0000-1040c0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1040d0000-1040e0000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
1040e0000-1040e4000 r-x ~/.rbenv/versions/3.2.0-dev/bin/ruby
1040e4000-1040e8000 r-x ~/.rbenv/versions/3.2.0-dev/bin/ruby
1040e8000-10c0e0000 --- ~/.rbenv/versions/3.2.0-dev/bin/ruby
10c0f0000-10c100000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
10c110000-10c120000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
10c130000-10c140000 rw- ~/.rbenv/versions/3.2.0-dev/bin/ruby
10c140000-10c7f4000 r-- ~/.rbenv/versions/3.2.0-dev/bin/ruby
10c7f4000-10cea8000 r-- ~/.rbenv/versions/3.2.0-dev/bin/ruby
138000000-138800000 rw-
138800000-139000000 rw-
139000000-139800000 rw-
139800000-13a000000 rw-
13a000000-13a800000 rw-
13a800000-13b000000 rw-
13b000000-13b800000 rw-
13b800000-13c000000 rw-
13c000000-13c800000 rw-
13c800000-13d000000 rw-
13d000000-13d800000 rw-
13d800000-13e000000 rw-
13e000000-13e800000 rw-
13e800000-13f000000 rw-
13f000000-13f800000 rw-
13f800000-140000000 rw-
146e00000-146f00000 rw-
146f00000-147000000 rw-
147000000-147800000 rw-
147800000-148000000 rw-
148000000-148800000 rw-
148800000-149000000 rw-
149000000-149800000 rw-
149800000-14a000000 rw-
14a000000-14a800000 rw-
14a800000-14b000000 rw-
14b000000-14b800000 rw-
14b800000-14c000000 rw-
14c000000-14c800000 rw-
14c800000-14d000000 rw-
14d000000-14d800000 rw-
14d800000-14e000000 rw-
14e000000-14e800000 rw-
14e800000-14f000000 rw-
14f000000-14f800000 rw-
14f800000-150000000 rw-
156e00000-156f00000 rw-
156f00000-157000000 rw-
157000000-157800000 rw-
157800000-157804000 rw-
158000000-158800000 rw-
158800000-159000000 rw-
159000000-159800000 rw-
159800000-15a000000 rw-
15a000000-15a800000 rw-
15a800000-15b000000 rw-
15b000000-15b800000 rw-
15b800000-15c000000 rw-
15c000000-15c800000 rw-
15c800000-15d000000 rw-
15d000000-15d800000 rw-
15d800000-15e000000 rw-
15e000000-15e800000 rw-
15e800000-15f000000 rw-
15f000000-15f800000 rw-
15f800000-160000000 rw-
160000000-162000000 rw-
162000000-162800000 rw-
16af1c000-16e720000 ---
16e720000-16ef1c000 rw-
16ef1c000-16ef20000 ---
16ef20000-16efa8000 rw-
180000000-1fc000000 r--
1fc000000-1fd9d8000 r--
1fd9d8000-1fd9fc000 rw-
1fd9fc000-1fe000000 rw-
1fe000000-200000000 r--
200000000-2001e8000 r--
2001e8000-2018dc000 rw-
2018dc000-204c64000 r--
204c64000-206000000 r--
206000000-236000000 r--
236000000-236a10000 r--
236a10000-2377f4000 rw-
2377f4000-238ac0000 r--
238ac0000-23a000000 r--
23a000000-280000000 r--
fc0000000-1000000000 ---
1000000000-7000000000 ---
600000000000-600008000000 rw-
600008000000-600010000000 rw-
600010000000-600018000000 rw-
600018000000-600020000000 rw-
[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.
</code></pre> Ruby master - Feature #16005 (Open): A variation of Time.iso8601 that can parse yyyy-MM-dd HH:mm:sshttps://bugs.ruby-lang.org/issues/160052019-07-15T05:21:48Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>Let me propose a String to Time conversion method that can parse "yyyy-MM-dd HH:mm:ss" format, which is very much similar to <code>Time.iso8601</code>, but delimits the date part and the time part with a space character.</p>
<p>This format is defined as the "timestamp string" literal in SQL 92 standard: <a href="http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt" class="external">http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt</a> (see P. 90)<br>
and so this format is very widely used as the default datetime / timestamp literal for major existing RDBMS implementations.</p>
<p>Oracle<br>
<a href="https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Literals.html#GUID-8F4B3F82-8821-4071-84D6-FBBA21C05AC1" class="external">https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Literals.html#GUID-8F4B3F82-8821-4071-84D6-FBBA21C05AC1</a></p>
<p>SQL Server<br>
<a href="https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/date-time-and-timestamp-literals?view=sql-server-2017" class="external">https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/date-time-and-timestamp-literals?view=sql-server-2017</a></p>
<p>PostgreSQL<br>
<a href="https://www.postgresql.org/docs/11/datatype-datetime.html#id-1.5.7.13.19.7.2" class="external">https://www.postgresql.org/docs/11/datatype-datetime.html#id-1.5.7.13.19.7.2</a></p>
<p>MySQL<br>
<a href="https://dev.mysql.com/doc/refman/8.0/en/datetime.html" class="external">https://dev.mysql.com/doc/refman/8.0/en/datetime.html</a></p>
<p>SQLite3<br>
<a href="https://www.sqlite.org/lang_datefunc.html" class="external">https://www.sqlite.org/lang_datefunc.html</a></p>
<p>In order to handle this conversion in Ruby on Rails framework, we define our own String => Time conversion method<br>
<a href="https://github.com/rails/rails/blob/b4c715fe/activemodel/lib/active_model/type/helpers/time_value.rb#L62-L76" class="external">https://github.com/rails/rails/blob/b4c715fe/activemodel/lib/active_model/type/helpers/time_value.rb#L62-L76</a><br>
and Time => String conversion for now,<br>
<a href="https://github.com/rails/rails/blob/b4c715fe/activesupport/lib/active_support/core_ext/time/conversions.rb#L7-L59" class="external">https://github.com/rails/rails/blob/b4c715fe/activesupport/lib/active_support/core_ext/time/conversions.rb#L7-L59</a><br>
and I think it's nicer if we had them in the language level with a faster implementation.</p>
<p>As for the method name, maybe we can name it <code>Time.sql92</code>, <code>Time.sql</code>, <code>Time.parse_sql92</code> or whatever, or maybe we can add an option to <code>Time.iso8601</code> if it could be regarded as a variation of <code>Time.iso8601</code>? (<a href="https://en.wikipedia.org/wiki/ISO_8601#cite_note-30" class="external">https://en.wikipedia.org/wiki/ISO_8601#cite_note-30</a>)</p> Ruby master - Bug #15875 (Closed): const_defined? behavior inconsistency in 2.6.x serieshttps://bugs.ruby-lang.org/issues/158752019-05-24T22:59:23Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p><code>Module#const_defined?</code> returns true for unreachable nested fully qualified module name.<br>
Here are the results of <code>const_defined?</code> for each ruby version on my machine.</p>
<pre><code>% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B')"
[1.9.3-p551, 2.0.0-p648]
-e:1:in `const_defined?': wrong constant name A::B (NameError)
from -e:1:in `<main>'
[2.1.10, 2.2.10, 2.3.8, 2.4.6, 2.5.5, 2.6.0]
false
[2.6.1, 2.6.2, 2.6.3]
true
[2.7.0-dev (2019-05-25 trunk 559dca509d)]
false
</code></pre>
<p>For (2.6.1...2.6.3), it fails to reference the constant even though <code>const_defined?</code> returns true. So IMO this should be <code>const_defined?</code>'s bug.</p>
<pre><code>% ruby -e "module A; end; B = 1; p Object.const_defined?('A::B') && A::B"
-e:1:in `<main>': uninitialized constant A::B (NameError)
</code></pre> Ruby master - Bug #14562 (Closed): Do not warn for assignment in conditionals inside ()https://bugs.ruby-lang.org/issues/145622018-03-01T01:15:55Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>Ruby warns against this code, which is very helpful.</p>
<pre><code>% ruby -we 'if a=1; p a; end'
-e:1: warning: found = in conditional, should be ==
1
</code></pre>
<p>So there's a commonly known practice. In order to express that we're intentionally assigning (not missing one more = sign), we usually add parens around the assignment.</p>
<p>But in fact, Ruby still warns...</p>
<pre><code>% ruby -we 'if (a=1); p a; end'
-e:1: warning: found = in conditional, should be ==
1
</code></pre>
<p>Can this behavior changed not to warn when parenthesized?</p> Ruby master - Bug #13222 (Closed): Array#sum inconsistency when init value is non-numerichttps://bugs.ruby-lang.org/issues/132222017-02-17T10:59:28Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>Since Array#sum skips calling plus for <code>0</code> <a href="https://github.com/ruby/ruby/blob/c85a58d/array.c#L5831-L5832" class="external">https://github.com/ruby/ruby/blob/c85a58d/array.c#L5831-L5832</a>, it doesn't raise when the receiver array consists of 0 only, even when the "init" value is non-numeric.</p>
<pre><code>% ruby -e "p [1].sum('a')"
-e:1:in `sum': String can't be coerced into Integer (TypeError)
</code></pre>
<pre><code>% ruby -e "p [0].sum('a')"
"a"
</code></pre>
<pre><code>% ruby -e "p [0, 0, 0].sum('a')"
"a"
</code></pre> Ruby master - Feature #13129 (Assigned): Refinements cannot refine method_missing and respond_to_...https://bugs.ruby-lang.org/issues/131292017-01-14T17:21:59Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>Refinements with method_missing and respond_to_missing? behaves very strangely.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">C</span><span class="p">;</span> <span class="k">end</span>
<span class="n">using</span> <span class="no">Module</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span>
<span class="n">refine</span> <span class="no">C</span> <span class="k">do</span>
<span class="k">def</span> <span class="nf">x</span><span class="p">()</span> <span class="nb">p</span><span class="ss">:x</span><span class="p">;</span> <span class="k">end</span>
<span class="k">def</span> <span class="nf">method_missing</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">)</span>
<span class="n">m</span> <span class="o">==</span> <span class="ss">:foo</span> <span class="p">?</span> <span class="nb">p</span><span class="p">(</span><span class="ss">:fooo!</span><span class="p">)</span> <span class="p">:</span> <span class="k">super</span>
<span class="k">end</span>
<span class="k">def</span> <span class="nf">respond_to_missing?</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="n">include_private</span> <span class="o">=</span> <span class="kp">false</span><span class="p">)</span>
<span class="p">(</span><span class="n">m</span> <span class="o">==</span> <span class="ss">:foo</span><span class="p">)</span> <span class="o">||</span> <span class="k">super</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="p">}</span>
<span class="no">C</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">x</span>
<span class="nb">p</span> <span class="no">C</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">respond_to?</span> <span class="ss">:foo</span>
<span class="no">C</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">foo</span>
</code></pre>
<p>The script above doesn't respond_to :foo nor run :foo as expected.<br>
Actually, the result differs between ruby versions.</p>
<pre><code>% ruby -v t.rb
ruby 2.5.0dev (2017-01-14 trunk 57328) [x86_64-darwin15]
:x
false
t.rb:19:in `<main>': undefined method `foo' for #<C:0x007f90ca0fb240> (NoMethodError)
% ruby -v t.rb
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin15]
:x
false
t.rb:19:in `<main>': undefined method `foo' for #<C:0x007f80ae097780> (NoMethodError)
% ruby -v t.rb
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]
:x
false
t.rb:19:in `<main>': undefined method `foo' for #<C:0x007fd89c83b518> (NoMethodError)
% ruby -v t.rb
ruby 2.2.6p396 (2016-11-15 revision 56800) [x86_64-darwin15]
:x
false
:fooo!
% ruby -v t.rb
ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin15.0]
:x
false
:fooo!
% ruby -v t.rb
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-darwin15.6.0]
t.rb:4: warning: Refinements are experimental, and the behavior may change in future versions of Ruby!
:x
false
:fooo!
</code></pre>
<p>What I can tell is that method_missing was broken at somewhere in between 2.2 and 2.3, and respond_to_missing? has never worked correctly.</p> Ruby master - Feature #13109 (Rejected): `using` in refinements is required to be physically plac...https://bugs.ruby-lang.org/issues/131092017-01-06T01:15:16Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>When using refinements in one file, the <code>using</code> call needs to be physically placed before the refined method call.</p>
<p>For example, this works:</p>
<pre><code>using Module.new {
refine Object do
def foo() p 'hello'; end
end
}
class Object
def bar() foo; end
end
Object.new.bar
</code></pre>
<p>but this doesn't work:</p>
<pre><code>class Object
def bar() foo; end
end
using Module.new {
refine Object do
def foo() p 'hello'; end
end
}
Object.new.bar
#=> doesnot_work.rb:2:in `bar': undefined local variable or method `foo' for #<Object:0x007f8f2a0251c8> (NameError)
</code></pre>
<p>I know that current refinements has a unique scope called "file scope", but I don't think this is expected behavior.<br>
At least I expect it to work so far as <code>using</code> is evaluated in runtime, no matter where in the file it is.</p>
<p>I confirmed that this reproduces in all stable versions of 2.0, 2.1, 2.2, 2.3, 2.4, and today's trunk (2.5).</p> Ruby master - Bug #13012 (Closed): irb fails to define a method with a reserved-word-ish keyword ...https://bugs.ruby-lang.org/issues/130122016-12-07T06:54:46Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>For example</p>
<pre><code>def a(if:) end
</code></pre>
<p>is a valid ruby code but this doesn't work on irb.</p>
<p>This seems to be happening for all keywords that are listed in <code>RubyLex::ENINDENT_CLAUSE</code></p> Ruby master - Bug #12980 (Closed): Time - Time to return a Rationalhttps://bugs.ruby-lang.org/issues/129802016-11-25T08:18:00Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>Currently subtracting a Time from a Time returns a Float, which I guess causes <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Incompatibility of a method signature between `Float#round` and `BigDecimal#round` (Closed)" href="https://bugs.ruby-lang.org/issues/12952">#12952</a></p>
<p>Is there any reason this doesn't return a Rational?</p> Ruby master - Bug #12930 (Closed): instance_eval, instance_exec raises TypeError on a frozen Stringhttps://bugs.ruby-lang.org/issues/129302016-11-13T21:43:00Zmatsuda (Akira Matsuda)ronnie@dio.jp
<pre><code>% ruby -ve 'p "".freeze.instance_eval "size"'
ruby 2.4.0dev (2016-11-13 trunk 56767) [x86_64-darwin15]
-e:1:in `instance_eval': can't define singleton (TypeError)
</code></pre>
<p>since 56747</p> Ruby master - Bug #11908 (Rejected): Tk still relies on safe level 3 and 4https://bugs.ruby-lang.org/issues/119082015-12-28T15:37:05Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>Tk uses safe level 3 and 4, which causes ArgumentError, because $SAFE >= 2 are no more supported in ruby >= 2.3.</p>
<p>To be honest, I'm not totally sure if it's "safe" enough to make this change, but at least it doesn't raise ArgumentError after this change.</p> Ruby master - Bug #11897 (Rejected): Hash key typo in Tkhttps://bugs.ruby-lang.org/issues/118972015-12-27T09:32:54Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>ext/tk/lib/tkextlib/blt/tree.rb: disctionary => dictionary</p> Ruby master - Bug #11896 (Rejected): Local variable name typo in Tkhttps://bugs.ruby-lang.org/issues/118962015-12-27T09:31:49Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>ext/tk/lib/tkextlib/pkg_checker.rb: sccess_list => success_list</p> Ruby master - Bug #11895 (Rejected): Method name typo in Tk (configure, configinfo)https://bugs.ruby-lang.org/issues/118952015-12-27T09:30:36Zmatsuda (Akira Matsuda)ronnie@dio.jp
<ul>
<li>ext/tk/lib/tkextlib/tcllib/crosshair.rb: confugure => configure</li>
<li>ext/tk/lib/tkextlib/tcllib/crosshair.rb: confuginfo => configinfo</li>
</ul> Ruby master - Bug #11894 (Rejected): Tk method name typo (sortcolumn, sortcolumnlist)https://bugs.ruby-lang.org/issues/118942015-12-27T09:28:46Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>ext/tk/lib/tkextlib/tcllib/tablelist_core.rb: sortcolum => sortcolumn<br>
ext/tk/lib/tkextlib/tcllib/tablelist_core.rb: sortcolumlist => sortcolumnlist</p> Ruby master - Bug #11893 (Closed): Ruby keyword typo in Tk (require)https://bugs.ruby-lang.org/issues/118932015-12-27T09:26:30Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>ext/tk/lib/tkextlib/tcllib/tablelist_tile.rb: requrie => require</p> Ruby master - Bug #11892 (Rejected): Ruby keyword typo in Tk (return)https://bugs.ruby-lang.org/issues/118922015-12-27T09:25:19Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>ext/tk/lib/tkextlib/iwidgets/tabset.rb: reutrn => return</p> Ruby master - Bug #11891 (Closed): Initializer method name typo in Tkhttps://bugs.ruby-lang.org/issues/118912015-12-27T09:23:56Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>ext/tk/lib/tkextlib/tcllib/toolbar.rb: initaialize => initialize</p> Ruby master - Bug #11890 (Closed): Initializer method name typo in Tkhttps://bugs.ruby-lang.org/issues/118902015-12-27T09:22:42Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>ext/tk/lib/tkextlib/blt/tree.rb: initialzie => initialize</p> Ruby master - Bug #11889 (Rejected): Constant name typo in Tkhttps://bugs.ruby-lang.org/issues/118892015-12-27T09:21:05Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>ext/tk/lib/tkextlib/blt/component.rb: LegenedID_TBL => LegendID_TBL</p> Ruby master - Bug #11888 (Rejected): Method name typo in Tkhttps://bugs.ruby-lang.org/issues/118882015-12-27T09:20:01Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>ext/tk/lib/tk/canvas.rb: kinad_of? => kind_of?</p> Ruby master - Bug #11887 (Rejected): Local variable name typo in Tkhttps://bugs.ruby-lang.org/issues/118872015-12-27T09:17:07Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>There's a variable name typo in ext/tk/lib/remote-tk.rb.<br>
I haven't actually run the code, but this shouldn't be working...</p> Ruby master - Bug #11886 (Closed): Font name typo in Tk library and sampleshttps://bugs.ruby-lang.org/issues/118862015-12-27T09:11:13Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>There are some occurrences of "Helvetia 12 bold".<br>
Shouldn't this be "Helvetica"?</p> Ruby master - Feature #11476 (Closed): Methods defined in Refinements cannot be called via sendhttps://bugs.ruby-lang.org/issues/114762015-08-22T00:04:59Zmatsuda (Akira Matsuda)ronnie@dio.jp
<pre><code>class C end
module M
refine C do
def a() p:hello end
def b() p:world end
end
end
using M
C.new.a
C.new.send :b
</code></pre>
<pre><code>% ruby -v t.rb
ruby 2.3.0dev (2015-08-22 trunk 51660) [x86_64-darwin14]
:hello
t.rb:13:in `<main>': undefined method `b' for #<C:0x007f86c9a12af0> (NoMethodError)
</code></pre> Ruby master - Bug #11425 (Closed): super_method fails to find the super method when combined with...https://bugs.ruby-lang.org/issues/114252015-08-09T20:10:34Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p><code>super_method</code> now fails to find the target method of <code>Module#prepend</code> maybe since <a class="changeset" title="test_exception.rb: fix message * test/ruby/test_exception.rb (test_full_message): fix method nam..." href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/51501137b173f66e3db6bd53f43ba8d87db36a4e">51501</a> <a href="https://github.com/ruby/ruby/commit/6b7c4df" class="external">https://github.com/ruby/ruby/commit/6b7c4df</a></p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">C</span><span class="p">;</span> <span class="k">def</span> <span class="nf">a</span><span class="p">()</span> <span class="k">end</span> <span class="k">end</span>
<span class="k">module</span> <span class="nn">M</span> <span class="k">def</span> <span class="nf">a</span><span class="p">()</span> <span class="k">end</span> <span class="k">end</span>
<span class="no">C</span><span class="p">.</span><span class="nf">prepend</span> <span class="no">M</span>
<span class="nb">p</span> <span class="no">C</span><span class="p">.</span><span class="nf">instance_method</span><span class="p">(</span><span class="ss">:a</span><span class="p">).</span><span class="nf">super_method</span>
</code></pre>
<pre><code>ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
#=> #<UnboundMethod: Object(C)#a>
ruby 2.3.0dev (2015-08-09 trunk 51513) [x86_64-darwin14]
#=> nil
</code></pre> Ruby master - Bug #11419 (Closed): super_method segfaults when looking for a super_method of Obje...https://bugs.ruby-lang.org/issues/114192015-08-06T08:02:43Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>This code segfaults on 2.3 trunk (does not segfault on 2.2 stable):</p>
<pre><code>% ruby -e 'Object.instance_method(:tap).super_method'
-e:1: [BUG] Segmentation fault at 0x00000000000010
ruby 2.3.0dev (2015-08-06 trunk 51500) [x86_64-darwin14]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
c:0003 p:---- s:0007 e:000006 CFUNC :super_method
c:0002 p:0015 s:0004 E:001a30 EVAL -e:1 [FINISH]
c:0001 p:0000 s:0002 E:001a10 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
-e:1:in `<main>'
-e:1:in `super_method'
-- Machine register context ------------------------------------------------
rax: 0x00007ff61b0e05d8 rbx: 0x00007ff61afddb40 rcx: 0x0000000000000000
rdx: 0x0000000000000000 rdi: 0x00007ff61c0aea28 rsi: 0x0000000101d95e18
rbp: 0x00007fff5e094100 rsp: 0x00007fff5e0940d0 r8: 0x00007ff61ac094c8
r9: 0x0000000000000dda r10: 0x0000000000000001 r11: 0x000000000000000d
r12: 0x00007ff61c0aea28 r13: 0x0000000101f8ff80 r14: 0x00007ff61c0aea28
r15: 0x00007ff61ac09120 rip: 0x0000000101bc0148 rfl: 0x0000000000010206
-- C level backtrace information -------------------------------------------
0 ruby 0x0000000101d06474 rb_vm_bugreport + 388
1 ruby 0x0000000101baf0a9 rb_bug_context + 473
2 ruby 0x0000000101c7faa3 sigsegv + 83
3 libsystem_platform.dylib 0x00007fff965cff1a _sigtramp + 26
4 ruby 0x0000000101bc0148 method_super_method + 40
5 ??? 0x0000000000000000 0x0 + 0
-- Other runtime information -----------------------------------------------
* Loaded script: -e
* Loaded features:
0 enumerator.so
1 rational.so
2 complex.so
3 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/x86_64-darwin14/enc/encdb.bundle
4 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/x86_64-darwin14/enc/trans/transdb.bundle
5 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/unicode_normalize.rb
6 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/x86_64-darwin14/rbconfig.rb
7 thread.rb
8 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/x86_64-darwin14/thread.bundle
9 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/compatibility.rb
10 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/defaults.rb
11 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/deprecate.rb
12 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/errors.rb
13 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/version.rb
14 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/requirement.rb
15 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/platform.rb
16 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/basic_specification.rb
17 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/stub_specification.rb
18 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/util/list.rb
19 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/x86_64-darwin14/stringio.bundle
20 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/specification.rb
21 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/exceptions.rb
22 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb
23 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/monitor.rb
24 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb
25 /Users/a_matsuda/.rbenv/versions/2.3.0-dev/lib/ruby/2.3.0/rubygems.rb
</code></pre>
<p>Not only :tap but other instance methods defined on Object such as :object_id, :clone also segfaults in the same way.</p>
<p>OTOH, these <strong>do not</strong> segfault.</p>
<pre><code>% ruby -e 'Object.new.method(:tap).super_method'
% ruby -e 'Object.instance_method(:==).super_method'
% ruby -e 'String.instance_method(:reverse).super_method'
% ruby -e 'Class.new { def foo() end }.instance_method(:foo).super_method'
</code></pre> Ruby master - Bug #11380 (Closed): Parser regression in 2.3?https://bugs.ruby-lang.org/issues/113802015-07-21T12:56:29Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>This code works with 2.2 but causes SyntaxError with 2.3.</p>
<pre><code>def foo(pr, options, &blk)
p pr.call
end
foo -> { :hello }, a: 1 do end
</code></pre>
<p>#=> t.rb:5: syntax error, unexpected keyword_do, expecting end-of-input</p> Ruby master - Bug #10288 (Closed): Parser incompatibility between 2.1.2 and 2.1.3https://bugs.ruby-lang.org/issues/102882014-09-24T01:34:04Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>This code successfully prints {:foo=>1} in 2.1.2 and current trunk but causes "syntax error, unexpected modifier_if" in 2.1.3</p>
<pre><code>p({foo: if true then 1 end})
</code></pre> Ruby master - Bug #10204 (Closed): A little bit misleading warning messagehttps://bugs.ruby-lang.org/issues/102042014-09-05T10:07:37Zmatsuda (Akira Matsuda)ronnie@dio.jp
<pre><code>ruby -we "''.scan //"
</code></pre>
<p>warns "-e:1: warning: ambiguous first argument; put parentheses or even spaces".<br>
Despite ruby indicates me to put spaces there, I actually couldn't stop ruby warning no matter how much spaces I put there.</p>
<pre><code>% ruby -we "''.scan //"
-e:1: warning: ambiguous first argument; put parentheses or even spaces
</code></pre> Ruby master - Bug #10151 (Closed): Weird result when % formatting a Rational valuehttps://bugs.ruby-lang.org/issues/101512014-08-19T11:01:55Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>Getting a strange output when formatting a Rational value in trunk.</p>
<p>% ruby -v -e 'p "%.1f" % 1.2r'<br>
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]<br>
"1.2"</p>
<p>% ruby -v -e 'p "%.1f" % 1.2r'<br>
ruby 2.2.0dev (2014-08-19 trunk 47220) [x86_64-darwin13]<br>
"6.0"</p>
<p>In this case 1.2r inspects into 6/5 and then the % takes its first letter, I guess?</p> Ruby master - Bug #10150 (Closed): Tiny URI.parse error incompatibilityhttps://bugs.ruby-lang.org/issues/101502014-08-19T10:02:12Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>When giving URI.parse an object that does't respond_to #to_str, Ruby 2.1 raises URI::InvalidURIError, whereas 2.2 raises NoMethodError.<br>
Is this change intentional?</p>
<p>% ruby -v -ruri -e "p URI.parse(1)"<br>
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]<br>
.../2.1.2/lib/ruby/2.1.0/uri/common.rb:176:in `split': bad URI(is not URI?): 1 (URI::InvalidURIError)</p>
<p>% ruby -v -ruri -e "p URI.parse(1)"<br>
ruby 2.2.0dev (2014-08-19 trunk 47220) [x86_64-darwin13]<br>
.../2.2.0-dev/lib/ruby/2.2.0/uri/rfc3986_parser.rb:9:in <code>split': undefined method </code>to_str' for 1:Fixnum (NoMethodError)</p> Ruby master - Feature #10095 (Closed): Object#ashttps://bugs.ruby-lang.org/issues/100952014-07-26T06:53:42Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>We've had so many times of feature requests for a method similar to <code>Object#tap</code> that doesn't return self but returns the given block's execution result (e.g. <a class="issue tracker-2 status-6 priority-4 priority-default closed" title="Feature: Object#embed (Rejected)" href="https://bugs.ruby-lang.org/issues/7388">#7388</a>, <a class="issue tracker-2 status-6 priority-4 priority-default closed" title="Feature: Object#do (Rejected)" href="https://bugs.ruby-lang.org/issues/6684">#6684</a>, <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Object#yield_self (Closed)" href="https://bugs.ruby-lang.org/issues/6721">#6721</a> ).</p>
<p>I'm talking about something like this in Ruby of course:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Object</span><span class="p">.</span><span class="nf">class_eval</span> <span class="p">{</span> <span class="k">def</span> <span class="nf">as</span><span class="p">()</span> <span class="k">yield</span><span class="p">(</span><span class="nb">self</span><span class="p">)</span> <span class="k">end</span> <span class="p">}</span>
</code></pre>
<p>IIRC Matz is not against introducing this feature but he didn't like any of the names proposed in the past, such as <code>embed</code>, <code>do</code>, <code>identity</code>, <code>ergo</code>, <code>reference</code>, <code>yield_self</code>, <code>itself</code>, <code>apply</code>, <code>map</code>, <code>tap!</code>, etc.</p>
<p>So, let us propose a new name, <code>Object#as</code> today.<br>
It's named from the aspect of the feature that it gives the receiver a new name "as" a block local variable.<br>
For instance, the code reads so natural and intuitive like this:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="mi">2</span> <span class="o">+</span> <span class="mi">3</span> <span class="o">+</span> <span class="mi">4</span><span class="p">).</span><span class="nf">as</span> <span class="p">{</span><span class="o">|</span><span class="n">x</span><span class="o">|</span> <span class="n">x</span> <span class="o">**</span> <span class="mi">2</span><span class="p">}</span>
<span class="o">=></span> <span class="mi">100</span>
<span class="no">Array</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">as</span> <span class="p">{</span><span class="o">|</span><span class="n">a</span><span class="o">|</span> <span class="n">a</span> <span class="o"><<</span> <span class="mi">1</span><span class="p">;</span> <span class="n">a</span> <span class="o"><<</span> <span class="mi">2</span><span class="p">}</span>
<span class="o">=></span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span>
</code></pre> Ruby master - Feature #10094 (Closed): Object#ashttps://bugs.ruby-lang.org/issues/100942014-07-26T06:36:33Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>We've had numbers of feature requests for a method similar to Object#tap that doesn't return self but returns the given block's execution result (e.g. <a class="issue tracker-2 status-6 priority-4 priority-default closed" title="Feature: Object#embed (Rejected)" href="https://bugs.ruby-lang.org/issues/7388">#7388</a>, <a class="issue tracker-2 status-6 priority-4 priority-default closed" title="Feature: Object#do (Rejected)" href="https://bugs.ruby-lang.org/issues/6684">#6684</a>, <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Object#yield_self (Closed)" href="https://bugs.ruby-lang.org/issues/6721">#6721</a> ).</p>
<p>I'm talking about something like this in Ruby of course:<br>
Object.class_eval { def as() yield(self) end }</p>
<p>IIRC Matz is not against introducing this feature but he didn't like any of the names proposed in the past, such as embed, do, identity, ergo, reference, yield_self, itself, apply, map, tap!, etc.</p>
<p>So, let us propose a new name, Object#as today.<br>
It's named from the aspect of the feature that it gives the receiver a new name "as" a block local variable.<br>
For instance, the code reads so natural and intuitive like this:</p>
<p>(1 + 2 + 3 + 4).as {|x| x ** 2}<br>
=> 100</p>
<p>Array.new.as {|a| a << 1; a << 2}<br>
=> [1, 2]</p> Ruby master - Bug #9236 (Closed): include + include + alias_method + super behaviour inconsistenc...https://bugs.ruby-lang.org/issues/92362013-12-11T00:19:24Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>=begin<br>
The following code behaves differently under Ruby 1 and Ruby 2.</p>
<p>module Fun<br>
def hello<br>
orig_hello<br>
end<br>
end</p>
<p>module M1<br>
def hello<br>
p 'hello!'<br>
end<br>
end</p>
<p>module M2<br>
def hello<br>
super<br>
end<br>
end</p>
<p>class Foo<br>
include M1<br>
include M2</p>
<pre><code>alias_method :orig_hello, :hello
include Fun
</code></pre>
<p>end</p>
<p>Foo.new.hello</p>
<p>% ruby -v fun.rb<br>
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-darwin12.5.0]<br>
"hello!"</p>
<p>% ruby -v fun.rb<br>
ruby 2.1.0dev (2013-12-10 trunk 44126) [x86_64-darwin12.0]<br>
fun.rb:3: stack level too deep (SystemStackError)</p>
<p>Let's see if this is an intended spec change or a bug.</p>
<p>(('#')) This issue was originally reported to ((<Rails Core ML by Gary Weaver|URL:<a href="https://groups.google.com/forum/#!topic/rubyonrails-core/z5Japo3oIzk%3E" class="external">https://groups.google.com/forum/#!topic/rubyonrails-core/z5Japo3oIzk></a>)).<br>
=end</p> Ruby master - Bug #9183 (Closed): IRB::Localeの属性名にtypohttps://bugs.ruby-lang.org/issues/91832013-11-30T03:12:43Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>IRB::Localeクラス内に、@modifier というインスタンス変数があるのですが、attr_reader が :modifieer とtypoしています。<br>
この必ずnilを返す属性を使っていた人が居るとも思えないので、添付のパッチのように単に :modifier に直すだけで良いように思いますが、念のためパブリックAPIを保持したければ以下のメソッドも追加しておくぐらいでしょうか…。</p>
<pre><code>def modifieer
@modifier
end
</code></pre> Ruby master - Bug #9180 (Closed): Typo in FileUtils' method namehttps://bugs.ruby-lang.org/issues/91802013-11-30T00:28:19Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>I found a method name typo in FileUtils.<br>
Since this Entry_ class is only for internal use, maybe it's OK to just rename the method with the attached patch?</p> Ruby master - Bug #9165 (Closed): IRBのコード中にtypohttps://bugs.ruby-lang.org/issues/91652013-11-27T17:46:34Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>IRBのコード内にtypoを見つけました。<br>
明らかにケアレスミスっぽいので添付のパッチをコミットしちゃって良いでしょうか?</p> Ruby master - Feature #8846 (Closed): Publicize Module#includehttps://bugs.ruby-lang.org/issues/88462013-08-31T14:15:47Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>I propose changing Module#include to a public method.</p>
<ul>
<li>
<p>Background<br>
Module#include is currently a private method.<br>
However, the method is actually quite often used (particularly by gem library authors) for appending some features from outside of the target module, such as:</p>
<p>ActiveRecord::Base.send :include, MyPagination</p>
</li>
<li>
<p>Use case<br>
% cd rails<br>
% git grep "send[ (]:include," | wc -l<br>
45</p>
</li>
</ul> Ruby master - Feature #7251 (Closed): using usings in usinged Modulehttps://bugs.ruby-lang.org/issues/72512012-10-31T20:41:52Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>I suspect Kernel#using to using all the already usinged Refinements in usinged Module. For example:</p>
<p>module X<br>
refine Fixnum do<br>
def foo; p :foo; end<br>
end<br>
end</p>
<p>module Y<br>
refine Fixnum do<br>
def bar; p :bar; end<br>
end<br>
end</p>
<p>module Z<br>
using X<br>
using Y<br>
end</p>
<p>class Foo<br>
using Z<br>
p 1.foo<br>
p 1.bar<br>
end</p>
<p>(original gist here: <a href="https://gist.github.com/3985735" class="external">https://gist.github.com/3985735</a> )</p> Ruby master - Bug #2291 (Closed): Net::FTPでソケットをオープンする前にbinary=を呼び出すと落ちるhttps://bugs.ruby-lang.org/issues/22912009-10-27T21:23:24Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>=begin<br>
% cat ftp_binary.rb<br>
require 'net/ftp'<br>
f = Net::FTP.new<br>
f.binary = true</p>
<p>% ruby ftp_binary.rb<br>
/Users/matsuda/ruby_trunk/lib/ruby/1.9.1/net/ftp.rb:224:in <code>putline': undefined method </code>write' for nil:NilClass (NoMethodError)<br>
from /Users/matsuda/ruby_trunk/lib/ruby/1.9.1/net/ftp.rb:291:in <code>block in voidcmd' from /Users/matsuda/ruby_trunk/lib/ruby/1.9.1/monitor.rb:190:in </code>mon_synchronize'<br>
from /Users/matsuda/ruby_trunk/lib/ruby/1.9.1/net/ftp.rb:290:in <code>voidcmd' from /Users/matsuda/ruby_trunk/lib/ruby/1.9.1/net/ftp.rb:146:in </code>binary='<br>
from ftp_binary.rb:3:in `'<br>
=end</p> Backport187 - Backport #1915 (Closed): const_defined?の1.9との挙動の違いについてhttps://bugs.ruby-lang.org/issues/19152009-08-09T08:03:52Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>=begin<br>
以下の場合に<br>
% cat const_defined.rb<br>
class Alpha<br>
class Beta; end<br>
end</p>
<p>class Gamma < Alpha; end</p>
<p>puts Gamma::const_get('Alpha')</p>
<p>puts Gamma::const_defined?('Alpha')</p>
<p>1.8と1.9ではそれぞれこうなります。<br>
% ruby18 -v<br>
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]<br>
% ruby18 const_defined.rb<br>
Alpha<br>
false<br>
% ruby19 -v<br>
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-darwin9.7.0]<br>
% ruby19 const_defined.rb<br>
Alpha<br>
true</p>
<p>1.9から仕様が変更されたということなのかな、と思うのですが、これは1.8.xにバックポートされる予定はあるのでしょうか?<br>
=end</p> Ruby master - Bug #1788 (Closed): ある種のメソッドをalias_methodしようとすると落ちるhttps://bugs.ruby-lang.org/issues/17882009-07-19T10:57:00Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>=begin<br>
Ruby 1.9.2 preview1で Ruby on RailsのActiveSupportのtry.rbをロードすると異常終了します。</p>
<p>再現コードはこんな感じです。<br>
class Object<br>
def try(method, *args, &block)<br>
send(method, *args, &block)<br>
end<br>
remove_method :try<br>
alias_method :try, :<strong>send</strong><br>
end</p>
<p>エラー内容は以下のとおりです。</p>
<p>/Users/matsuda/ruby_192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/try.rb:29: [BUG] rb_add_method: unsupported method type (8)</p>
<p>ruby 1.9.2dev (2009-07-18 trunk 24186) [i386-darwin9.7.0]</p>
<p>-- control frame ----------<br>
c:0036 p:---- s:0101 b:0101 l:000100 d:000100 CFUNC :alias_method<br>
c:0035 p:0044 s:0096 b:0096 l:000095 d:000095 CLASS /Users/matsuda/ruby_192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/try.rb:29<br>
c:0034 p:0009 s:0094 b:0094 l:000093 d:000093 TOP /Users/matsuda/ruby_192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext/try.rb:1<br>
c:0033 p:---- s:0092 b:0092 l:000091 d:000091 FINISH<br>
c:0032 p:---- s:0090 b:0090 l:000089 d:000089 CFUNC :require<br>
c:0031 p:0040 s:0086 b:0086 l:000076 d:000085 BLOCK /Users/matsuda/ruby_192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext.rb:3<br>
c:0030 p:---- s:0082 b:0082 l:000081 d:000081 FINISH<br>
c:0029 p:---- s:0080 b:0080 l:000079 d:000079 CFUNC :each<br>
c:0028 p:0040 s:0077 b:0077 l:000076 d:000076 TOP /Users/matsuda/ruby_192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support/core_ext.rb:1<br>
c:0027 p:---- s:0075 b:0075 l:000074 d:000074 FINISH<br>
c:0026 p:---- s:0073 b:0073 l:000072 d:000072 CFUNC :require<br>
c:0025 p:0033 s:0069 b:0069 l:000068 d:000068 TOP /Users/matsuda/ruby_192/lib/ruby/gems/1.9.1/gems/activesupport-2.3.2/lib/active_support.rb:55<br>
c:0024 p:---- s:0067 b:0067 l:000066 d:000066 FINISH<br>
c:0023 p:---- s:0065 b:0065 l:000064 d:000064 CFUNC :require<br>
c:0022 p:0075 s:0061 b:0061 l:001544 d:001544 TOP /Users/matsuda/ruby_192/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/tasks/misc.rake:18<br>
c:0021 p:---- s:0059 b:0059 l:000058 d:000058 FINISH<br>
c:0020 p:---- s:0057 b:0057 l:000056 d:000056 CFUNC :load<br>
c:0019 p:0012 s:0053 b:0053 l:000044 d:000052 BLOCK /Users/matsuda/ruby_192/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/tasks/rails.rb:4<br>
c:0018 p:---- s:0050 b:0050 l:000049 d:000049 FINISH<br>
c:0017 p:---- s:0048 b:0048 l:000047 d:000047 CFUNC :each<br>
c:0016 p:0043 s:0045 b:0045 l:000044 d:000044 TOP /Users/matsuda/ruby_192/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/tasks/rails.rb:4<br>
c:0015 p:---- s:0043 b:0043 l:000042 d:000042 FINISH<br>
c:0014 p:---- s:0041 b:0041 l:000040 d:000040 CFUNC :require<br>
c:0013 p:0089 s:0037 b:0037 l:000036 d:000036 TOP /Users/matsuda/work/src/rails/192/Rakefile:10<br>
c:0012 p:---- s:0035 b:0035 l:000034 d:000034 FINISH<br>
c:0011 p:---- s:0033 b:0033 l:000032 d:000032 CFUNC :load<br>
c:0010 p:0335 s:0029 b:0029 l:000028 d:000028 METHOD /Users/matsuda/ruby_192/lib/ruby/1.9.1/rake.rb:2348<br>
c:0009 p:0009 s:0024 b:0024 l:000017 d:000023 BLOCK /Users/matsuda/ruby_192/lib/ruby/1.9.1/rake.rb:1982<br>
c:0008 p:0009 s:0022 b:0022 l:000021 d:000021 METHOD /Users/matsuda/ruby_192/lib/ruby/1.9.1/rake.rb:2033<br>
c:0007 p:0011 s:0018 b:0018 l:000017 d:000017 METHOD /Users/matsuda/ruby_192/lib/ruby/1.9.1/rake.rb:1981<br>
c:0006 p:0019 s:0015 b:0015 l:000008 d:000014 BLOCK /Users/matsuda/ruby_192/lib/ruby/1.9.1/rake.rb:1965<br>
c:0005 p:0009 s:0013 b:0013 l:000012 d:000012 METHOD /Users/matsuda/ruby_192/lib/ruby/1.9.1/rake.rb:2033<br>
c:0004 p:0011 s:0009 b:0009 l:000008 d:000008 METHOD /Users/matsuda/ruby_192/lib/ruby/1.9.1/rake.rb:1963<br>
c:0003 p:0036 s:0006 b:0006 l:001f64 d:000454 EVAL /Users/matsuda/bin/rake:31<br>
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH<br>
c:0001 p:0000 s:0002 b:0002 l:001f64 d:001f64 TOP<br>
=end</p> Ruby master - Feature #1159 (Rejected): StringScanner に文字ベースでのインデックスを返すメソッドがほしいhttps://bugs.ruby-lang.org/issues/11592009-02-14T16:34:13Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>=begin<br>
松田と申します。</p>
<p>Ruby 1.9の StringScanner#pos (pointer) が現在はバイト単位<br>
でのインデックスを返してくれるのですが、<br>
文字列ベースでのインデックスを返すメソッドが欲しい、<br>
または、posが文字列ベースでのインデックスを返すように<br>
変更して欲しいです。<br>
=end</p> Ruby master - Bug #555 (Closed): method_missing in Gem module removes some necessary methodshttps://bugs.ruby-lang.org/issues/5552008-09-10T06:54:21Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>=begin<br>
I found something strange in Ruby 1.9 bundled Rubygems(gem_prelude.rb).</p>
<p>(1) there's a method named default_dir in Gem module, which returns a certain directory name<br>
Gem.default_dir<br>
#=> "/Users/matsuda/ruby/lib/ruby/gems/1.9.0"</p>
<p>(2) call a missing method on Gem module to make a method_missing call<br>
Gem.foo<br>
NoMethodError: undefined method <code>foo' for Gem:Module from gem_prelude.rb:192:in </code>method_missing'<br>
from (irb):12<br>
from /Users/matsuda/ruby/bin/irb19:12:in `'</p>
<p>(3) method_missing undefs Gem::GEM_PRELUDE_METHODS.each methods inside Gem.method_missing -> QuickLoader.load_full_rubygems_library</p>
<p>(4) Gem.default_dir still alives<br>
Gem.default_dir<br>
#=> "/Users/matsuda/ruby/lib/ruby/gems/1.9.0"</p>
<p>(5) invoke method_missing again<br>
Gem.foo<br>
/Users/matsuda/ruby/lib/ruby/1.9.0/rubygems.rb:82: warning: already initialized constant MUTEX<br>
/Users/matsuda/ruby/lib/ruby/1.9.0/rubygems.rb:84: warning: already initialized constant RubyGemsPackageVersion<br>
/Users/matsuda/ruby/lib/ruby/1.9.0/rubygems.rb:89: warning: already initialized constant WIN_PATTERNS<br>
/Users/matsuda/ruby/lib/ruby/1.9.0/rubygems.rb:742: warning: already initialized constant MARSHAL_SPEC_DIR<br>
/Users/matsuda/ruby/lib/ruby/1.9.0/rubygems.rb:744: warning: already initialized constant YAML_SPEC_DIR<br>
NoMethodError: undefined method <code>foo' for Gem:Module from gem_prelude.rb:192:in </code>method_missing'<br>
from (irb):14<br>
from /Users/matsuda/ruby/bin/irb19:12:in `'</p>
<p>(6) Gem.default_dir disappears!<br>
Gem.default_dir<br>
NameError: undefined method <code>default_dir' for </code>Gem'<br>
from gem_prelude.rb:78:in <code>undef_method' from gem_prelude.rb:78:in </code>block in singletonclass'<br>
from gem_prelude.rb:77:in <code>each' from gem_prelude.rb:77:in </code>singletonclass'<br>
from gem_prelude.rb:76:in <code>load_full_rubygems_library' from gem_prelude.rb:191:in </code>method_missing'<br>
from (irb):15<br>
from /Users/matsuda/ruby/bin/irb19:12:in `'</p>
<p>I noticed that some gems don't work well on Ruby 1.9 because of this behavior.</p>
<p>Ruby version: revision 19146<br>
gem -v: 1.2.0.1824<br>
=end</p> Ruby master - Bug #369 (Closed): Ruby 1.9でRailsのactionpackのテストの終了時にSEGVhttps://bugs.ruby-lang.org/issues/3692008-07-29T18:28:53Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>=begin<br>
松田と申します。</p>
<p>Ruby1.9にてRuby on Railsの中のactionpackのテストを走らせると、終了後にcoreを吐きながらアボートします。<br>
Rubyのバージョンは1.9.0-3で、Railsはgitリポジトリ上の報告時現在のedgeバージョンにて再現可能です。<br>
また、OSはOSX LeopardおよびDebian etchにて再現済みです。</p>
<p>再現手順およびエラー内容については、こちらの後半部分をご参照ください。<br>
((<a href="URL:http://qwik.jp/asakusarb/001_log.html" class="external">URL:http://qwik.jp/asakusarb/001_log.html</a>))</p>
<p>もう少し詳細な切り分けをしたいところなのですが、特定のテストケース内ではなくてテストが全て正常終了した後の終了処理で落ちているようで、素人にはこれ以上の切り分けは難しく、ささださんと中田さんに見ていただいたところ、このままで上げてしまって良いとのことだったので、ひとまずこのような形で報告させて頂きます。<br>
=end</p>