Ruby Issue Tracking System: Issues
https://redmine.ruby-lang.org/
https://redmine.ruby-lang.org/favicon.ico?1711330511
2022-01-26T01:45:13Z
Ruby Issue Tracking System
Redmine
Ruby master - Bug #18514 (Closed): ruby 2.6.9's Date#jisx0301 does not support Reiwa
https://redmine.ruby-lang.org/issues/18514
2022-01-26T01:45:13Z
kouji (Kouji Takao)
kouji.takao@gmail.com
<p>In ruby 2.6.9 (ruby 2.6.9p207 (2021-11-24 revision 67954) [x86_64-darwin20]).<br>
$ ruby -rdate -e 'p Date.new(2019, 5, 1).jisx0301'<br>
=> "H31.05.01"</p>
<p>In ruby 2.6.6 and 2.7.5.<br>
=> "R01.05.01"</p>
<p>ruby 2.6.9's Date#jisx0301does not support Reiwa.<br>
<a href="https://github.com/ruby/ruby/blob/8e26731f9ef529009928628ba4b79fd2454e8e2d/ext/date/date_core.c#L7193" class="external">https://github.com/ruby/ruby/blob/8e26731f9ef529009928628ba4b79fd2454e8e2d/ext/date/date_core.c#L7193</a></p>
<p>However, ruby 2.6.8's supports Reiwa.<br>
<a href="https://github.com/ruby/ruby/blob/768423edc2634574d66f14f3c2d3602326bfb464/ext/date/date_core.c#L7046" class="external">https://github.com/ruby/ruby/blob/768423edc2634574d66f14f3c2d3602326bfb464/ext/date/date_core.c#L7046</a></p>
<p>diff</p>
<pre><code>--- 2.6.8.c 2022-01-26 10:42:49.000000000 +0900
+++ 2.6.9.c 2022-01-26 10:43:57.000000000 +0900
@@ -19,14 +19,10 @@
c = 'S';
s = 1925;
}
- else if (d < 2458605) {
+ else {
c = 'H';
s = 1988;
}
- else {
- c = 'R';
- s = 2018;
- }
snprintf(fmt, size, "%c%02ld" ".%%m.%%d", c, FIX2INT(y) - s);
return fmt;
}
</code></pre>
<p>So, I think it's a degradation.</p>
Ruby master - Feature #1095 (Closed): Readline.completion_proc = nil を許可する。
https://redmine.ruby-lang.org/issues/1095
2009-02-03T14:57:40Z
kouji (Kouji Takao)
kouji.takao@gmail.com
<p>=begin<br>
高尾宏治です。</p>
<p>Readline.readlineの補完候補を取得する Proc を Readline.completion_proc= で指定できます。<br>
しかし、補完候補を取得する処理をデフォルトのものに戻す方法がありません。<br>
Readline.completion_proc に nil をセットできればデフォルトの挙動になるので、<br>
それを許可しようと思います。以下のような記述ができるようになります。</p>
<p>begin<br>
Readline.completion_proc = Proc.new { |s|<br>
...<br>
}<br>
s = Readline.readline<br>
ensure<br>
Readline.completion_proc = nil<br>
end</p>
<p>現在は、Readline.completion_proc= メソッドの中で、<br>
引き数で指定されたオブジェクトが call メソッドをもっているかどうかチェックしているので、</p>
<p>Readline.completion_proc = nil</p>
<p>で ArgumentError 例外が発生します。<br>
nilの場合は特別扱いして、completion_proc に代入できるようにしようと思います。<br>
いかがでしょうか。</p>
<a name="Index-readlinec"></a>
<h1 >Index: readline.c<a href="#Index-readlinec" class="wiki-anchor">¶</a></h1>
<p>--- readline.c (revision 21997)<br>
+++ readline.c (working copy)<br>
@@ -304,6 +304,8 @@</p>
<ul>
<li>should take input-string, and return an array of completion</li>
<li>candidates.</li>
<li>
</ul>
<ul>
<li>
<ul>
<li>Set default if +proc+ is nil.</li>
</ul>
</li>
<li>
<ul>
<li>
<li>Raises ArgumentError exception if +proc+ does not respond to call method.</li>
<li>
<li>Raises SecurityError exception if $SAFE is 4.<br>
@@ -312,7 +314,7 @@<br>
readline_s_set_completion_proc(VALUE self, VALUE proc)<br>
{<br>
rb_secure(4);</li>
</ul>
</li>
</ul>
<ul>
<li>if (!rb_respond_to(proc, rb_intern("call")))</li>
</ul>
<ul>
<li>if (!NIL_P(proc) && !rb_respond_to(proc, rb_intern("call")))<br>
rb_raise(rb_eArgError, "argument must respond to `call'");<br>
return rb_ivar_set(mReadline, completion_proc, proc);<br>
}<br>
=end</li>
</ul>
Ruby master - Bug #1085 (Closed): Got the error message, after run 'gem install --test'.
https://redmine.ruby-lang.org/issues/1085
2009-02-01T22:26:23Z
kouji (Kouji Takao)
kouji.takao@gmail.com
<p>=begin<br>
Hi, Ryan.</p>
<p>I use ruby 1.9.1p5000 (2009-01-31 trunk 21924) [i386-darwin9.6.0].<br>
I got the error message, after I run 'gem install --test '.</p>
<p>ERROR: While executing gem ... (NoMethodError)<br>
undefined method `passed?' for #<a href="MiniTest::Unit:0x77d1fc" class="external">MiniTest::Unit:0x77d1fc</a></p>
<p>The source of the problem is called MiniTest::Unit#passed? at<br>
lib/rubygems/commands/install_command.rb:136.</p>
<p>The attached patch will fix the problem.</p>
<a name="Index-unitrb"></a>
<h1 >Index: unit.rb<a href="#Index-unitrb" class="wiki-anchor">¶</a></h1>
<p>--- unit.rb (revision 21924)<br>
+++ unit.rb (working copy)<br>
@@ -429,6 +429,10 @@<br>
[@test_count, @assertion_count]<br>
end</p>
<ul>
<li>def passed?</li>
<li>
<pre><code> return (failures + errors) == 0
</code></pre>
</li>
<li>end</li>
<li>class TestCase<br>
attr_reader :name<br>
=end</li>
</ul>
Ruby master - Bug #1016 (Closed): Raises LocalJump exception in MiniTest::Unit.autorun.
https://redmine.ruby-lang.org/issues/1016
2009-01-15T19:31:15Z
kouji (Kouji Takao)
kouji.takao@gmail.com
<p>=begin<br>
Hi Ryan,</p>
<h2>If $! is not nil, returns in the block of the at_exit method in<br>
MiniTest::Unit.autorun. Then raises LocalJump exception.</h2>
<h2>def self.autorun<br>
at_exit {<br>
return if $! # don't run if there was an exception<br>
exit_code = MiniTest::Unit.new.run(ARGV)<br>
exit false if exit_code && exit_code != 0<br>
} unless @@installed_at_exit<br>
@@installed_at_exit = true<br>
end</h2>
<p>The attached patch will fix the problem.</p>
<a name="Index-libminitestunitrb"></a>
<h1 >Index: lib/minitest/unit.rb<a href="#Index-libminitestunitrb" class="wiki-anchor">¶</a></h1>
<p>--- lib/minitest/unit.rb (revision 21508)<br>
+++ lib/minitest/unit.rb (working copy)<br>
@@ -325,7 +325,7 @@</p>
<pre><code> def self.autorun
at_exit {
</code></pre>
<ul>
<li>
<pre><code> return if $! # don't run if there was an exception
</code></pre>
</li>
</ul>
<ul>
<li>
<pre><code> next if $! # don't run if there was an exception
exit_code = MiniTest::Unit.new.run(ARGV)
exit false if exit_code && exit_code != 0
} unless @@installed_at_exit
</code></pre>
</li>
</ul>
<p>Thanks, kouji.<br>
=end</p>
Ruby master - Feature #916 (Closed): Curses.crmodeとCurses.nocrmodeをモジュール関数に変更する
https://redmine.ruby-lang.org/issues/916
2008-12-22T23:07:03Z
kouji (Kouji Takao)
kouji.takao@gmail.com
<p>=begin<br>
高尾宏治です。</p>
<p>Curses.cbreak は Curses.crmode に alias してあります。<br>
また、Curses.nocbreak も同様に Curses.nocrmode に alias してあります。<br>
このため、Curses モジュールを include した場合にしか<br>
Curses.crmode と Curses.nocrmode を利用できないようです。</p>
<p>require "curses"<br>
include Curses</p>
<p>cbreak #=> OK<br>
Curses.cbreak #=> OK</p>
<p>crmode # => OK<br>
Curses.crmode #=> 例外 NoMethodError</p>
<p>Curses.crmode と Curses.nocrmode を alias ではなくモジュール関数として<br>
定義したいのですが、いかがでしょうか。</p>
<a name="Index-cursesc"></a>
<h1 >Index: curses.c<a href="#Index-cursesc" class="wiki-anchor">¶</a></h1>
<p>--- curses.c (revision 20900)<br>
+++ curses.c (working copy)<br>
@@ -1498,8 +1498,8 @@<br>
rb_define_module_function(mCurses, "noraw", curses_noraw, 0);<br>
rb_define_module_function(mCurses, "cbreak", curses_cbreak, 0);<br>
rb_define_module_function(mCurses, "nocbreak", curses_nocbreak, 0);</p>
<ul>
<li>rb_define_alias(mCurses, "crmode", "cbreak");</li>
<li>rb_define_alias(mCurses, "nocrmode", "nocbreak");</li>
</ul>
<ul>
<li>rb_define_module_function(mCurses, "crmode", curses_nocbreak, 0);</li>
<li>rb_define_module_function(mCurses, "nocrmode", curses_nocbreak, 0);<br>
rb_define_module_function(mCurses, "nl", curses_nl, 0);<br>
rb_define_module_function(mCurses, "nonl", curses_nonl, 0);<br>
rb_define_module_function(mCurses, "beep", curses_beep, 0);<br>
=end</li>
</ul>
Backport187 - Backport #915 (Closed): threadのQueue#popでまっているときにTimeout.timeoutによるタイムアウトが発生したあとQue...
https://redmine.ruby-lang.org/issues/915
2008-12-22T16:14:51Z
kouji (Kouji Takao)
kouji.takao@gmail.com
<p>=begin<br>
thread の Queue#pop でキューへの追加をまっているときに、<br>
Timeout.timeout によるタイムアウトが発生したときの挙動がrubyのバージョンによって異なり、<br>
以下のようになりました。</p>
<ul>
<li>1.8.5 と 1.9 は同じ</li>
<li>1.8.6 と 1.8.7 は同じ</li>
<li>1.8ブランチの最新(r20895) はどれとも違う</li>
</ul>
<p>なお、動作を確認した環境は Debian GNU/Linux 4.0(Etch) です。</p>
<p>----- timeout.rb: ここから -----<br>
require "timeout"<br>
require "thread"</p>
<p>queue = Queue.new<br>
t = Thread.start {<br>
begin<br>
sleep(1000)<br>
rescue Exception<br>
end<br>
}</p>
<p>begin<br>
Timeout.timeout(2) do<br>
puts "waiting pop..."<br>
queue.pop<br>
end<br>
rescue Timeout::Error<br>
p $!<br>
end</p>
<p>puts "pushing..."<br>
queue.push(1)<br>
puts "pushed."</p>
<p>puts "poping..."<br>
p queue.pop<br>
puts "poped."</p>
<p>t.raise(Exception)<br>
t.join<br>
----- timeout.rb: ここまで -----</p>
<p>----- 実行結果: ここから -----<br>
havana$ ruby -v ~/work/acts/Infocast-EAR/work/timeout.rb<br>
ruby 1.8.5 (2006-08-25) [i486-linux]<br>
waiting pop...<br>
#<Timeout::Error: execution expired><br>
pushing...<br>
pushed.<br>
poping...<br>
1<br>
poped.</p>
<p>havana$ ~/local/ruby_1_8_6/bin/ruby186 -v ~/work/acts/Infocast-EAR/work/timeout.rb<br>
ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux]<br>
waiting pop...<br>
#<Timeout::Error: execution expired><br>
pushing...<br>
(ここでささる)</p>
<p>havana$ ~/local/ruby_1_8_7/bin/ruby187 -v ~/work/acts/Infocast-EAR/work/timeout.rb<br>
ruby 1.8.7 (2008-11-11 patchlevel 73) [i686-linux]<br>
waiting pop...<br>
#<Timeout::Error: execution expired><br>
pushing...<br>
(ここでささる)</p>
<p>havana$ ~/local/ruby_1_8/bin/ruby18 -v ~/work/acts/Infocast-EAR/work/timeout.rb<br>
ruby 1.8.7 (2008-12-21 revision 20895) [i686-linux]<br>
waiting pop...<br>
#<Timeout::Error: execution expired><br>
pushing...<br>
/home/kouji/work/acts/Infocast-EAR/work/timeout.rb:22:in `push': thread 0xb7dca160 tried to join itself (ThreadError)<br>
from /home/kouji/work/acts/Infocast-EAR/work/timeout.rb:22</p>
<p>havana$ ruby19trunk -v ~/work/acts/Infocast-EAR/work/timeout.rb<br>
ruby 1.9.0 (2008-08-01 revision 18308) [i686-linux]<br>
waiting pop...<br>
#<Timeout::Error: execution expired><br>
pushing...<br>
pushed.<br>
poping...<br>
1<br>
poped.<br>
----- 実行結果: ここまで -----<br>
=end</p>
Ruby master - Bug #862 (Closed): r20625 default_internal is nil.
https://redmine.ruby-lang.org/issues/862
2008-12-13T00:55:23Z
kouji (Kouji Takao)
kouji.takao@gmail.com
<p>=begin<br>
高尾宏治です。</p>
<p>trunk の r20625 以降、コマンドラインオプションで渡した<br>
default_internal が nil になっています。</p>
<p>$ svn up -r20624 && make && ./ruby -Eutf-8:utf-8 -e 'p([Encoding.default_external, Encoding.default_internal])'<br>
[#<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a>, #<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a>]</p>
<p>$ svn up -r20624 && make && ./ruby -Eutf-8:utf-8 -e 'p([Encoding.default_external, Encoding.default_internal])'<br>
[#<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a>, nil]</p>
<p>調べたところ、コマンドラインオプションの default_internal を適切に処理したあとで、<br>
shebang の default_internal を解析します。<br>
そして、shebang に default_internal の指定がなかった場合、<br>
強制的に default_internal に nil を設定しているようです。<br>
r20624 までは、default_internal を再設定できなかったため問題なかったようです。</p>
<p>以下の修正で手元では問題が解決しています。</p>
<a name="Index-rubyc"></a>
<h1 >Index: ruby.c<a href="#Index-rubyc" class="wiki-anchor">¶</a></h1>
<p>--- ruby.c (revision 20679)<br>
+++ ruby.c (working copy)<br>
@@ -1244,7 +1244,7 @@<br>
enc = rb_enc_from_index(opt->intern.enc.index);<br>
rb_enc_set_default_internal(rb_enc_from_encoding(enc));<br>
}</p>
<ul>
<li>else</li>
</ul>
<ul>
<li>else if (!rb_default_internal_encoding())<br>
/* Freeze default_internal */<br>
rb_enc_set_default_internal(Qnil);<br>
=end</li>
</ul>
Ruby master - Bug #452 (Closed): config.guess returns "i386" on Mac OSX 10.5.4.
https://redmine.ruby-lang.org/issues/452
2008-08-17T14:42:51Z
kouji (Kouji Takao)
kouji.takao@gmail.com
<p>=begin<br>
高尾宏治です。</p>
<p>trunk の r18741 で修正された config.guess が、<br>
Mac OSX 10.5.4 の環境で「i386-apple-darwin9.4.0」を返します。<br>
r18741 より前は「i686-apple-darwin9.4.0」を返していました。</p>
<p>$ sh config.guess<br>
i386-apple-darwin9.4.0</p>
<p>$ sh config.guess.r18470<br>
i686-apple-darwin9.4.0</p>
<p>r18470 までのものは、Intel Mac であれば i686 にしていたようです。</p>
<p><em>:Darwin:</em>:*)<br>
case <code>uname -p</code> in<br>
*86) UNAME_PROCESSOR=i686 ;;<br>
powerpc) UNAME_PROCESSOR=powerpc ;;</p>
<p>config.guess を修正すれば対応できますが、<br>
影響範囲が分かっていません。</p>
<p>この挙動がバグがどうかは判断できていませんが、報告をしておきます。<br>
=end</p>