Ruby Issue Tracking System: Issues
https://bugs.ruby-lang.org/
https://bugs.ruby-lang.org/favicon.ico?1711330511
2015-12-19T16:27:22Z
Ruby Issue Tracking System
Redmine
Ruby master - Bug #11847 (Closed): Install error on Linux NFS system
https://bugs.ruby-lang.org/issues/11847
2015-12-19T16:27:22Z
ohai (Ippei Obayashi)
<p>When I tried to install ruby 2.2.4 using rbenv and ruby-build, I encountered the following error.</p>
<pre><code>installing bundle gems: /home/ohai/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0 (build_info, cache, doc, extensions, gems, specifications)
/tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:369:in `initialize': Permission denied @ rb_sysopen - /home/ohai/.rbenv/versions/2.2.4/lib/ruby/gems/
2.2.0/gems/minitest-5.4.3/History.txt (Errno::EACCES)
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:369:in `open'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:369:in `block (2 levels) in extract_tar_gz'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package/tar_reader.rb:64:in `each'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:351:in `block in extract_tar_gz'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:442:in `block in open_tar_gz'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:439:in `wrap'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:439:in `open_tar_gz'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:350:in `extract_tar_gz'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:331:in `block (2 levels) in extract_files'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package/tar_reader.rb:64:in `each'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:328:in `block in extract_files'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package/file_source.rb:29:in `open'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package/file_source.rb:29:in `with_read_io'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/package.rb:325:in `extract_files'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/installer.rb:722:in `extract_files'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/installer.rb:248:in `install'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/resolver/specification.rb:96:in `install'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/request_set.rb:257:in `block in install_into'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/request_set.rb:249:in `each'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/request_set.rb:249:in `install_into'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/request_set.rb:141:in `install'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems/dependency_installer.rb:394:in `install'
from /tmp/ruby-build.20151220001431.25277/ruby-2.2.4/lib/rubygems.rb:558:in `install'
from ./tool/rbinstall.rb:722:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:721:in `each'
from ./tool/rbinstall.rb:721:in `block in <main>'
from ./tool/rbinstall.rb:757:in `call'
from ./tool/rbinstall.rb:757:in `block in <main>'
from ./tool/rbinstall.rb:754:in `each'
from ./tool/rbinstall.rb:754:in `<main>'
uncommon.mk:246: recipe for target 'do-install-all' failed
make: *** [do-install-all] Error 1
</code></pre>
<p>This problem is solved by applying the following change on rubygems:<br>
<a href="https://github.com/rubygems/rubygems/commit/0a76e13645e990c48491c4c555fe9f7adcc1e552" class="external">https://github.com/rubygems/rubygems/commit/0a76e13645e990c48491c4c555fe9f7adcc1e552</a><br>
As the issue related to the above commit says, I use NFS on Linux.</p>
<p>Probably this problem is already solved on ruby-trunk since the change is merged into ruby-trunk.<br>
I hope the problem will be fixed on 2.2.x.</p>
<p>Thank you for your attention.</p>
Ruby master - Bug #9738 (Closed): A document fix for Rinda::TupleEntry#renew
https://bugs.ruby-lang.org/issues/9738
2014-04-13T04:17:48Z
ohai (Ippei Obayashi)
<p>As shown in the attached patch, Rinda::TupleEntry#renew<br>
accept true instead of false (true is consistent with make_expires).</p>
<p>In fact, in the current source code false is also acceptable and<br>
works as documented but it is not intentional.<br>
Therefore the document should be fixed.</p>
Ruby master - Bug #9062 (Closed): lib/rexml/parsers/streamparser.rb に require "rexml/parsers/bas...
https://bugs.ruby-lang.org/issues/9062
2013-10-31T00:54:23Z
ohai (Ippei Obayashi)
<p>lib/rexml/parsers/streamparser.rb は内部で REXML::Parsers::BaseParser を使っていますが<br>
rexml/parsers/baseparser を require していません。そのため StreamParser を使うとき<br>
rexml/parsers/streamparser に加えて rexml/parsers/baseparser を require する必要があります。</p>
<p>面倒ですし streamparser.rb が baseparser を require するとよいと思うのですがどうでしょうか。</p>
Ruby master - Bug #9061 (Closed): REXML::Parsers::UltraLightParser で doctype を含む XML のパースがうまくいかない
https://bugs.ruby-lang.org/issues/9061
2013-10-30T23:33:29Z
ohai (Ippei Obayashi)
<p>以下のコード (test_ulp.rb)<br>
require 'rexml/parsers/ultralightparser'<br>
require 'pp'</p>
<p>pp REXML::Parsers::UltraLightParser.new(<<XML).parse</p>
<?xml version="1.0" encoding="UTF-8" ?>
<p>]><br>
<br>
XML<br>
を動かすと、期待される出力は<br>
[[:xmldecl, "1.0", "UTF-8", nil],<br>
[:text, "\n"],<br>
[:doctype,<br>
[...],<br>
"root",<br>
"SYSTEM",<br>
"foo",<br>
nil,<br>
[:entitydecl, "f", "bar"],<br>
[:entitydecl, "g", "baz"]],<br>
[:text, "\n"],<br>
[:start_element, [...], "root", {}],<br>
[:text, "\n"]]<br>
のようなものですが、実際には<br>
[[:xmldecl, "1.0", "UTF-8", nil],<br>
[:text,<br>
"\n",<br>
[:text, "\n"],<br>
[:start_element, [...], "root", {}],<br>
[:text, "\n"]],<br>
[:start_doctype, "root", "SYSTEM", "foo", nil],<br>
[:entitydecl, "f", "bar"],<br>
[:entitydecl, "g", "baz"]]<br>
のようなものが出力されます。この出力は木構造上の :start_element<br>
や :start_doctype の位置が期待される場所と異なります。<br>
この挙動は ruby 2.1.0dev (2013-10-29 trunk 43466) [x86_64-linux] および<br>
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] で確認しました。</p>
<p>添付したパッチ(rexml-ultralightparser.patch)のように変更するとうまく動くと思います。</p>
Ruby master - Bug #8844 (Closed): Nested ParseError in rexml
https://bugs.ruby-lang.org/issues/8844
2013-08-31T13:29:45Z
ohai (Ippei Obayashi)
<p>以下のように不正なXMLをパースすると<br>
require 'rexml/document'<br>
REXML::Document.new("<a>foo")<br>
例外が発生し、以下のようなメッセージが表示されます(完全なものは添付したparseerror.txt)。<br>
/home/ohai/.rbenv/versions/trunk-modified/lib/ruby/2.1.0/rexml/parsers/treeparser.rb:95:<br>
in `rescue in parse': #<REXML::ParseException: Missing end tag for 'a' (got "b") (REXML:<br>
:ParseException)<br>
Line: 1<br>
Position: 10<br>
Last 80 unconsumed characters:</a></p>
<blockquote>
</blockquote>
<pre><code> :
</code></pre>
<p>nested_parseerror.rb:3:in `'<br>
...<br>
Missing end tag for 'a' (got "b")<br>
Line: 1<br>
Position: 10<br>
Last 80 unconsumed characters:</p>
<p>Line: 1<br>
Position: 10<br>
Last 80 unconsumed characters:<br>
:<br>
同じ情報が何度も表示され、冗長です。</p>
<p>添付したパッチのように変更すればこの繰り返しはなくなるのですがどうでしょうか。</p>
Ruby master - Bug #8731 (Closed): Problems when parsing notation decl and entity decl with REXML:...
https://bugs.ruby-lang.org/issues/8731
2013-08-04T18:01:02Z
ohai (Ippei Obayashi)
<p>以下のコード(sax2parser_decl_error.rb)を実行すると例外が発生します。<br>
require 'rexml/parsers/sax2parser'<br>
require 'rexml/sax2listener'</p>
<p>xml = <<EOS</p>
<pre><code><!NOTATION x SYSTEM "URIx">
</code></pre>
<p>]><br>
<br>
EOS</p>
<p>class Listener<br>
include REXML::SAX2Listener<br>
end</p>
<p>parser = REXML::Parsers::SAX2Parser.new(xml)<br>
parser.listen(Listener.new)<br>
parser.parse</p>
<a name="gt-test_sax2parserrb21in-entitydecl-wrong-number-of-arguments-3-for-1-ArgumentError"></a>
<h1 >> test_sax2parser.rb:21:in `entitydecl': wrong number of arguments (3 for 1) (ArgumentError)<a href="#gt-test_sax2parserrb21in-entitydecl-wrong-number-of-arguments-3-for-1-ArgumentError" class="wiki-anchor">¶</a></h1>
<p>これは SAX2Parser#handle から SAX2Listener#entitydecl, notationdecl に渡す引数の個数が違っているのが問題です。</p>
<p>添付した rexml-sax2parser-fix.patch で修正されます。ユニットテストは rexml-sax2parser-unittest.patch です。<br>
さらに、rexml-sax2listener-doc.patch でドキュメントの修正をしています。</p>
Ruby master - Bug #8701 (Closed): REXML bug in parsing notation declarations
https://bugs.ruby-lang.org/issues/8701
2013-07-28T23:20:07Z
ohai (Ippei Obayashi)
<p>添付したコード(test_notationdecl.rb)を実行すると、["x", "y", "z"] が表示することが期待されますが、["y", "z"] と表示されます。</p>
<p>パースに使っている正規表現の問題で, 添付したパッチ(rexml-dtd-notationdecl-fix.patch)で直ると思います。<br>
テストも添付しています。</p>
<p>このパーサではあちこちで ^ で始まる正規表現が使われていますが、おそらくすべて \A のつもりであろうと思われます。添付したパッチでは関係のある部分だけ修正していますが、他の正規表現も修正したほうが良いかもしれません。</p>
Ruby master - Bug #8689 (Closed): REXML::StreamListener#entityが呼び出されない
https://bugs.ruby-lang.org/issues/8689
2013-07-26T02:54:59Z
ohai (Ippei Obayashi)
<p>REXML::StreamListener#entity のドキュメントによると<br>
# Called when %foo; is encountered in a doctype declaration.<br>
# @p content "foo"<br>
def entity content<br>
end<br>
と書かれていますが、以下のコードを動かしても何も表示されません<br>
require 'rexml/parsers/baseparser'<br>
require 'rexml/parsers/streamparser'<br>
require 'rexml/streamlistener'<br>
xml = <<EOS</p>
EOS
<p>class Listener<br>
include REXML::StreamListener<br>
def entity(content)<br>
p content<br>
end<br>
end</p>
<p>REXML::Parsers::StreamParser.new(xml, Listener.new).parse</p>
<p>lib/rexml/parsers/streamparser.rb でもこの entity というメソッドを呼びだしている<br>
場所はないようです。</p>
<p>というわけで、なんらかの修正をする必要があるように思われます。</p>
<ul>
<li>このメソッドを削除</li>
<li>このメソッドを StreamParser から呼びだすようにする<br>
のいずれかの変更が良いでしょう。<br>
私の意見としては、このコールバックの使い道が思いつかない、おそらく誰も使っていない、ので、削除してしまって<br>
よいのではと思います。</li>
</ul>
Ruby master - Bug #8685 (Closed): Problems of the example of REXM::Attribute#namespace
https://bugs.ruby-lang.org/issues/8685
2013-07-26T01:35:56Z
ohai (Ippei Obayashi)
<p>The exmaple of the comment document of REXML::Attribute#namespace has some problems.</p>
<ul>
<li>An old style hash literal is used.</li>
<li>The example really does not use EXML::Attribute#namespace<br>
A patch to fix the example is attached to this ticket.</li>
</ul>
Ruby master - Bug #8665 (Closed): Examples of REXML::StreamParser#entitydecl
https://bugs.ruby-lang.org/issues/8665
2013-07-23T03:56:11Z
ohai (Ippei Obayashi)
<p>REXML::StreamParser#entitydecl のドキュメントの部分が実際の動作と食い違っています。</p>
<p>修正は rexml-streamparser-entitydecl.patch でよいと思います。</p>
<p>添付した test_streamparser.rb で動作が確認できます。</p>
Ruby master - Bug #8602 (Closed): REXML::Element#add_text and REXML::Text#<<
https://bugs.ruby-lang.org/issues/8602
2013-07-05T03:36:10Z
ohai (Ippei Obayashi)
<p>以下のコードは "foo bar" が出力されることが期待されますが実際には "foo" が出力されます。<br>
require 'rexml/document'<br>
doc = REXML::Document.new("")<br>
doc.root.add_text("foo")<br>
doc.to_s<br>
doc.root.add_text(" bar")<br>
p doc.root.to_s<br>
doc.to_s の部分をコメントアウトすると挙動が変わり "foo bar" が出力されます。</p>
<p>REXML::Element#add_text が呼び出している REXML::Text#<< が内部状態(@string)を変化させているにもかかわらず<br>
キャッシュ(@normalized, @unnormalized)をクリアしていないのが原因だと思われます。</p>
<p>添付したパッチで修正されると思います。</p>
Backport200 - Backport #8583 (Closed): A problem of condition regexp with a named capture
https://bugs.ruby-lang.org/issues/8583
2013-06-30T16:35:05Z
ohai (Ippei Obayashi)
<p>以下の条件分岐を含む正規表現は "xy" "yx" にマッチし、"xx" "yy" にはマッチしません。<br>
/\A((x)|(y))(?(2)y|x)\z/<br>
名前付きキャプチャを用いた以下の正規表現も同じ挙動をするはずですが、そうはなっていません。<br>
/\A((?x)|(?y))(?()y|x)\z/</p>
<a name="xx-yy-にマッチして-xy-yx-にはマッチしない"></a>
<h1 >"xx" "yy" にマッチして "xy" "yx" にはマッチしない。<a href="#xx-yy-にマッチして-xy-yx-にはマッチしない" class="wiki-anchor">¶</a></h1>
<p>2.0.0-p247, trunk の両方で確認しました。</p>
<p>この問題について調べた所、 名前付きキャプチャを使うときキャプチャの番号をrenumberしている<br>
所で renumber がもれています。</p>
<p>添付したパッチのように修正すれば直ると思います。</p>
Ruby master - Bug #8302 (Closed): REXML::Text の entity_filter が有効でない
https://bugs.ruby-lang.org/issues/8302
2013-04-20T17:29:23Z
ohai (Ippei Obayashi)
<p>REXML::Text の initialize や to_s のドキュメントによると、<br>
添付したファイル(text_entity_filter.rb)を実行すると<br>
"&f; &b;"<br>
"foo &b;"<br>
と出力されるはずですが、実際には<br>
"&f; &b;"<br>
"&f; &b;"<br>
と出力されます。</p>
<p>添付したパッチで修正されると思います。</p>
<p>しかし、この機能は何に使うのでしょうか?</p>
Ruby master - Bug #8301 (Closed): REXML::Attributes#to_a
https://bugs.ruby-lang.org/issues/8301
2013-04-20T16:39:54Z
ohai (Ippei Obayashi)
<p>添付したコード(attributs_to_a.rb)を実行すると、REXML::Attributes#to_a という名前から期待される結果は<br>
[foo:att='1', bar:att='2', att='<', baz='4']<br>
だと思うのですが、実際には<br>
[{"foo"=>foo:att='1', "bar"=>bar:att='2', ""=>att='<'}, baz='4']<br>
という結果になります。これは意図した結果ではないと思うのですがどうでしょうか。</p>
<p>添付したパッチで上の「期待される結果」になります。</p>
Ruby master - Bug #7636 (Closed): Problems in the documnt of psych
https://bugs.ruby-lang.org/issues/7636
2012-12-29T23:38:48Z
ohai (Ippei Obayashi)
<p>I found some mistakes in the comment of psych library.</p>
<p>The following is the comment of Psych.load:</p>
<a name="Example"></a>
<h1 >Example:<a href="#Example" class="wiki-anchor">¶</a></h1>
<h1></h1>
<a name="Psychload----a-gt-a"></a>
<h1 >Psych.load("--- a") # => 'a'<a href="#Psychload----a-gt-a" class="wiki-anchor">¶</a></h1>
<a name="Psychload---n-an-b-gt-a-b"></a>
<h1 >Psych.load("---\n - a\n - b") # => ['a', 'b']<a href="#Psychload---n-an-b-gt-a-b" class="wiki-anchor">¶</a></h1>
<h1></h1>
<a name="begin"></a>
<h1 >begin<a href="#begin" class="wiki-anchor">¶</a></h1>
<a name="Psychload----filetxt"></a>
<h1 >Psych.load("--- `", "file.txt")<a href="#Psychload----filetxt" class="wiki-anchor">¶</a></h1>
<a name="rescue-PsychSyntaxError-gt-ex"></a>
<h1 >rescue Psych::SyntaxError => ex<a href="#rescue-PsychSyntaxError-gt-ex" class="wiki-anchor">¶</a></h1>
<a name="exfile-gt-filetxt"></a>
<h1 >ex.file # => 'file.txt'<a href="#exfile-gt-filetxt" class="wiki-anchor">¶</a></h1>
<a name="exmessage-gt-footxt-found-character-that-cannot-start-any-token"></a>
<h1 >ex.message # => "(foo.txt): found character that cannot start any token"<a href="#exmessage-gt-footxt-found-character-that-cannot-start-any-token" class="wiki-anchor">¶</a></h1>
<a name="end"></a>
<h1 >end<a href="#end" class="wiki-anchor">¶</a></h1>
<p>The return value of ex.message is not correct. "foo.txt" should be "file.txt".<br>
We can find the same errros on some other methods.</p>
<p>The attached patch fixes this problem. The patch also update the message<br>
for newer versions.</p>
Ruby master - Bug #5845 (Closed): Addrinfo#connect_from が Addrinfo オブジェクトを受け付けない
https://bugs.ruby-lang.org/issues/5845
2012-01-05T18:35:32Z
ohai (Ippei Obayashi)
<p>Addrinfo#connect_from (ext/socket/lib/socket.rb) の rdoc には</p>
<a name="-Addrinfo-object-can-be-taken-for-the-argument"></a>
<h1 ># Addrinfo object can be taken for the argument.<a href="#-Addrinfo-object-can-be-taken-for-the-argument" class="wiki-anchor">¶</a></h1>
<a name="Addrinfotcpwwwruby-langorg-80connect_fromAddrinfotcp0000-4649-s"></a>
<h1 >Addrinfo.tcp("www.ruby-lang.org", 80).connect_from(Addrinfo.tcp("0.0.0.0", 4649)) {|s|<a href="#Addrinfotcpwwwruby-langorg-80connect_fromAddrinfotcp0000-4649-s" class="wiki-anchor">¶</a></h1>
<a name="sprint-GET-HTTP10rnHost-wwwruby-langorgrnrn"></a>
<h1 >s.print "GET / HTTP/1.0\r\nHost: <a href="http://www.ruby-lang.org%5Cr%5Cn%5Cr%5Cn" class="external">www.ruby-lang.org\r\n\r\n</a>"<a href="#sprint-GET-HTTP10rnHost-wwwruby-langorgrnrn" class="wiki-anchor">¶</a></h1>
<a name="puts-sread"></a>
<h1 >puts s.read<a href="#puts-sread" class="wiki-anchor">¶</a></h1>
<a name=""></a>
<h1 >}<a href="#" class="wiki-anchor">¶</a></h1>
<h1></h1>
<p>とあり、 Addrinfo オブジェクトを受け付けるように書かれていますが、実際には<br>
その内容は無視されてしまいます。以下のようなスクリプトで確認できます。<br>
require 'socket'<br>
Addrinfo.tcp("www.example.com", 80).connect_from(Addrinfo.tcp("0.0.0.0", 49021)) {|s|<br>
p s.local_address.ip_port<br>
s.close<br>
}<br>
原因は Addrinfo#family_addrinfo に Addrinfo オブジェクトを渡した時の返り値が適切でないことです。<br>
添付したパッチでとりあえずは期待通りに動きます。</p>
<p>適当に作った問題再現用テストも添付します。</p>
Ruby master - Bug #5062 (Closed): double free in OpenSSL::Engine
https://bugs.ruby-lang.org/issues/5062
2011-07-21T02:49:58Z
ohai (Ippei Obayashi)
<p>以下のコードを実行すると終了時にglibcがdouble freeを検出して停止します。<br>
require 'openssl'<br>
OpenSSL::Engine.load<br>
OpenSSL::Engine.engines<br>
OpenSSL::Engine.engines<br>
停止時の出力を添付します。</p>
<p>ENGINE_get_nextが前に返したengineのref countを下げるのが原因のようで、添付したパッチでとりあえず直ります。</p>
Ruby master - Feature #4481 (Closed): Add client_ca method to OpenSSL::SSLSocket
https://bugs.ruby-lang.org/issues/4481
2011-03-08T02:56:58Z
ohai (Ippei Obayashi)
<p>=begin<br>
Please add "client_ca" method to OpenSSL::SSLSocket to solve the following problem.</p>
<p>Problem:<br>
If a SSL server decide to authenticate clients using client-certificates,<br>
the server can send the list of client CAs to a client as a hint, and<br>
the client can use the list to select an appropriate certificate.<br>
But the current ruby's ext/openssl does not have the API to access the list.</p>
<p>Solution:<br>
Add a wrapper function for SSL_get_client_CA_list.</p>
<p>Two patches (new method and test) are attached to this message.<br>
=end</p>
Ruby master - Bug #4445 (Closed): ext/openssl の verify_callback が rb_protect で保護されていない
https://bugs.ruby-lang.org/issues/4445
2011-02-25T00:09:11Z
ohai (Ippei Obayashi)
<p>=begin<br>
openssl では 証明書の検証に付加的な機能を付けるための<br>
callback を設定できます。これをrubyから利用できるようになっていますが<br>
rb_protect を使っていないため、openssl ライブラリ内部を飛び越えて<br>
例外が飛ぶようになってしまう状態です。</p>
<p>現在ではSEGVが発生する等の問題は見つかってはいませんがメモリリークなど<br>
起きている可能性が高いです。</p>
<p>とりあえず大域脱出を止めるパッチを添付します。例外を適当な場所で再送するべきかもしれませんが<br>
それはしていません。<br>
=end</p>
Ruby master - Bug #4420 (Closed): OpenSSL::X509::Request#to_der で RequestError ではなく CertificateEr...
https://bugs.ruby-lang.org/issues/4420
2011-02-22T01:44:03Z
ohai (Ippei Obayashi)
<p>=begin<br>
OpenSSL::X509::Request#to_der の実体(ext/openssl/ossl_x509req.c:ossl_x509req_to_der)<br>
でOpenSSL::X509::CertificateErrorを発生させていますが、これは<br>
OpenSSL::X509::RequestError が妥当であるように思われます。</p>
<p>この問題を修正するパッチを添付してあります。<br>
=end</p>
Ruby master - Bug #4419 (Closed): ext/openssl のコメントが正しくない
https://bugs.ruby-lang.org/issues/4419
2011-02-22T00:17:27Z
ohai (Ippei Obayashi)
<p>=begin<br>
ext/openssl でいくつかコメントが間違っていると思われる所があるのでパッチを添付します。<br>
=end</p>
Ruby master - Bug #4418 (Rejected): OpenSSL::PKey::DH#public_key
https://bugs.ruby-lang.org/issues/4418
2011-02-21T23:45:21Z
ohai (Ippei Obayashi)
<p>=begin<br>
OpenSSL::PKey::DH#public_key がその名前に反して DH パラメータのみを複製して返しています。<br>
require 'openssl'<br>
dh = OpenSSL::PKey::DH.generate(1024) # => パラメータと鍵の生成、時間がかかる<br>
p dh.pub_key # => 公開鍵の整数を表示<br>
p dh.public_key.pub_key # => nil</p>
<p>DH の場合、RSAなどのように「公開鍵とパラメータ」を取り出す需要はあまりない<br>
ように思われるので、名前を変える、もしくはメソッドを廃止するのが良いのではと思われます。<br>
=end</p>
Ruby master - Bug #4417 (Closed): OpenSSL::Buffering#each_byte がブロックに文字をStringで渡している
https://bugs.ruby-lang.org/issues/4417
2011-02-21T23:22:51Z
ohai (Ippei Obayashi)
<p>=begin<br>
現状では Ruby 1.9.x では OpenSSL::Buffering#each_byte は、渡されたブロックに String オブジェクトを<br>
(1文字づつ)渡しています。</p>
<p>しかし IO#each_byte などからの類推としてこれは Integer を渡すべきではないでしょうか。<br>
=end</p>
Ruby master - Bug #4416 (Closed): OpenSSL::SSL::Session#session_new_cb
https://bugs.ruby-lang.org/issues/4416
2011-02-21T22:53:53Z
ohai (Ippei Obayashi)
<p>=begin<br>
SSL_CTX_sess_set_new_cb で渡すコールバックの返り値は、<br>
「0 を返すと新しく作られた SSL_SESSION のリファレンスカウンタの<br>
値を減らし(て SSL_SESSION を解放し)、<br>
それ以外を返すとリファレンスカウンタを減らさない」となっています。</p>
<p>しかし、ext/openssl/ossl_ssl.c:ossl_sslctx_session_new_cb ではその中で<br>
リファレンスカウンタの値を増やしているにもかかわらず1を返す場合があります。</p>
<p>ここは常に0を返すべきではないでしょうか?<br>
=end</p>
Ruby master - Bug #4055 (Closed): segfault in OpenSSL::SSLSocket#cert
https://bugs.ruby-lang.org/issues/4055
2010-11-15T00:51:36Z
ohai (Ippei Obayashi)
<p>=begin<br>
以下のようにすると Segmentation fault を起こします。<br>
ruby-1.9.2-p0 -e 'require "openssl"; OpenSSL::SSL::SSLSocket.new(STDIN).cert'</p>
<p>以下のパッチで直ると思います。<br>
--- a/ext/openssl/ossl_ssl.c<br>
+++ b/ext/openssl/ossl_ssl.c<br>
@@ -1337,7 +1337,7 @@ ossl_ssl_get_cert(VALUE self)<br>
X509 *cert = NULL;</p>
<pre><code> Data_Get_Struct(self, SSL, ssl);
</code></pre>
<ul>
<li>if (ssl) {</li>
</ul>
<ul>
<li>if (!ssl) {<br>
rb_warning("SSL session is not started yet.");<br>
return Qnil;<br>
}</li>
</ul>
<a name="バックトレースは以下の通り"></a>
<h2 >バックトレースは以下の通り。<a href="#バックトレースは以下の通り" class="wiki-anchor">¶</a></h2>
<p>-e:1: [BUG] Segmentation fault<br>
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]</p>
<h2>-- control frame ----------<br>
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :cert<br>
c:0003 p:0044 s:0006 b:0006 l:0017f8 d:000118 EVAL -e:1<br>
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH<br>
c:0001 p:0000 s:0002 b:0002 l:0017f8 d:0017f8 TOP</h2>
<p>-- Ruby level backtrace information ----------------------------------------<br>
-e:1:in <code><main>' -e:1:in </code>cert'</p>
<p>-- C level backtrace information -------------------------------------------<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_vm_bugreport+0x5f) [0x7fc3ef8ddc1f]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7fc3ef7bb0dc]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_bug+0xb3) [0x7fc3ef7bb253]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7fc3ef86ca9c]<br>
/lib/libpthread.so.0 [0x7fc3ef548a80]<br>
/usr/lib/libssl.so.0.9.8(SSL_get_certificate+0) [0x7fc3e9ec57f0]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/ruby/1.9.1/x86_64-linux/openssl.so [0x7fc3ea10fc77]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7fc3ef8d7f1f]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7fc3ef8cbf09]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7fc3ef8d2103]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_iseq_eval_main+0x27c) [0x7fc3ef8d247c]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7fc3ef7bf29b]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(ruby_exec_node+0x19) [0x7fc3ef7bf2c9]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(ruby_run_node+0x1e) [0x7fc3ef7c0e0e]<br>
ruby-1.9.2-p0(main+0x4f) [0x40099f]<br>
/lib/libc.so.6(__libc_start_main+0xe6) [0x7fc3ee93d1a6]<br>
ruby-1.9.2-p0 [0x400889]</p>
<p>[NOTE]<br>
You may have encountered a bug in the Ruby interpreter or extension libraries.<br>
Bug reports are welcome.<br>
For details: <a href="http://www.ruby-lang.org/bugreport.html" class="external">http://www.ruby-lang.org/bugreport.html</a><br>
=end</p>
Ruby master - Bug #4033 (Closed): Segmentation fault : ext/openssl:OpenSSL::X509::StoreContext#cl...
https://bugs.ruby-lang.org/issues/4033
2010-11-07T18:30:21Z
ohai (Ippei Obayashi)
<h2>=begin<br>
以下のコードがSegmentation faultで止まります。</h2>
<h2>require 'openssl'<br>
cert = OpenSSL::X509::Certificate.new<br>
store = OpenSSL::X509::Store.new<br>
ctx = OpenSSL::X509::StoreContext.new(store, cert, [])<br>
ctx.cleanup<br>
ctx.verify</h2>
<p>% ruby-1.9.2-p0 contextbug.rb<br>
contextbug.rb:6: [BUG] Segmentation fault<br>
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]</p>
<h2>-- control frame ----------<br>
c:0004 p:---- s:0012 b:0012 l:000011 d:000011 CFUNC :verify<br>
c:0003 p:0109 s:0009 b:0009 l:000fd8 d:001ba0 EVAL contextbug.rb:6<br>
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH<br>
c:0001 p:0000 s:0002 b:0002 l:000fd8 d:000fd8 TOP</h2>
<p>-- Ruby level backtrace information ----------------------------------------<br>
contextbug.rb:6:in <code><main>' contextbug.rb:6:in </code>verify'</p>
<p>-- C level backtrace information -------------------------------------------<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_vm_bugreport+0x5f) [0x7f4d8aa1ec1f]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f4d8a8fc0dc]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_bug+0xb3) [0x7f4d8a8fc253]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f4d8a9ada9c]<br>
/lib/libpthread.so.0 [0x7f4d8a689a80]<br>
/usr/lib/libcrypto.so.0.9.8(X509_verify_cert+0x84) [0x7f4d84d3dfa4]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/ruby/1.9.1/x86_64-linux/openssl.so [0x7f4d85246f37]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f4d8aa18f1f]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f4d8aa0cf09]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f4d8aa13103]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_iseq_eval_main+0x27c) [0x7f4d8aa1347c]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9 [0x7f4d8a90029b]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(ruby_exec_node+0x19) [0x7f4d8a9002c9]<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/libruby.so.1.9(ruby_run_node+0x1e) [0x7f4d8a901e0e]<br>
ruby-1.9.2-p0(main+0x4f) [0x40099f]<br>
/lib/libc.so.6(__libc_start_main+0xe6) [0x7f4d89a7e1a6]<br>
ruby-1.9.2-p0 [0x400889]</p>
<p>[NOTE]<br>
You may have encountered a bug in the Ruby interpreter or extension libraries.<br>
Bug reports are welcome.<br>
For details: <a href="http://www.ruby-lang.org/bugreport.html" class="external">http://www.ruby-lang.org/bugreport.html</a></p>
<a name="1-6994-abort-ruby-192-p0-contextbugrb"></a>
<h2 >[1] 6994 abort ruby-1.9.2-p0 contextbug.rb<a href="#1-6994-abort-ruby-192-p0-contextbugrb" class="wiki-anchor">¶</a></h2>
<p><a href="http://www.openssl.org/docs/crypto/X509_STORE_CTX_new.html" class="external">http://www.openssl.org/docs/crypto/X509_STORE_CTX_new.html</a> によると、</p>
<p>X509_STORE_CTX_cleanup() internally cleans up an X509_STORE_CTX structure.<br>
The context can then be reused with an new call to X509_STORE_CTX_init().</p>
<p>とのことです。<br>
=end</p>
Ruby master - Bug #3902 (Closed): Integer#to_bn in OpenSSL
https://bugs.ruby-lang.org/issues/3902
2010-10-04T04:19:24Z
ohai (Ippei Obayashi)
<p>=begin<br>
ext/openssl で定義されている Integer#to_bn が以下のように正しく動作しません。<br>
% ruby-1.9.2-p0 -v<br>
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]<br>
% ruby-1.9.2-p0 -ropenssl -e '43.to_bn'<br>
/home/ohai/opt/ruby-1.9.2-p0/lib/ruby/1.9.1/openssl/bn.rb:32:in <code>initialize': can't convert Fixnum into String (TypeError) from /home/ohai/opt/ruby-1.9.2-p0/lib/ruby/1.9.1/openssl/bn.rb:32:in </code>new'<br>
from /home/ohai/opt/ruby-1.9.2-p0/lib/ruby/1.9.1/openssl/bn.rb:32:in <code>to_bn' from -e:1:in </code>'</p>
<p>以下の修正で直ると思います。<br>
--- a/ext/openssl/lib/openssl/bn.rb<br>
+++ b/ext/openssl/lib/openssl/bn.rb<br>
@@ -29,7 +29,7 @@ end # OpenSSL</p>
<h1></h1>
<p>class Integer<br>
def to_bn</p>
<ul>
<li>OpenSSL::BN::new(self)</li>
</ul>
<ul>
<li>OpenSSL::BN::new(self.to_s)<br>
end<br>
end # Integer<br>
=end</li>
</ul>