Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112020-06-07T23:46:44ZRuby Issue Tracking System
Redmine Ruby master - Feature #16937 (Assigned): Add DNS over HTTP to Resolvhttps://bugs.ruby-lang.org/issues/169372020-06-07T23:46:44Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This adds a DNS over HTTP resolver at Resolv::DoH</p>
<p>It obeys RFC8484 with respect to Cache-Control and Age behavior, but does not use HTTP2 as ruby does not have an HTTP2 client.</p>
<p>It does not allow configuration of the Net::HTTP instance beyond timeouts, but I am willing to add more configuration if this is desired.</p> Ruby master - Bug #10533 (Closed): HTTP reconnection with SNI does not send correct hostnamehttps://bugs.ruby-lang.org/issues/105332014-11-21T03:41:56Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>When reconnecting after connection timeout on an SNI connection the server name is not sent during reconnect which results in a failed reconnection:</p>
<pre><code>$ cat test.rb
require 'net/http'
uri = URI 'https://david.shanske.com'
Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|
req = Net::HTTP::Get.new uri
response = http.request req
p response.code
sleep 310
req = Net::HTTP::Get.new uri
response = http.request req
p response.code
end
$ ruby -v test.rb
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
"200"
/usr/local/lib/ruby/2.1.0/openssl/ssl.rb:178:in `post_connection_check': hostname "david.shanske.com" does not match the server certificate (OpenSSL::SSL::SSLError)
from /usr/local/lib/ruby/2.1.0/net/http.rb:922:in `connect'
from /usr/local/lib/ruby/2.1.0/net/http.rb:1447:in `begin_transport'
from /usr/local/lib/ruby/2.1.0/net/http.rb:1404:in `transport_request'
from /usr/local/lib/ruby/2.1.0/net/http.rb:1378:in `request'
from test.rb:10:in `block in <main>'
from /usr/local/lib/ruby/2.1.0/net/http.rb:853:in `start'
from /usr/local/lib/ruby/2.1.0/net/http.rb:583:in `start'
from test.rb:4:in `<main>'
</code></pre> Backport21 - Backport #9489 (Closed): Backport RubyGems 2.2.2https://bugs.ruby-lang.org/issues/94892014-02-05T22:25:26Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This patch updates the 2.1 branch to RubyGems 2.2.2 which contains the following bug fixes:</p>
<p><a href="http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.2.2+%2F+2014-02-05" class="external">http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.2.2+%2F+2014-02-05</a></p> Backport21 - Backport #9375 (Closed): Backport r44515 RubyGems 2.2.1https://bugs.ruby-lang.org/issues/93752014-01-07T10:32:49Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixes some bugs in RubyGems 2.2.0 including performance regressions.</p>
<p>I have attached a patch to update NEWS as well.</p> Backport21 - Backport #9283 (Closed): Backport r44334https://bugs.ruby-lang.org/issues/92832013-12-22T11:12:49Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixes a test warning.</p> Backport21 - Backport #9282 (Closed): Backport r44333https://bugs.ruby-lang.org/issues/92822013-12-22T11:06:31Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This restores gem install --ignore-dependencies for remote gems which was broken in 2.1.0.rc.1</p> Backport21 - Backport #9281 (Closed): Backport r44332https://bugs.ruby-lang.org/issues/92812013-12-22T10:26:01Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This updates RDoc to its release version</p> Backport21 - Backport #9280 (Closed): Backport r44331https://bugs.ruby-lang.org/issues/92802013-12-22T10:22:51Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This sets the RubyGems version to the release version.</p> Backport21 - Backport #9279 (Closed): Backport r44330https://bugs.ruby-lang.org/issues/92792013-12-22T10:21:36Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This corrects a comment.</p> Ruby master - Bug #9202 (Closed): Array#uniq freezes duplicate stringshttps://bugs.ruby-lang.org/issues/92022013-12-03T09:05:30Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>I imagine this is related to the recent frozen string changes. This behavior change in Array#uniq breaks RubyGems:</p>
<p>$ cat test.rb<br>
p unique: %w[a].uniq.any? { |item| item.frozen? }<br>
p duplicate: %w[a a].uniq.any? { |item| item.frozen? }<br>
$ ruby -v test.rb<br>
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]<br>
{:unique=>false}<br>
{:duplicate=>false}<br>
$ make runruby<br>
./miniruby -I../trunk/lib -I. -I.ext/common ../trunk/tool/runruby.rb --extout=.ext -- --disable-gems ../trunk/test.rb<br>
{:unique=>false}<br>
{:duplicate=>true}</p> Ruby master - Bug #9163 (Closed): Rinda::RingServer can't announce locallyhttps://bugs.ruby-lang.org/issues/91632013-11-27T14:37:40Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>Rinda::RingServer#do_reply takes tuples of the form [:lookup_ring, DRbObject]. For remote processes looking for a ring server this works fine as the callback proc in the second slot of the tuple will be a DRbObject.</p>
<p>When a process is looking for a ring server that is local it will never be found. DRb automatically converts a DRbObject to a local reference to reduce overhead, so the second slot of the tuple will be a Proc instance.</p>
<p>A Proc instance does not match DRbObject.</p>
<p>Changing the template to [:lookup_ring, nil] allows the ring server to respond to a local lookup request. This also prevents memory growth in the tuple space as matching arbitrary objects can be removed.</p> Backport200 - Backport #9104 (Closed): Import RubyGems 2.0.14https://bugs.ruby-lang.org/issues/91042013-11-13T08:39:54Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>RubyGems 2.0.14 fixes the following issues:</p>
<p>Gem::Specification::remove_spec no longer checks for existence of the spec to be removed. Issue <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: upcase of め becomes ち in ISO-2022-JP (Closed)" href="https://bugs.ruby-lang.org/issues/698">#698</a> by Tiago Macedo.</p>
<p>Restored wildcard handling when installing gems. Issue <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: replacing array during sort may make assertion fail (Closed)" href="https://bugs.ruby-lang.org/issues/697">#697</a> by Chuck Remes.</p>
<p>Added DigiCert High Assurance EV Root CA certificate for the cloudfront.net certificate change.</p>
<p>The Gem::RemoteFetcher tests now choose the test server port more reliably. Pull Request <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Segmentation fault in garbage collector ruby 1.8.7 (2008-10-31 revision 0) [x86_64-linux] (Closed)" href="https://bugs.ruby-lang.org/issues/706">#706</a> by akr.</p> Backport200 - Backport #9052 (Closed): Import RubyGems 2.0.13https://bugs.ruby-lang.org/issues/90522013-10-25T09:45:40Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixes the following bugs:</p>
<p><a href="http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.13+%2F+2013-10-24" class="external">http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.13+%2F+2013-10-24</a></p> Backport200 - Backport #9014 (Closed): Import RubyGems 2.0.11 and 2.0.12https://bugs.ruby-lang.org/issues/90142013-10-11T09:06:11Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixes the following bugs:</p>
<p><a href="http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.12+%2F+2013-10-14" class="external">http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.12+%2F+2013-10-14</a></p> Backport200 - Backport #8950 (Closed): Import RubyGems 2.0.10https://bugs.ruby-lang.org/issues/89502013-09-25T10:04:10Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixes CVE-2013-4363 which is another fix for backtracking regexp like CVE-2013-4287.</p> Backport200 - Backport #8908 (Closed): Backport RubyGems 2.0.9https://bugs.ruby-lang.org/issues/89082013-09-14T09:35:48Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixes two bugs.</p>
<p>I altered NEWS to have only one link to the release notes, I hope this is OK.</p> Ruby master - Bug #8865 (Closed): OptionParser acceptable bugshttps://bugs.ruby-lang.org/issues/88652013-09-05T06:00:11Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>I have found a few bugs in OptionParser's accept feature:</p>
<p>Hexadecimal and binary numbers are not properly supported for Integer</p>
<p>OptionParser::DecimalInteger, OptionParser::OctalInteger and OptionParser::DecimalNumeric convert invalid input to 0 or nil instead of raising InvalidArgument.</p>
<p>The attached patch fixes the validation regular expression for handling binary and hexadecimal arguments and adds verification for DecimalInteger, OctalInteger and DecimalNumeric</p> Backport200 - Backport #8787 (Closed): Backport RubyGems 2.0.7https://bugs.ruby-lang.org/issues/87872013-08-16T09:07:27Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>The attached patch updates the ruby_2_0_0 branch to RubyGems 2.0.7</p>
<p>This patch contains minor bug and documentation fixes. The history for the 2.0.7 release can be found here:</p>
<p><a href="http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.7+%2F+2013-08-15" class="external">http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.7+%2F+2013-08-15</a></p> Ruby master - Bug #8690 (Third Party's Issue): Enciphering a key with AES-128-CBC-HMAC-SHA1 crash...https://bugs.ruby-lang.org/issues/86902013-07-26T05:45:46Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
While I realize this is probably wrong, I was trying to find a cipher that JRuby 1.7.4 supported and encountered this crash.</p>
<p>My OpenSSL version is:</p>
<p>$ ruby -ropenssl -e 'p OpenSSL::OPENSSL_VERSION'<br>
"OpenSSL 1.0.1e 11 Feb 2013"</p>
<p>The crash:</p>
<p>$ ruby crash.rb<br>
crash.rb:10: [BUG] Segmentation fault<br>
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]</p>
<p>-- Crash Report log information --------------------------------------------<br>
See Crash Report log file under the one of following:<br>
* ~/Library/Logs/CrashReporter<br>
* /Library/Logs/CrashReporter<br>
* ~/Library/Logs/DiagnosticReports<br>
* /Library/Logs/DiagnosticReports<br>
the more detail of.</p>
<p>-- Control frame information -----------------------------------------------<br>
c:0004 p:---- s:0015 e:000014 CFUNC :initialize<br>
c:0003 p:---- s:0013 e:000012 CFUNC :new<br>
c:0002 p:0083 s:0008 E:002448 EVAL crash.rb:10 [FINISH]<br>
c:0001 p:0000 s:0002 E:000868 TOP [FINISH]</p>
<p>crash.rb:10:in <code><main>' crash.rb:10:in </code>new'<br>
crash.rb:10:in `initialize'</p>
<p>-- C level backtrace information -------------------------------------------</p>
<p>-- Other runtime information -----------------------------------------------</p>
<ul>
<li>
<p>Loaded script: crash.rb</p>
</li>
<li>
<p>Loaded features:</p>
<p>0 enumerator.so<br>
1 /usr/local/lib/ruby/2.0.0/x86_64-darwin12.4.0/enc/encdb.bundle<br>
2 /usr/local/lib/ruby/2.0.0/x86_64-darwin12.4.0/enc/trans/transdb.bundle<br>
3 /usr/local/lib/ruby/2.0.0/x86_64-darwin12.4.0/rbconfig.rb<br>
4 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/compatibility.rb<br>
5 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/defaults.rb<br>
6 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/deprecate.rb<br>
7 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/errors.rb<br>
8 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/version.rb<br>
9 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/requirement.rb<br>
10 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/platform.rb<br>
11 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/basic_specification.rb<br>
12 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/stub_specification.rb<br>
13 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb<br>
14 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/exceptions.rb<br>
15 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb<br>
16 /usr/local/lib/ruby/2.0.0/thread.rb<br>
17 /usr/local/lib/ruby/2.0.0/monitor.rb<br>
18 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb<br>
19 /usr/local/lib/ruby/site_ruby/2.0.0/rubygems.rb<br>
20 /usr/local/lib/ruby/2.0.0/x86_64-darwin12.4.0/digest.bundle<br>
21 /usr/local/lib/ruby/2.0.0/digest.rb<br>
22 /usr/local/lib/ruby/2.0.0/x86_64-darwin12.4.0/openssl.bundle<br>
23 /usr/local/lib/ruby/2.0.0/openssl/bn.rb<br>
24 /usr/local/lib/ruby/2.0.0/openssl/cipher.rb<br>
25 /usr/local/lib/ruby/2.0.0/x86_64-darwin12.4.0/stringio.bundle<br>
26 /usr/local/lib/ruby/2.0.0/openssl/config.rb<br>
27 /usr/local/lib/ruby/2.0.0/openssl/digest.rb<br>
28 /usr/local/lib/ruby/2.0.0/openssl/x509.rb<br>
29 /usr/local/lib/ruby/2.0.0/openssl/buffering.rb<br>
30 /usr/local/lib/ruby/2.0.0/x86_64-darwin12.4.0/fcntl.bundle<br>
31 /usr/local/lib/ruby/2.0.0/openssl/ssl.rb<br>
32 /usr/local/lib/ruby/2.0.0/openssl.rb</p>
</li>
</ul>
<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>
<p>Abort trap: 6</p>
<p>Attached are the script I used to reproduce the crash and the OS X crash report.<br>
=end</p> Backport200 - Backport #8682 (Closed): Backport RubyGems 2.0.6 to Ruby 2.0.0https://bugs.ruby-lang.org/issues/86822013-07-25T07:06:26Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>RubyGems 2.0.6 contains only bug fixes. The release notes are here:</p>
<p><a href="http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.6+%2F+2013-07-24" class="external">http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.6+%2F+2013-07-24</a></p>
<p>Attached is a patch to the ruby_2_0_0 branch as trunk contains mixed commits.</p> Backport200 - Backport #8617 (Closed): Backport RubyGems 2.0.5 to Ruby 2.0.0https://bugs.ruby-lang.org/issues/86172013-07-10T11:44:10Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>RubyGems 2.0.4 contains only bug fixes. The release notes are here:</p>
<p><a href="http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.4+%2F+2013-07-09" class="external">http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.4+%2F+2013-07-09</a></p>
<p>Attached is a patch to the ruby_2_0_0 branch as trunk contains mixed commits.</p> Ruby master - Bug #8522 (Closed): r41264 causes "implicit conversion loses integer precision" on ...https://bugs.ruby-lang.org/issues/85222013-06-13T05:28:17Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
compiling ../trunk/bignum.c<br>
../trunk/bignum.c:1128:46: error: implicit conversion loses integer precision:<br>
'unsigned long' to 'int' [-Werror,-Wshorten-64-to-32]<br>
*nlp_bits_ret = num_bdigits * BITSPERDIG - num_bits;<br>
~ ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~<br>
1 error generated.<br>
make: *** [bignum.o] Error 1</p>
<p>=end</p> Backport193 - Backport #8517 (Closed): Enable IPV6_PKTINFO on OS Xhttps://bugs.ruby-lang.org/issues/85172013-06-12T11:25:49Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
Recent versions of OS X hide (({IPV6_PKTINFO})) (and some other socket options) behind (({__APPLE_USE_RFC_3542})) (or (({__APPLE_USE_RFC_2292}))).</p>
<p>This patch defines (({__APPLE_USE_RFC_3542})) when building the socket extension as netinet6/in6.h says "Note that eventually RFC 3542 is going to be the default and RFC 2292 will be obsolete."</p>
<p>With this patch IPV6_PKTINFO appears in Socket::Constants</p>
<p>=end</p> Ruby master - Feature #8155 (Closed): Improve support for streaming responses in WEBrickhttps://bugs.ruby-lang.org/issues/81552013-03-23T17:00:19Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>Currently WEBrick only understands a body that is a String or an IO. This makes it difficult to stream a response body. Instead of providing a body that duck-types to IO you must use IO.pipe which can be clumsy.</p>
<p>The attached patch checks if the body responds to #readpartial (#read is assumed) instead of if it is an instance of class IO.</p> Backport193 - Backport #8104 (Rejected): Backport r31635 which fixes Rinda::RingFinger.primary ha...https://bugs.ruby-lang.org/issues/81042013-03-16T11:02:22Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>I am experiencing this on ruby 1.9.3</p> Ruby master - Feature #8089 (Closed): Add one-shot multicast DNS support to Resolvhttps://bugs.ruby-lang.org/issues/80892013-03-14T08:41:14Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>The attached patch adds one-shot multicast DNS (mDNS) support to Resolv per RFC 6762 section 5.1.</p>
<p>This is the easiest type of mDNS support to add as it requires no knowledge of multicast sockets in Resolv, just removal of the restriction that the request address (the multicast address) must match the reply address (a unicast address) which will not be true for mDNS responses.</p>
<p>This patch also allows the set of resolvers Resolv::DefaultResolver to be changed to add the mDNS resolver at runtime.</p>
<p>In conjunction with resolve-replace, this patch allows DRb to be used when a host is running a full mDNS resolver and mDNS names ("example.local") are returned from remote hosts.</p>
<p>Note that this does not implement the RFC 6762 section 11 source address check as the local network cannot be determined with ruby's current API.</p> Ruby master - Feature #8075 (Closed): Add socket interface class to list interfaceshttps://bugs.ruby-lang.org/issues/80752013-03-11T12:20:14Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>For IPv6 multicast an interface may be set to indicate which interface IPv6 packets should be sent on.</p>
<p>The attached patch allows interfaces to be looked up by name (or index) for use in setting this socket option.</p> Ruby master - Feature #8073 (Closed): Add multicast support to Rinda::Ring*https://bugs.ruby-lang.org/issues/80732013-03-11T10:25:31Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This patch adds multicast support to Rinda::Ring.</p>
<p>If the addresses list for Rinda::RingServer or Rinda::RingFinger contain a multicast address then a multicast socket will automatically be created and used.</p>
<p>Rinda::RingServer#initialize was changed to accept three arguments, but in a backwards-compatible manner.</p>
<p>Rinda::RingServer#shutdown was added.</p>
<p>Tests for socket creation were added.</p> Ruby master - Feature #8042 (Assigned): Add Addrinfo#socket to create a socket that is not connec...https://bugs.ruby-lang.org/issues/80422013-03-08T08:35:01Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This adds a socket method to Addrinfo to get a socket that has not been bound or connected to any address for connectionless operation.</p> Backport200 - Backport #7992 (Closed): Backport r39544 - Fixes FileUtils bug #7958https://bugs.ruby-lang.org/issues/79922013-03-01T11:13:38Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This reverts r34669 which altered FileUtils metaprogramming in a way that broke FileUtils::Verbose, ::NoWrite and ::DryRun.</p>
<p>Patch: <a href="http://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39544" class="external">http://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39544</a></p>
<p>Issue: <a href="http://bugs.ruby-lang.org/issues/7958" class="external">http://bugs.ruby-lang.org/issues/7958</a></p> Ruby master - Bug #7958 (Closed): include FileUtils::Verbose gives NoMethodError when installing ...https://bugs.ruby-lang.org/issues/79582013-02-26T04:05:14Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
Seems like (({fu_stream_blksize})) isn't included when (({FileUtils::Verbose})) is. Changing to plain FileUtils works, though.</p>
<p>$ cat test.rb<br>
require 'fileutils'<br>
require 'tmpdir'</p>
<p>include FileUtils::Verbose</p>
<p>Dir.mktmpdir 'test' do |dir|<br>
install <strong>FILE</strong>, dir, mode: 0600<br>
install <strong>FILE</strong>, dir, mode: 0640<br>
end</p>
<p>$ ~/.rubies/trunk/bin/ruby -v test.rb<br>
ruby 2.1.0dev (2013-02-26 trunk 39490) [x86_64-darwin12.2.1]<br>
install -c -m 0600 test.rb /var/folders/87/twjsm89x01161gp5d9qwlx2m0000gn/T/test20130225-53176-197q6me<br>
install -c -m 0640 test.rb /var/folders/87/twjsm89x01161gp5d9qwlx2m0000gn/T/test20130225-53176-197q6me<br>
/Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:898:in <code>compare_stream': undefined method </code>fu_stream_blksize' for main:Object (NoMethodError)<br>
from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:882:in <code>block (2 levels) in compare_file' from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:881:in </code>open'<br>
from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:881:in <code>block in compare_file' from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:880:in </code>open'<br>
from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:880:in <code>compare_file' from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:926:in </code>block in install'<br>
from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:1620:in <code>block in fu_each_src_dest' from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:1633:in </code>fu_each_src_dest0'<br>
from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:1618:in <code>fu_each_src_dest' from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:925:in </code>install'<br>
from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/fileutils.rb:137:in <code>install' from test.rb:8:in </code>block in '<br>
from /Users/drbrain/.rubies/trunk/lib/ruby/2.1.0/tmpdir.rb:88:in <code>mktmpdir' from test.rb:6:in </code>'<br>
=end</p> Backport200 - Backport #7909 (Closed): Backport r39366 - Create extension install directory befor...https://bugs.ruby-lang.org/issues/79092013-02-22T07:20:40Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixed <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: rubygems 2.0 has an incompatibility about installation of extension libraries if gem package does... (Closed)" href="https://bugs.ruby-lang.org/issues/7897">#7897</a>.</p>
<p>The change is here:</p>
<p><a href="https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39366" class="external">https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39366</a></p>
<p>This may be a work-around to a regression in mkmf.rb, though. See <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: rubygems 2.0 has an incompatibility about installation of extension libraries if gem package does... (Closed)" href="https://bugs.ruby-lang.org/issues/7897">#7897</a> for discussion.</p> Backport200 - Backport #7889 (Closed): Backport 39327 to ruby 2.0.0 to fix gem update --user-installhttps://bugs.ruby-lang.org/issues/78892013-02-20T09:38:30Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This commit moves the creation of the installer to after the command-line options have been processed.</p>
<p>The commit is at:</p>
<p><a href="https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39327" class="external">https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39327</a></p>
<p>See also <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: embedded rubygems 2.0.0.rc.2 mangles --user-install (Closed)" href="https://bugs.ruby-lang.org/issues/7779">#7779</a></p> Backport200 - Backport #7888 (Closed): Backport r39324 to ruby 2.0.0 to fix windows test failurehttps://bugs.ruby-lang.org/issues/78882013-02-20T07:58:54Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixes a test failure on windows caused by an accidental edit of an instance variable using gsub. This fix is not critical for the operation of RubyGems but does make the test suite pass.</p>
<p>commit: <a href="https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39324" class="external">https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39324</a></p> Backport200 - Backport #7880 (Closed): Backport r39307 to Ruby 2.0.0https://bugs.ruby-lang.org/issues/78802013-02-19T08:20:02Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixes a bug in --user-install that attempts to place executables in the default directory which requires root permissions.</p> Backport200 - Backport #7875 (Closed): Backport r39292 to 2.0.0 which fixes #7870https://bugs.ruby-lang.org/issues/78752013-02-18T04:59:06Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This fixes the Time.now == "" bug</p> Backport200 - Backport #7853 (Closed): Backport r39247 - Set RDoc and RubyGems release versionshttps://bugs.ruby-lang.org/issues/78532013-02-15T07:54:19Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>I forgot to set RDoc and RubyGems release versions when ruby_2_0_0 branch was made. This updates the versions for release.</p> Backport200 - Backport #7852 (Closed): Backport r39238 to 2.0.0https://bugs.ruby-lang.org/issues/78522013-02-14T14:43:23Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This removes the OpenSSL dependency from Net::HTTP. Without this the user must have OpenSSL to use Net::HTTP.</p>
<p>This removes the zlib dependency in the test, it allows the tests to pass when zlib is not present.</p> Ruby master - Bug #7838 (Closed): Backport r39213 to Ruby 2.0.0 which fixes intermittent test fai...https://bugs.ruby-lang.org/issues/78382013-02-13T06:09:36Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>r39213 sets the encoding of strings returned by Gem.gzip and Gem.gunzip to BINARY.</p>
<p>This fixes intermittent test failures on ruby 2.0.0.</p>
<p>I believe this could cause failures in real code too.</p> Backport200 - Backport #7831 (Closed): Net::HTTP does not allow users to handle Content-Encoding ...https://bugs.ruby-lang.org/issues/78312013-02-12T08:57:44Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>I added a feature to always add a feature to always add Accept-Encoding to HTTP requests and always decode HTTP responses with Content-Encoding.</p>
<p>On Ruby 1.9 and older you could handle Content-Encoding for yourself.</p>
<p>Now Ruby always handles Content-Encoding for you, but does not give you a good indicator that this has taken place. In mechanize this leads to an incompatibility as the Content-Length header is not updated from the original value.</p>
<p>This also disallows handling of bad server responses that browsers handle.</p>
<p>The attached patch (upcoming) addresses this by only handling Content-Decoding in a response if the user did not override the Accept-Encoding header.</p>
<p>Since this is an incompatibility I would like this fixed for Ruby 2.0. Sorry I did not catch it sooner, I was too busy with RubyGems and RDoc.</p> Ruby master - Bug #7809 (Closed): Backport RubyGems fixes in r39166 to ruby 2.0.0https://bugs.ruby-lang.org/issues/78092013-02-09T09:28:36Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>r39166 contains two RubyGems fixes.</p>
<p>The change to lib/rubygems/package.rb is a critical bug fix for RubyGems signing support. Without this fix users of the LowSecurity policy will not be able to install signed gems.</p>
<p>The change to lib/rubygems/package/old.rb is not a critical bug fix. It will make my diagnosis of problems in RubyGems easier, though. It does not change operation of RubyGems in Ruby 2.0.0.</p> Ruby master - Bug #7756 (Closed): clang 4.2 sees through UNINITIALIZED_VAR macro, gives warninghttps://bugs.ruby-lang.org/issues/77562013-01-30T05:05:31Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin</p>
<p>In clang 3.2, the UNINITIALIZED_VAR macro does not prevent the compiler from producing a warning.</p>
<p>Apple clang 3.2:</p>
<p>$ clang -v<br>
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)<br>
Target: x86_64-apple-darwin12.2.1<br>
Thread model: posix</p>
<p>When compiling thread.c:</p>
<p>compiling ../trunk/thread.c<br>
../trunk/thread.c:3261:34: warning: variable 'orig_read' is uninitialized when<br>
used within its own initialization [-Wuninitialized]<br>
rb_fdset_t UNINITIALIZED_VAR(orig_read);<br>
^~~~~~~~~<br>
../trunk/vm_core.h:119:34: note: expanded from macro 'UNINITIALIZED_VAR'<br>
#define UNINITIALIZED_VAR(x) x = x<br>
^<br>
../trunk/thread.c:3262:34: warning: variable 'orig_write' is uninitialized when<br>
used within its own initialization [-Wuninitialized]<br>
rb_fdset_t UNINITIALIZED_VAR(orig_write);<br>
^~~~~~~~~~<br>
../trunk/vm_core.h:119:34: note: expanded from macro 'UNINITIALIZED_VAR'<br>
#define UNINITIALIZED_VAR(x) x = x<br>
^<br>
../trunk/thread.c:3263:34: warning: variable 'orig_except' is uninitialized when<br>
used within its own initialization [-Wuninitialized]<br>
rb_fdset_t UNINITIALIZED_VAR(orig_except);<br>
^~~~~~~~~~~<br>
../trunk/vm_core.h:119:34: note: expanded from macro 'UNINITIALIZED_VAR'<br>
#define UNINITIALIZED_VAR(x) x = x<br>
^<br>
3 warnings generated.</p>
<p>=end</p> Ruby master - Bug #7485 (Closed): ruby cannot build on mingw32 or FreeBSD 8 due to missing __sync...https://bugs.ruby-lang.org/issues/74852012-12-01T07:38:40Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>mingw32 GCC has the other atomic builtins but not this one. The attached patch checks for the GCC builtins used in ruby_atomic.h but not checked for by configure.</p> Ruby master - Bug #7471 (Closed): character class has duplicated range warning for "" =~ /[\w\W]/https://bugs.ruby-lang.org/issues/74712012-11-30T08:06:13Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
The warning seems bogus, \w and \W do not overlap.</p>
<p>$ cat test.rb<br>
$-w = true</p>
<p>""=~/[\w\W]/<br>
$ make runruby<br>
/Users/drbrain/Work/svn/ruby/trunk/test.rb:3: warning: character class has duplicated range: /[\w\W]/</p>
<p>There is no warning with 1.9.3:</p>
<p>$ ~/.multiruby/install/1.9.3-p194/bin/ruby -v test.rb<br>
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]<br>
[no output]</p>
<p>This affects abbrev.rb:</p>
<p>/usr/local/lib/ruby/2.0.0/abbrev.rb:77: warning: character class has duplicated range: /[\w\W]\z/</p>
<p>=end</p> Ruby master - Bug #7464 (Closed): minitest 4.3.2 in r37967 breaks RDoc testshttps://bugs.ruby-lang.org/issues/74642012-11-29T13:10:21Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
With r37966:</p>
<p>$ svnversion<br>
37966<br>
$ make all test-all TESTS='minitest rdoc'<br>
[…]<br>
Finished tests in 7.686270s, 279.0690 tests/s, 677.8320 assertions/s.<br>
2145 tests, 5210 assertions, 0 failures, 0 errors, 16 skips</p>
<p>ruby -v: ruby 2.0.0dev (2012-11-29 trunk 37968) [x86_64-darwin12.2.0]</p>
<p>With r37968:</p>
<p>$ svnversion<br>
37968<br>
$ make all test-all TESTS='minitest rdoc'<br>
[…]</p>
<p>[ 453/2155] TestRDocContext#test_add_method_duplicate = 0.02 s<br>
2) Failure:<br>
test_add_method_duplicate(TestRDocContext) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_context.rb:240]:<br>
--- expected<br>
+++ actual<br>
@@ -1 +1 @@<br>
-"Duplicate method (unknown)#name in file second.rb, previously in file first.rb"<br>
+""</p>
<p>[ 482/2155] TestRDocContextSection#test_sequence = 0.01 s<br>
3) Failure:<br>
test_sequence(TestRDocContextSection) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_context_section.rb:133]:<br>
--- expected<br>
+++ actual<br>
@@ -1,2 +1 @@<br>
-"RDoc::Context::Section#sequence is deprecated, use #aref<br>
-"<br>
+""</p>
<p>[ 501/2155] TestRDocEncoding#test_class_read_file_encoding_invalid = 0.0<br>
4) Failure:<br>
test_class_read_file_encoding_invalid(TestRDocEncoding) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_encoding.rb:111]:<br>
--- expected<br>
+++ actual<br>
@@ -1,2 +1 @@<br>
-"unable to convert "\xE4" on US-ASCII for /var/folders/87/twjsm89x01161gp5d9qwlx2m0000gn/T/test_rdoc_encoding20121128-44686-1a7y2r, skipping<br>
-"<br>
+""</p>
<p>[ 504/2155] TestRDocEncoding#test_class_read_file_encoding_fail = 0.00 s<br>
5) Failure:<br>
test_class_read_file_encoding_fail(TestRDocEncoding) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_encoding.rb:62]:<br>
Expected /^unable to convert/ to match "".</p>
<p>[1441/2155] TestRDocOptions#test_warn = 0.01 s<br>
6) Failure:<br>
test_warn(TestRDocOptions) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_options.rb:580]:<br>
--- expected<br>
+++ actual<br>
@@ -1,2 +1 @@<br>
-"warnings on<br>
-"<br>
+""</p>
<p>[1474/2155] TestRDocOptions#test_check_files_warn = 0.01 s<br>
7) Failure:<br>
test_check_files_warn(TestRDocOptions) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_options.rb:55]:<br>
--- expected<br>
+++ actual<br>
@@ -1,2 +1 @@<br>
-"file 'nonexistent' not found<br>
-"<br>
+""</p>
<p>[1512/2155] TestRDocParserC#test_do_methods_in_cpp = 0.00 s<br>
8) Failure:<br>
test_do_methods_in_cpp(TestRDocParserC) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_parser_c.rb:578]:<br>
Expected /\ blah.cpp\ / to match "".</p>
<p>[1530/2155] TestRDocParserC#test_do_methods_in_c = 0.00 s<br>
9) Failure:<br>
test_do_methods_in_c(TestRDocParserC) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_parser_c.rb:556]:<br>
Expected /\ blah.c\ / to match "".</p>
<p>[1534/2155] TestRDocParserC#test_do_methods_in_y = 0.00 s<br>
10) Failure:<br>
test_do_methods_in_y(TestRDocParserC) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_parser_c.rb:600]:<br>
Expected /\ blah.y\ / to match "".</p>
<p>[1550/2155] TestRDocParserC#test_do_aliases_missing_class = 0.01 s<br>
11) Failure:<br>
test_do_aliases_missing_class(TestRDocParserC) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_parser_c.rb:251]:<br>
--- expected<br>
+++ actual<br>
@@ -1,2 +1 @@<br>
-"Enclosing class or module "cDate" for alias b a is not known<br>
-"<br>
+""</p>
<p>[1558/2155] TestRDocParserC#test_do_missing_cycle = 0.01 s<br>
12) Failure:<br>
test_do_missing_cycle(TestRDocParserC) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_parser_c.rb:669]:<br>
--- expected<br>
+++ actual<br>
@@ -1 +1 @@<br>
-"Unable to create class Y (y), class Z (z) due to a cyclic class or module creation"<br>
+""</p>
<p>[1730/2155] TestRDocRDoc#test_normalized_file_list_non_file_directory =<br>
13) Failure:<br>
test_normalized_file_list_non_file_directory(TestRDocRDoc) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_rdoc.rb:140]:<br>
Expected /^rdoc can't parse/ to match "".</p>
<p>[…]</p>
<p>[2055/2155] TestRDocTask#test_inline_source = 0.01 s<br>
30) Failure:<br>
test_inline_source(TestRDocTask) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_task.rb:23]:<br>
--- expected<br>
+++ actual<br>
@@ -1,2 +1 @@<br>
-"RDoc::Task#inline_source is deprecated<br>
-"<br>
+""</p>
<p>[2072/2155] TestRDocText#test_to_html_tt_tag_mismatch = 0.01 s<br>
31) Failure:<br>
test_to_html_tt_tag_mismatch(TestRDocText) [/Users/drbrain/tmp/trunk/test/rdoc/test_rdoc_text.rb:560]:<br>
--- expected<br>
+++ actual<br>
@@ -1,2 +1 @@<br>
-"mismatched <tt> tag<br>
-"<br>
+""</tt></p>
<p>Finished tests in 8.225325s, 261.9957 tests/s, 634.7470 assertions/s.<br>
2155 tests, 5221 assertions, 14 failures, 0 errors, 17 skips</p>
<p>ruby -v: ruby 2.0.0dev (2012-11-29 trunk 37968) [x86_64-darwin12.2.0]<br>
make: *** [yes-test-all] Error 14</p>
<p>(r37967 is also broken, r37968 is only subversion properties changes)</p>
<p>=end</p> Ruby master - Bug #7107 (Closed): Ruby can no longer find constants in methods in anonymous moduleshttps://bugs.ruby-lang.org/issues/71072012-10-05T10:06:03Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
With ruby 1.9 and newer C cannot be found if m is duplicated:</p>
<p>module M<br>
C = 1</p>
<pre><code>def self.m
C
end
</code></pre>
<p>end</p>
<p>puts 'named module'<br>
M.m</p>
<p>puts 'anonymous module'<br>
m = M.dup<br>
m.m</p>
<p>Ruby 1.8:</p>
<p>$ ruby -v t.rb<br>
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]<br>
named module<br>
anonymous module</p>
<p>With Ruby 1.9:</p>
<p>$ ruby19 -v t.rb<br>
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]<br>
named module<br>
anonymous module<br>
t.rb:5:in <code>m': uninitialized constant Module::C (NameError) from t.rb:14:in </code>'</p>
<p>With trunk:</p>
<pre><code>$ ruby19 -v t.rb
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.0]
named module
anonymous module
t.rb:5:in `m': uninitialized constant Module::C (NameError)
from t.rb:14:in `<main>'
</code></pre>
<p>(({m::C})) works in all three versions, though.<br>
=end</p> Ruby master - Bug #6987 (Closed): have_framework can only be called once in extconf.rbhttps://bugs.ruby-lang.org/issues/69872012-09-06T14:39:30Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
Since r36437 ((|$LDFLAGS|)) will contain a NULL byte if (({have_framework})) is returned successfully.</p>
<p>If extconf.rb attempts to call (({have_framework})) twice to discover multiple frameworks it will now fail:</p>
<p>$ cat test.rb<br>
require 'mkmf'</p>
<p>have_framework 'OpenGL'<br>
have_framework 'GLUT'</p>
<p>$ make runruby<br>
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems ./test.rb<br>
checking for OpenGL... yes<br>
checking for GLUT... /Users/drbrain/Work/svn/ruby/trunk/lib/mkmf.rb:339:in `system': string contains null byte (ArgumentError)<br>
[…]</p>
<p>Since (({have_framework})) makes use of ((|$LDFLAGS|)) the NULL byte causes this exception.</p>
<p>Due to the TODO, I'm unsure what kind of patch should be applied. The easiest would be:</p>
<a name="Index-libmkmfrb"></a>
<h1 >Index: lib/mkmf.rb<a href="#Index-libmkmfrb" class="wiki-anchor">¶</a></h1>
<p>--- lib/mkmf.rb (revision 36915)<br>
+++ lib/mkmf.rb (working copy)<br>
@@ -413,6 +413,7 @@ MSG</p>
<pre><code> def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
librubyarg = $extmk ? $LIBRUBYARG_STATIC : "$(LIBRUBYARG)"
</code></pre>
<ul>
<li>discovered_ldflags = $LDFLAGS.gsub("\0", " ")<br>
conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote,<br>
'src' => "#{CONFTEST_C}",<br>
'arch_hdrdir' => $arch_hdrdir.quote,<br>
@@ -421,7 +422,7 @@ MSG<br>
'CPPFLAGS' => "#$CPPFLAGS",<br>
'CFLAGS' => "#$CFLAGS",<br>
'ARCH_FLAG' => "#$ARCH_FLAG",</li>
</ul>
<ul>
<li>
<pre><code> 'LDFLAGS' => "#$LDFLAGS #{ldflags}",
</code></pre>
</li>
</ul>
<ul>
<li>
<pre><code> 'LDFLAGS' => "#{discovered_ldflags} #{ldflags}",
'LOCAL_LIBS' => "#$LOCAL_LIBS #$libs",
'LIBS' => "#{librubyarg} #{opt} #$LIBS")
</code></pre>
conf['LIBPATH'] = libpathflag(libpath.map {|s| RbConfig::expand(s.dup, conf)})</li>
</ul>
<p>=end</p> Ruby master - Bug #6948 (Closed): addr2line.c does not compile on FreeBSD 8https://bugs.ruby-lang.org/issues/69482012-08-29T14:13:10Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
addr2line.c: In function 'fill_lines':<br>
addr2line.c:462: error: 'SIZE_MAX' undeclared (first use in this function)<br>
addr2line.c:462: error: (Each undeclared identifier is reported only once<br>
addr2line.c:462: error: for each function it appears in.)</p>
<p>On FreeBSD 8, ((|SIZE_MAX|)) is in sys/_stdint.h which is included from sys/stdint.h, but not any of the includes listed. Since ruby/ruby.h also provides ((|SIZE_MAX|)) I tried including it which fixes the problem.</p>
<p>I believe this was introduced with r36755</p>
<p>Please see the attached patch.<br>
=end</p> Ruby master - Bug #6889 (Closed): Restore backwards compatibility of Net::HTTPhttps://bugs.ruby-lang.org/issues/68892012-08-18T08:34:45Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
In Ruby 1.9.3 and earlier net/http defines a constant (({Net::HTTPSession})) which is an alias of (({Net::HTTP})).</p>
<p>In r35761 for <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Break up net/http.rb into individual files (Closed)" href="https://bugs.ruby-lang.org/issues/6435">#6435</a> I accidentally moved the constant to (({Net::HTTP::HTTPSession})).</p>
<p>The attached patch restores net/http to pre-r35761 behavior.<br>
=end</p> Ruby master - Feature #6819 (Closed): OpenSSL::Digest.new should return an instance of the chosen...https://bugs.ruby-lang.org/issues/68192012-08-01T12:27:44Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
(({OpenSSL::Digest.new})) allows you to create a digest given the digest name:</p>
<p>digester = OpenSSL::Digest.new "SHA1"<br>
digester.update "hello"</p>
<a name=""></a>
<h1 >…<a href="#" class="wiki-anchor">¶</a></h1>
<p>The digester returned is of class (({OpenSSL::Digest})) regardless of the input type.</p>
<p>I would like this changed so that it returns the specific subclass of (({OpenSSL::Digest})):</p>
<p>digester = OpenSSL::Digest.new "SHA1"<br>
digester.class #=> OpenSSL::Digest::SHA1</p>
<p>When multiple digests are created this makes it easier to distinguish the type of digest you are working with.</p>
<p>This will also make (({OpenSSL::Digest.new})) behave similarly to (({Digest})):</p>
<p>digester = Digest("SHA1").new<br>
digester.class #=> Digest::SHA1</p>
<p>=end</p> Ruby master - Feature #6622 (Closed): Add <, >, <=, >= to Sethttps://bugs.ruby-lang.org/issues/66222012-06-22T08:05:31Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>Each operator is defined as an alias to an existing method.</p>
<p>From <a href="https://github.com/ruby/ruby/pull/59" class="external">https://github.com/ruby/ruby/pull/59</a></p>
<p>Patch by Alexander E. Fischer: <a href="https://github.com/ruby/ruby/pull/59.diff" class="external">https://github.com/ruby/ruby/pull/59.diff</a></p> Ruby master - Feature #6621 (Closed): Accept a CGI parameter without a valuehttps://bugs.ruby-lang.org/issues/66212012-06-22T07:58:27Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>So "id" will be treaded like "id="</p>
<p>From <a href="https://github.com/ruby/ruby/pull/58" class="external">https://github.com/ruby/ruby/pull/58</a></p>
<p>Patch by Michel Martens: <a href="https://github.com/ruby/ruby/pull/58.diff" class="external">https://github.com/ruby/ruby/pull/58.diff</a></p> Ruby master - Feature #6620 (Closed): Add ' to CGI's HTML escapinghttps://bugs.ruby-lang.org/issues/66202012-06-22T07:53:06Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>From <a href="https://github.com/ruby/ruby/pull/52" class="external">https://github.com/ruby/ruby/pull/52</a></p>
<p>Patch by Igor Sales: <a href="https://github.com/ruby/ruby/pull/52.diff" class="external">https://github.com/ruby/ruby/pull/52.diff</a></p> Ruby master - Feature #6615 (Closed): Release GVL in zlib when calling inflate() or deflate()https://bugs.ruby-lang.org/issues/66152012-06-21T09:20:39Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This patch switches from zstream_run from using rb_thread_schedule() to rb_thread_blocking_region().</p>
<p>I don't see a way to safely interrupt deflate() or inflate() so the unblocking function is empty.</p>
<p>This patch should allow use of output buffer sizes larger than 16KB. I suspect 16KB was chosen to allow reasonable context-switching time for ruby 1.8 and earlier. A larger buffer size would reduce GVL contention when processing large streams.</p>
<p>An alternate way to reduce GVL contention would be to move zstream_run's loop outside the GVL, but some manual allocation would be required as currently the loop uses a ruby String as the output buffer.</p> Ruby master - Feature #6612 (Closed): Add streaming inflate and deflate to Zlibhttps://bugs.ruby-lang.org/issues/66122012-06-20T15:35:13Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
Currently there is no way to control the inflate output size of a deflate stream from ruby. For example, 50MB of "0"s compress to just under 50KB:</p>
<p>ruby -rzlib -e 'p Zlib.deflate("0" * 50_000_000, Zlib::BEST_COMPRESSION).length' #=> 48611</p>
<p>When inflating this, 50MB are allocated which is undesirable.</p>
<p>The attached patch allows Zlib::Inflate#inflate, Zlib::Deflate#deflate, Zlib::ZStream#finish and other methods that end up calling zstream_expand_buffer or zstream_detach_buffer to be called with a block which gives the user more control over the amount of memory allocated in their process. (A fixed maximum chunk size of 16384 bytes is used in this patch.)</p>
<p>The new API looks like:</p>
<p>z = Zlib::Inflate.new<br>
z.inflate deflate_string do |chunk|<br>
# write chunk to output stream<br>
# nil is returned from inflate<br>
end</p>
<p>footer = z.finish</p>
<a name="flush-buffer-to-output-stream"></a>
<h1 >flush buffer to output stream<a href="#flush-buffer-to-output-stream" class="wiki-anchor">¶</a></h1>
<p>Here's a comparison of resource usage:</p>
<p>$ dd if=/dev/zero of=/dev/stdout bs=1m count=1024 | gzip -c > 1G.gz<br>
$ cat test.rb<br>
require 'zlib'</p>
<p>gzipped = File.read '1G.gz'</p>
<p>z = Zlib::Inflate.new Zlib::MAX_WBITS + 32</p>
<p>z.inflate gzipped do |chunk|<br>
# do nothing with chunk<br>
# current ruby will ignore this block<br>
end</p>
<p>z.finish</p>
<p>With existing ruby (trunk 35758) 1GB of memory is allocated:</p>
<p>$ /usr/bin/time -l ruby20 test.rb<br>
3.86 real 3.24 user 0.61 sys<br>
1080475648 maximum resident set size<br>
0 average shared memory size<br>
0 average unshared data size<br>
0 average unshared stack size<br>
263860 page reclaims<br>
0 page faults<br>
0 swaps<br>
0 block input operations<br>
0 block output operations<br>
0 messages sent<br>
0 messages received<br>
0 signals received<br>
1 voluntary context switches<br>
34 involuntary context switches</p>
<p>With the patch only 37MB are allocated:</p>
<p>$ /usr/bin/time -l ./ruby20 -I .ext/x86_64-darwin11.4.0 test.rb<br>
3.47 real 3.43 user 0.03 sys<br>
36724736 maximum resident set size<br>
0 average shared memory size<br>
0 average unshared data size<br>
0 average unshared stack size<br>
8981 page reclaims<br>
0 page faults<br>
0 swaps<br>
0 block input operations<br>
9 block output operations<br>
0 messages sent<br>
0 messages received<br>
0 signals received<br>
1 voluntary context switches<br>
90 involuntary context switches</p>
<p>Some notes about this patch:</p>
<p>zstream_expand_buffer() yields each block of inflate (or deflate) output instead of expanding the buffer (as in non-block output). zstream_expand_buffer_into() is used to reduce duplication as well.</p>
<p>zstream_detach_buffer() yields the buffer and returns nil if a block was given. OBJ_INFECT was moved into zstream_detach_buffer() as well.</p>
<p>A new stream flag ZSTREAM_FLAG_GZFILE is added to prevent a block given to a gzip method that invokes zstream_expand_buffer() or zstream_detach_buffer() from yielding.</p>
<p>To ensure proper handling of ((|z->buf|)) such as resetting the buffer after yielding a chunk, rb_protect is used in zstream_expand_buffer and zstream_run. In zstream_run, the for loop has been extracted to zstream_run_loop.</p>
<p>In zstream_run_loop, Zlib::BufError is no longer raised when flushing (finishing) the stream. This allows the stream to be flushed into one string when the inflate block is interrupted.</p>
<p>=end</p> Ruby master - Feature #6583 (Closed): Improve socket exception message when bind() failshttps://bugs.ruby-lang.org/issues/65832012-06-13T11:42:59Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
If the user tries to bind a port that is already in use the user does not receive any notification of which port (and address) failed. When multiple connections are being made makes it difficult to determine which connection was not correctly bound.</p>
<p>For example, WEBrick binds both IPv4 and IPv6 sockets. If one of the ports is already bound you will receive a confusing error message.</p>
<p>This patch adds the port and address to the error message:</p>
<p>$ cat test.rb<br>
require 'socket'</p>
<p>TCPServer.new '0.0.0.0', 5900<br>
$ make runruby<br>
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems ./test.rb<br>
./test.rb:3:in <code>initialize': Address already in use - bind(2) for "0.0.0.0" port 5900 (Errno::EADDRINUSE) from ./test.rb:3:in </code>new'<br>
from ./test.rb:3:in `'<br>
make: *** [runruby] Error 1</p>
<p>Current behavior:</p>
<p>$ ruby test.rb<br>
test.rb:3:in <code>initialize': Address already in use - bind(2) (Errno::EADDRINUSE) from test.rb:3:in </code>new'<br>
from test.rb:3:in `'</p>
<p>=end</p> Ruby master - Feature #6492 (Closed): Inflate all HTTP Content-Encoding: deflate, gzip, x-gzip re...https://bugs.ruby-lang.org/issues/64922012-05-25T07:37:55Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
This patch moves the compression-handling code from Net::HTTP#get to Net::HTTPResponse to allow decompression to occur by default on any response body. (A future patch will set the Accept-Encoding on all requests that allow response bodies by default.)</p>
<p>Instead of having separate decompression code for deflate and gzip-encoded responses, (({Zlib::Inflate.new(32 + Zlib::MAX_WBITS)})) is used which automatically detects and inflated gzip-wrapped streams which allows for simpler processing of gzip bodies (no need to create a StringIO).<br>
=end</p> Ruby master - Feature #6482 (Closed): Add URI requested to Net::HTTP request and response objectshttps://bugs.ruby-lang.org/issues/64822012-05-23T11:48:16Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
This patch adds the full URI requested to Net::HTTPRequest and Net::HTTPResponse.</p>
<p>The goal of this is to make it easier to handle Location, Refresh, meta-headers, and URIs in retrieved documents. (While the HTTP RFC specifies the Location must be an absolute URI, not every server follows the RFC.) In order to process redirect responses from bad servers or relative URIs in requested documents the user must create an object that contains both the requested URI and the response object to create absolute URIs. This patch reduces the amount of boilerplate they are required to write.</p>
<p>Only the (({request_uri})) is used from the URI given when creating a request. The URI is stored internally and updated with the host, port and scheme used to make the request at request time. The URI is then copied to the response object for use by the user.</p>
<p>To preserve backwards compatibility the new behavior is optional. This allows requests with invalid URI paths like (({Net::HTTP::Get.new '/f%'})) to continue to work. Users of string paths will not be able to retrieve the requested URI.</p>
<p>This patch is for support of <a class="issue tracker-2 status-2 priority-4 priority-default" title="Feature: HTTP user-agent class (Assigned)" href="https://bugs.ruby-lang.org/issues/5064">#5064</a><br>
=end</p> Ruby master - Feature #6435 (Closed): Break up net/http.rb into individual fileshttps://bugs.ruby-lang.org/issues/64352012-05-16T05:01:36Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>The attached patch breaks up net/http.rb into individual files. Beyond addition of "Net::" for scoping only structural changes were made.</p>
<p>I only found uncommitted patches to net/http.rb that were submitted by me, and I think those patches may need some work, so I am fine breaking them for now.</p> Ruby master - Feature #6322 (Closed): Remove iconvhttps://bugs.ruby-lang.org/issues/63222012-04-19T08:06:35Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>Currently when you require 'iconv' it reports a warning:</p>
<p>$ ruby -v -r iconv -e 0<br>
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]<br>
[…]:in `require': iconv will be deprecated in the future, use String#encode instead.</p>
<p>We should remove iconv since we have String#encode now.</p> Backport193 - Backport #6314 (Closed): Backport r35374 and r35375https://bugs.ruby-lang.org/issues/63142012-04-18T11:44:50Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
This will update 1.9.3 to RubyGems 1.8.22 which is primarily bug fixes or interoperability and performance enhancements. The full list of updates since 1.8.11 follows:</p>
<p>=== 1.8.22 / 2012-04-13</p>
<ul>
<li>
<p>4 bug fixes:</p>
<ul>
<li>Workaround for psych/syck YAML date parsing issue</li>
<li>Don't trust the encoding of ARGV. Fixes #307</li>
<li>Quiet default warnings about missing spec variables</li>
<li>Read a binary file properly (windows fix)</li>
</ul>
</li>
</ul>
<p>=== 1.8.21 / 2012-03-22</p>
<ul>
<li>
<p>2 bug fixes:</p>
<ul>
<li>Add workaround for buggy yaml output from 1.9.2</li>
<li>Force 1.9.1 to remove it's prelude code. Fixes #305</li>
</ul>
</li>
</ul>
<p>=== 1.8.20 / 2012-03-21</p>
<ul>
<li>
<p>4 bug fixes:</p>
<ul>
<li>Add --force to <code>gem build</code> to skip validation. Fixes #297</li>
<li>Gracefully deal with YAML::PrivateType objects in Marshal'd gemspecs</li>
<li>Treat the source as a proper url base. Fixes #304</li>
<li>Warn when updating the specs cache fails. Fixes #300</li>
</ul>
</li>
</ul>
<p>=== 1.8.19 / 2012-03-14</p>
<ul>
<li>
<p>3 bug fixes:</p>
<ul>
<li>Handle loading psych vs syck properly. Fixes #298</li>
<li>Make sure Date objects don't leak in via Marshal</li>
<li>Perform Date => Time coercion on yaml loading. Fixes #266</li>
</ul>
</li>
</ul>
<p>=== 1.8.18 / 2012-03-11</p>
<ul>
<li>
<p>4 bug fixes:</p>
<ul>
<li>Use Psych API to emit more compatible YAML</li>
<li>Download and write inside <code>gem fetch</code> directly. Fixes <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: sleep and Thread#run (Closed)" href="https://bugs.ruby-lang.org/issues/289">#289</a></li>
<li>Honor sysconfdir on 1.8. Fixes #291</li>
<li>Search everywhere for a spec for <code>gem spec</code>. Fixes #288</li>
<li>Fix Gem.all_load_path. Fixes <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: StringIO#each and StringIO#readlines does change $_, IO#each and IO#readlines do not (Closed)" href="https://bugs.ruby-lang.org/issues/171">#171</a></li>
</ul>
</li>
</ul>
<p>=== 1.8.17 / 2012-02-17</p>
<ul>
<li>
<p>2 minor enhancements:</p>
<ul>
<li>Add MacRuby to the list of special cases for platforms (ferrous26)</li>
<li>Add a default for where to install rubygems itself</li>
</ul>
</li>
<li>
<p>3 bug fixes:</p>
<ul>
<li>Fixed gem loading issue caused by dependencies not resolving.</li>
<li>Fixed umask error when stdlib is required and unresolved dependencies exist.</li>
<li>Shebang munging would only take one arg after the cmd</li>
<li>Define SUCKAGE better, ie only MRI 1.9.2</li>
<li>Propagate env-shebang to the pristine command if set for install.</li>
</ul>
</li>
</ul>
<p>=== 1.8.16 / 2012-02-12</p>
<ul>
<li>
<p>3 bug fixes:</p>
<ul>
<li>Fix gem specification loading when encoding is not UTF-8. <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: Incorrect line numbers in "caller" output when evaluated in a Proc binding (Closed)" href="https://bugs.ruby-lang.org/issues/146">#146</a></li>
<li>Allow group writable if umask allows it already.</li>
<li>Uniquify the spec list based on directory order priority</li>
</ul>
</li>
</ul>
<p>=== 1.8.15 / 2012-01-06</p>
<ul>
<li>
<p>1 bug fix:</p>
<ul>
<li>Don't eager load yaml, it creates a bad loop. Fixes <a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: defined?(Gem::RubyGemsVersion) behaves strange (Rejected)" href="https://bugs.ruby-lang.org/issues/256">#256</a></li>
</ul>
</li>
</ul>
<p>=== 1.8.14 / 2012-01-05</p>
<ul>
<li>
<p>2 bug fixes:</p>
<ul>
<li>Ignore old/bad cache data in Version</li>
<li>Make sure our YAML workarounds are loaded properly. Fixes <a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: tr で 全角数字が変換されません。 (Rejected)" href="https://bugs.ruby-lang.org/issues/250">#250</a>.</li>
</ul>
</li>
</ul>
<p>=== 1.8.13 / 2011-12-21</p>
<ul>
<li>
<p>1 bug fix:</p>
<ul>
<li>Check loaded_specs properly when trying to satisfy a dep</li>
</ul>
</li>
<li>
<p>2 minor enhancements:</p>
<ul>
<li>Remove using #loaded_path? for performance</li>
<li>Remove Zlib workaround for Windows build.</li>
</ul>
</li>
</ul>
<p>=== 1.8.12 / 2011-12-02</p>
<ul>
<li>Bug fix:
<ul>
<li>Handle more cases where Syck's DefaultKey showed up in requirements<br>
and wasn't cleaned out.</li>
</ul>
</li>
</ul>
<p>=end</p> Ruby master - Feature #6163 (Closed): Remove syck YAML extensionhttps://bugs.ruby-lang.org/issues/61632012-03-17T08:31:41Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
The syck extension should be removed for the following reasons:</p>
<p>Syck only supports YAML 1.0</p>
<p>Syck is not YAML 1.0 compliant.</p>
<p>Syck is not easy to maintain, and many of the bugs existing in it have not been fixed.</p>
<p>Psych uses libyaml for YAML parsing of 1.0 and 1.1 documents.</p>
<p>The libyaml parser is maintained by a third party and shared by many projects so we benefit from bug fixes from a broad user base.</p>
<p>It is too hard to type "Syck" vs "Psych" I often type "Sych" or "Psyck" (joke).<br>
=end</p> Ruby master - Feature #6088 (Closed): Add Net::ReadTimeout to distinguish which operation failedhttps://bugs.ruby-lang.org/issues/60882012-02-26T07:14:39Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>This relates to <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: [PATCH] modernize Timeout usage in net/{http,pop,smtp,telnet} (Closed)" href="https://bugs.ruby-lang.org/issues/5765">#5765</a> which improves use of timeout in net/ and <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Retry idempotent HTTP requests for more errors (Closed)" href="https://bugs.ruby-lang.org/issues/6001">#6001</a> which introduces Net::HTTP::OpenTimeout.</p>
<p>This patch introduces Net::ReadTimeout as a subclass of Timeout::Error and raises it when a read operation takes too long. Users may use this to distinguish between timeouts for reading and timeouts for connecting to a remote host. For a read timeout the user may wish to retry the operation.</p> Ruby master - Bug #6066 (Closed): Fix "control may reach end of non-void function" warnings for c...https://bugs.ruby-lang.org/issues/60662012-02-23T09:39:09Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
clang 3.1 is more picky about "control may reach end of non-void function"</p>
<p>The attached patches contain add (({return Qnil; /* not reached */})) or the equivalent where the warnings occurred.<br>
=end</p> Ruby master - Bug #6009 (Closed): Rapid signal delivery via kill(2) causes SystemStackErrorhttps://bugs.ruby-lang.org/issues/60092012-02-13T16:51:47Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
Running the following program with a trivial signal handler can crash with a SystemStackError if signals are delivered rapidly:</p>
<p>$ ruby -ve 'p Process.pid; trap "USR1" do 10 ** 100; end; sleep'<br>
ruby 2.0.0dev (2012-02-11 trunk 34547) [x86_64-darwin11.2.0]<br>
4504<br>
-e: SystemStackError</p>
<p>In a separate terminal:</p>
<p>ruby -e 'loop do Process.kill "USR1", 4504 end'</p>
<p>As each signal is delivered, ruby interrupts the current signal handler to perform the newly arrived one and quickly runs out of stack.</p>
<p>With an empty system handler the SystemStackError takes slightly longer to occur.</p>
<p>This also occurs with 1.9.3-p0:</p>
<p>$ ~/.multiruby/install/1.9.3-p0/bin/ruby -ve 'p Process.pid; trap "USR1" do 10 ** 100; end; sleep'<br>
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]<br>
4529<br>
-e: SystemStackError</p>
<p>and with ruby-1.9.2-p290:</p>
<p>$ ~/.multiruby/install/1.9.2-p290/bin/ruby -ve 'p Process.pid; trap "USR1" do 10 ** 100; end; sleep'<br>
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]<br>
4534</p>
<p>ruby-1.8.7-p330 exits with a zero exit code:</p>
<p>$ ~/.multiruby/install/1.8.7-p330/bin/ruby -ve 'p Process.pid; trap "USR1" do 10 ** 100; end; sleep'<br>
ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin11.2.0]<br>
4564<br>
$ echo $?<br>
0</p>
<p>=end</p> Ruby master - Bug #6001 (Closed): Retry idempotent HTTP requests for more errorshttps://bugs.ruby-lang.org/issues/60012012-02-11T09:53:52Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>The net-http-persistent gem implements <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: net/http の EOFError と Keep-Alive (Closed)" href="https://bugs.ruby-lang.org/issues/5790">#5790</a> / <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: net/http's EOFError and Keep-Alive (Closed)" href="https://bugs.ruby-lang.org/issues/5813">#5813</a> but for more error types:</p>
<p><a href="https://github.com/drbrain/net-http-persistent/blob/1b5f84d020/lib/net/http/persistent.rb#L811-813" class="external">https://github.com/drbrain/net-http-persistent/blob/1b5f84d020/lib/net/http/persistent.rb#L811-813</a></p>
<p>These additional error types should be rescued by net/http and retried.</p> Backport193 - Backport #6000 (Closed): respond_to? check in check_funcall() does not work with si...https://bugs.ruby-lang.org/issues/60002012-02-11T08:41:35Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin</p>
<p>The following code works in Ruby 1.9.3:</p>
<p>class C<br>
def respond_to? name<br>
super name<br>
end<br>
end</p>
<p>[C.new].flatten</p>
<p>But fails with ArgumentError after r32855:</p>
<p>$ ruby20 -v test.rb<br>
ruby 2.0.0dev (2012-02-11 trunk 34547) [x86_64-darwin11.2.0]<br>
test.rb:2:in <code>respond_to?': wrong number of arguments (2 for 1) (ArgumentError) from test.rb:7:in </code>flatten'<br>
from test.rb:7:in `'</p>
<p>I think this should still work to support legacy 1.9 applications in 2.0</p>
<p>=end</p> Ruby master - Bug #5951 (Closed): Exported RSA keys allow pass phrases that are too shorthttps://bugs.ruby-lang.org/issues/59512012-01-31T09:47:49Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin</p>
<p>Exporting a key with this code:</p>
<p>cipher = OpenSSL::Cipher::Cipher.new 'AES-128-CBC'<br>
pass_phrase = 'woo'</p>
<p>key_secure = key.export cipher, pass_phrase</p>
<p>open 'private.secure.pem', 'w' do |io|<br>
io.write key_secure<br>
end</p>
<p>Is not loadable:</p>
<p>$ ruby20 -v -ropenssl -e 'OpenSSL::PKey::RSA.new File.read "private.secure.pem"'<br>
ruby 2.0.0dev (2011-12-20 trunk 34073) [x86_64-darwin11.2.0]<br>
Enter PEM pass phrase: # I typed woo<br>
phrase is too short, needs to be at least 4 chars</p>
<p>=end</p> Ruby master - Bug #5886 (Closed): OpenSSL ASN.1 time values may not round-trip their typehttps://bugs.ruby-lang.org/issues/58862012-01-12T08:51:11Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>Martin asked me to file this ticket.</p>
<p>asn1time_to_time may not preserve the type of ASN.1 time (GENERALIZED vs UTC) loaded as it always returns a ruby Time without any data tagging.</p> Ruby 1.8 - Bug #5885 (Closed): 32 bit ruby 1.8 cannot load times from SSL certificates past 2038https://bugs.ruby-lang.org/issues/58852012-01-12T08:48:14Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
Since dates past 2038 don't fit in a 32 bit (({time_t})), ruby 1.8's OpenSSL extension cannot load them:</p>
<p>$ cat t.rb<br>
require 'openssl'</p>
<p>cert = OpenSSL::X509::Certificate.new <<-CERT<br>
-----BEGIN CERTIFICATE-----<br>
MIIBRDCB76ADAgECAgEAMA0GCSqGSIb3DQEBBQUAMCoxDzANBgNVBAMMBm5vYm9k<br>
eTEXMBUGCgmSJomT8ixkARkWB2V4YW1wbGUwIBcNMTIwMTExMjE0NDA3WhgPOTk5<br>
OTEyMzEyMzU5NTlaMCoxDzANBgNVBAMMBm5vYm9keTEXMBUGCgmSJomT8ixkARkW<br>
B2V4YW1wbGUwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAscoEP176asKdDtezZ90S<br>
HFr7Sak5uOUrt0vqGg0XX3RqgvBDrHCIIAxPtY9Wzj9dbzU2yyrZGQcaJYbEhecy<br>
WwIDAQABMA0GCSqGSIb3DQEBBQUAA0EAprOCme4eJvWQj3+uZnHsokg/12x9zjHI<br>
Vy1Sxd0QqVqgipzGEHv0SFWAyX0VCZsQyNCCLYDndAI0+q/8dZr+Tw==<br>
-----END CERTIFICATE-----<br>
CERT</p>
<p>p cert.not_before<br>
p cert.not_after</p>
<p>$ ruby -v t.rb<br>
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-freebsd8]<br>
Wed Jan 11 21:44:07 UTC 2012<br>
t.rb:16:in <code>utc': time out of range (ArgumentError) from t.rb:16:in </code>not_after'<br>
from t.rb:16</p>
<p>I've tracked this down to (({ossl_asn1time_to_time()})) in ext/openssl/ossl_asn1.c calling (({Time.utc})):</p>
<p>return rb_funcall2(rb_cTime, rb_intern("utc"), 6, argv);</p>
<p>The certificate is valid:</p>
<p>$ openssl x509 -in t.rb -noout -text<br>
Certificate:<br>
Data:<br>
Version: 3 (0x2)<br>
Serial Number: 0 (0x0)<br>
Signature Algorithm: sha1WithRSAEncryption<br>
Issuer: CN=nobody, DC=example<br>
Validity<br>
Not Before: Jan 11 21:44:07 2012 GMT<br>
Not After : Dec 31 23:59:59 9999 GMT<br>
Subject: CN=nobody, DC=example<br>
Subject Public Key Info:<br>
Public Key Algorithm: rsaEncryption<br>
RSA Public Key: (512 bit)<br>
Modulus (512 bit):<br>
00:b1:ca:04:3f:5e:fa:6a:c2:9d:0e:d7:b3:67:dd:<br>
12:1c:5a:fb:49:a9:39:b8:e5:2b:b7:4b:ea:1a:0d:<br>
17:5f:74:6a:82:f0:43:ac:70:88:20:0c:4f:b5:8f:<br>
56:ce:3f:5d:6f:35:36:cb:2a:d9:19:07:1a:25:86:<br>
c4:85:e7:32:5b<br>
Exponent: 65537 (0x10001)<br>
Signature Algorithm: sha1WithRSAEncryption<br>
a6:b3:82:99:ee:1e:26:f5:90:8f:7f:ae:66:71:ec:a2:48:3f:<br>
d7:6c:7d:ce:31:c8:57:2d:52:c5:dd:10:a9:5a:a0:8a:9c:c6:<br>
10:7b:f4:48:55:80:c9:7d:15:09:9b:10:c8:d0:82:2d:80:e7:<br>
74:02:34:fa:af:fc:75:9a:fe:4f</p>
<p>Note that ruby 1.9 on a 32 bit platform doesn't have this problem since Time always has a 64 bit range:</p>
<p>$ ruby19 -v t.rb<br>
ruby 1.9.2p0 (2010-08-18 revision 29036) [i386-freebsd8]<br>
2012-01-11 21:44:07 UTC<br>
9999-12-31 23:59:59 UTC<br>
=end</p> Ruby master - Bug #5693 (Closed): clang warning in bigdecimalhttps://bugs.ruby-lang.org/issues/56932011-12-01T11:01:53Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>When bigdecimal is compiled under clang I get this warning:</p>
<p>/Users/drbrain/Work/svn/ruby/trunk/ext/bigdecimal<br>
compiling bigdecimal.c<br>
bigdecimal.c:4364:37: warning: array index of '1' indexes past the end of an<br>
array (that contains 1 elements) [-Warray-bounds]<br>
b1b2p1 = b1b2 = b1 * BASE + b->frac[1];<br>
^ ~<br>
./bigdecimal.h:147:5: note: array 'frac' declared here<br>
BDIGIT frac[1]; /* Pointer to array of fraction part. */<br>
^<br>
../.././include/ruby/defines.h:93:17: note: instantiated from:</p>
<a name="define-BDIGIT-unsigned-int"></a>
<h1 >define BDIGIT unsigned int<a href="#define-BDIGIT-unsigned-int" class="wiki-anchor">¶</a></h1>
<pre><code> ^
</code></pre>
<p>1 warning generated.<br>
linking shared-object bigdecimal.bundle<br>
installing default bigdecimal libraries</p>
<p>Paste of warning in case spacing is munged: <a href="http://paste.segment7.net/or.html" class="external">http://paste.segment7.net/or.html</a></p>
<p>I'm using Apple clang 3.0:</p>
<p>$ clang -v<br>
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)<br>
Target: x86_64-apple-darwin11.2.0<br>
Thread model: posix</p>
<p>I dug around in the bigdecimal and it seems that frac is modified to point to a larger array, but perhaps clang has detected a scenario where it is not modified?</p> Ruby master - Bug #5604 (Closed): Remove extra ":" in errors created by ossl_raisehttps://bugs.ruby-lang.org/issues/56042011-11-10T08:37:34Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>Callers of ossl_raise do not need to provide a ":" at the end of the error string because ossl_raise calls ossl_make_error which will add the ":" if necessary.</p>
<p>Without this patch some OpenSSL errors look like "SSL_CTX_set_cipher_list:: no cipher match (OpenSSL::SSL::SSLError)"</p>
<p>This patch removes the extra ":" added by callers of osl_raise so errors look like "SSL_CTX_set_cipher_list: no cipher match (OpenSSL::SSL::SSLError)".</p> Ruby master - Bug #5541 (Closed): Better configure error message when llvm-gcc is the default com...https://bugs.ruby-lang.org/issues/55412011-11-02T05:32:35Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>The error message ./configure gives when llvm-gcc is the default compiler is not very helpful. This patch gives a better message.</p> Ruby master - Feature #5461 (Assigned): Add pipelining to Net::HTTPhttps://bugs.ruby-lang.org/issues/54612011-10-19T07:37:41Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
The attached patch adds HTTP/1.1 pipelining support to Net::HTTP.</p>
<p>Pipelining is only performed on HTTP/1.1 servers. Net::HTTP will check if the server supports pipelining by using the first request in the list. The user can override this via setting (({http.pipelining = true})).</p>
<p>If a server does not support pipelining or there is an error during pipelining an error will be raised that contains the requests that not have been delivered yet and the responses that have been received.</p>
<p>The patch includes documentation explaining the fine details.</p>
<p>Example:</p>
<p>requests = []<br>
requests << Net::HTTP::Get.new('/images/bug.png')<br>
requests << Net::HTTP::Get.new('/images/date.png')<br>
requests << Net::HTTP::Get.new('/images/find.png')</p>
<p>http = Net::HTTP.new 'localhost'<br>
http.start do<br>
http.pipeline requests do |req, res|<br>
open File.basename(req.path), 'wb' do |io|<br>
io.write res.body<br>
end<br>
end<br>
end</p>
<p>Implementation notes:</p>
<ul>
<li>The current Net::HTTP tests make it very difficult to test bad behavior by servers. In test/net/http/utils.rb I introduced a method to replace Net::BufferedIO with a subclass that can behave incorrectly.</li>
<li>Net::HTTP#pipeline does not fall back to sending requests one-by-one for HTTP/1.1 servers. I think this is acceptable as the user can use existing Net::HTTP code to send requests one-by-one.</li>
</ul>
<p>=end</p> Backport193 - Backport #5398 (Closed): Backport r33390 #5349 and r33391 (argument handling)https://bugs.ruby-lang.org/issues/53982011-10-04T08:18:15Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>For r33390, Proc#call documentation is now visible to users</p>
<p>For r33391, Proc#call claims that proc and Proc.new have different handling for incorrect number of arguments which is no longer true.</p> Backport193 - Backport #5397 (Closed): Backport r33386 from #5378 (Deprecate => Gem::Deprecate) t...https://bugs.ruby-lang.org/issues/53972011-10-04T07:24:09Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>RubyGems should not add new constants to the top-level namespace. r33386 fixes this on ruby-trunk and should be backported for 1.9.3p0</p> Ruby master - Feature #5341 (Closed): Add SSL session reuse to Net::HTTPhttps://bugs.ruby-lang.org/issues/53412011-09-20T06:55:53Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>SSL session reuse allows reconnection to an HTTPS server to avoid an SSL handshake which avoids extra computations and network round-trips and increases the performance of SSL connections.</p> Backport193 - Backport #5331 (Closed): Ripper#yydebug and friends don't workhttps://bugs.ruby-lang.org/issues/53312011-09-17T14:52:15Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>Ripper#yydebug, #yydebug=, #end_seen? and #encoding all fail to work with a TypeError due to using a different parser_data_type.</p>
<p>The attached patch fixes this by defining static implementations:</p>
<p>ripper_end_seen_p<br>
ripper_encoding<br>
ripper_get_yydebug<br>
ripper_set_yydebug</p>
<p>I don't know if it's the right patch, though. I tried making parser_data_type an exported symbol but had no luck.</p>
<p>The attached test file adds tests for each of these methods to ensure they work.</p>
<p>PS: redmine is down</p> Ruby master - Bug #5230 (Closed): redmine.ruby-lang.org doesn't describe 1.8 and 1.9 correctlyhttps://bugs.ruby-lang.org/issues/52302011-08-25T09:20:17Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>It states:</p>
<p>Ruby 1.9 - Edge version of Ruby</p>
<p>Ruby 1.8 - Stable development version of Ruby</p>
<p>This should be updated to indicate that Ruby 1.9 is the stable development version like <a href="http://redmine.ruby-lang.org/projects/ruby-19/wiki" class="external">http://redmine.ruby-lang.org/projects/ruby-19/wiki</a></p>
<p>(I tried to figure out how to edit the main page but could not)</p> Ruby master - Feature #5219 (Closed): Array#pack should warn (or raise) if an invalid pack string...https://bugs.ruby-lang.org/issues/52192011-08-24T02:21:16Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>If garbage characters are inserted into the pack string ruby ignores them:</p>
<p>$ ruby19 -e 'p [1, 2, 3].pack("*N")'<br>
"\x00\x00\x00\x01"</p>
<p>$ ruby19 -e 'p [1, 2, 3].pack("yN")'<br>
"\x00\x00\x00\x01"</p>
<p>Ruby should at least warn like printf when -w is active:</p>
<p>$ ruby19 -we 'printf "%d %d", 1, 2, 3'<br>
-e:1: warning: too many arguments for format string</p>
<p>A future version could raise an exception.</p>
<p>See also: <a href="https://github.com/rubinius/rubinius/issues/1127" class="external">https://github.com/rubinius/rubinius/issues/1127</a></p> Ruby master - Bug #5214 (Closed): "not (true)" should not warn "(...) interpreted as grouped expr...https://bugs.ruby-lang.org/issues/52142011-08-23T10:09:54Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>If you have a space between "not" and "(" ruby will warn.</p>
<p>Since it is normal to use "not" with a grouped expression ruby should not warn</p>
<p>The workaround is to remove the space or change to "!" instead of "not"</p> Ruby master - Feature #5064 (Assigned): HTTP user-agent classhttps://bugs.ruby-lang.org/issues/50642011-07-21T13:10:00Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>Currently there are some problems with Net::HTTP:</p>
<ul>
<li>Too many ways to use (user confusion)</li>
<li>No automatic support for HTTPS (must conditionally set use_ssl)</li>
<li>No automatic support for HTTPS peer verification (must be manually set)</li>
<li>Single-connection oriented</li>
<li>No support for redirect-following</li>
<li>No support for HTTP/1.1 persistent connection retry (RFC 2616 8.1.4)</li>
<li>No automatic support for HTTP proxies</li>
<li>No automatic support for authentication (must be set per-request)</li>
</ul>
<p>Additionally the style of the API of Net::HTTP makes it difficult to take advantage of persistent connections. The user has to store the created connection and manually handle restarting the connection if it has timed out or is closed by the server.</p>
<p>RFC 2616 8.1.1 has a large section explaining the benefits of persistent connections, but while Net::HTTP implements persistent connections they could be easier for users to implement with next work.</p>
<p>I've implemented support for many of these additional features of Net::HTTP in various projects and I'd like Ruby to have the features required to make a useful HTTP user-agent built-in.</p>
<p>The agent should have the following responsibilities:</p>
<ul>
<li>Make or reuse connections based on [host, port, SSL enabled]</li>
<li>Automatically enable SSL for https URIs</li>
<li>Automatically enable SSL peer verification for SSL connections</li>
<li>Limit number of persistent connections per host</li>
<li>Follow redirects</li>
<li>Retry when a persistent connection fails</li>
<li>Automatically configure proxies</li>
<li>Automatically use authentication</li>
<li>Callbacks for various options connect</li>
</ul>
<p>The agent may add the following responsibilities:</p>
<ul>
<li>Default headers for all requests</li>
<li>HTTP cookies</li>
<li>Tracking history</li>
<li>Logging</li>
</ul>
<p>I don't think any of these features are critical as they are implementable by users via callbacks.</p>
<p>The agent would have the following configurable items:</p>
<ul>
<li>Number of connections per host</li>
<li>Depth of redirects followed</li>
<li>Persistent connection retries (none, HTTP/1.1 (default), always)</li>
<li>Proxy host, port, user, password</li>
</ul>
<p>I think the class should be called Net::HTTP::Agent.</p>
<p>Basic use would look something like this:</p>
<p>uris = [<br>
URI('http://example/1'),<br>
URI('http://example/2'),<br>
URI('https://secure.example'),<br>
]</p>
<p>agent = Net::HTTP::Agent.new</p>
<p>uris.map do |uri|<br>
agent.get uri # Returns Net::HTTPResponse<br>
end</p>
<p>For special requests a Net::HTTPRequest could be constructed:</p>
<p>req = Net::HTTP::Get.new uri.request_uri</p>
<a name="do-something-special-with-req"></a>
<h1 >do something special with req<a href="#do-something-special-with-req" class="wiki-anchor">¶</a></h1>
<p>agent.request req</p>
<p>The agent should support GET, POST, etc. directly through API methods. I think the API should look something like this:</p>
<p>def get uri_or_string, query = nil, headers = nil</p>
<a name="Same-for-other-requests-with-no-body"></a>
<h1 >Same for other requests with no body<a href="#Same-for-other-requests-with-no-body" class="wiki-anchor">¶</a></h1>
<h1></h1>
<a name="query-may-be-a-Hash-or-String"></a>
<h1 >query may be a Hash or String<a href="#query-may-be-a-Hash-or-String" class="wiki-anchor">¶</a></h1>
<a name="How-query-param-vs-query-string-in-URI-is-used-is-undecided"></a>
<h1 >How query param vs query string in URI is used is undecided<a href="#How-query-param-vs-query-string-in-URI-is-used-is-undecided" class="wiki-anchor">¶</a></h1>
<p>def post uri_or_string, data, headers = nil</p>
<a name="same-for-other-requests-with-a-body"></a>
<h1 >same for other requests with a body<a href="#same-for-other-requests-with-a-body" class="wiki-anchor">¶</a></h1>
<h1></h1>
<a name="data-may-be-a-String-IO-or-Hash"></a>
<h1 >data may be a String, IO or Hash<a href="#data-may-be-a-String-IO-or-Hash" class="wiki-anchor">¶</a></h1>
<a name="How-data-format-is-chosen-is-undecided"></a>
<h1 >How data format is chosen is undecided<a href="#How-data-format-is-chosen-is-undecided" class="wiki-anchor">¶</a></h1>
<p>SSL options, proxy options, timeouts and similar options should exist on Net::HTTP::Agent and be set on new connections as they are made.</p>
<p>I've implemented most of these features in mechanize as Mechanize::HTTP::Agent. The Agent class in mechanize is bigger than is necessary and would need to be cut-down for inclusion in Ruby as Net::HTTP::Agent</p>
<p><a href="https://github.com/tenderlove/mechanize/blob/master/lib/mechanize/http/agent.rb" class="external">https://github.com/tenderlove/mechanize/blob/master/lib/mechanize/http/agent.rb</a></p>
<p>Mechanize depends on net-http-persistent to provide HTTP/1.1 retry support and connection management:</p>
<p><a href="https://github.com/drbrain/net-http-persistent/blob/master/lib/net/http/persistent.rb" class="external">https://github.com/drbrain/net-http-persistent/blob/master/lib/net/http/persistent.rb</a></p>
<p>Portions of net-http-persistent should be patches of Net::HTTP, for example #idempotent? #can_retry?, #reset and portions of #request. Other parts (connection management) should be moved to Net::HTTP::Agent.</p>
<p>net-http-persistent provides a separate connection list per thread. I would like Net::HTTP::Agent to be multi-thread friendly but implementing this in another way would be fine.</p>
<p>As an addendum, open-uri and mechanize should be written to take advantage of Net::HTTP::Agent on order to guide useful implementation.</p> Ruby master - Bug #4991 (Closed): Add a method to retrieve raw data from GC::Profilerhttps://bugs.ruby-lang.org/issues/49912011-07-08T09:34:05Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>GC::Profiler.result gives a String report but there is no access to the raw profile data. There is no way to extract data for automatic comparison without parsing the output String.</p>
<p>The attached patch adds GC::Profile.data which exposes gc_profile_record_get.</p>
<p>This allows tools that can automatically compare profile runs to be written without parsing.</p> Ruby master - Bug #4989 (Closed): Document Socket constantshttps://bugs.ruby-lang.org/issues/49892011-07-08T05:43:46Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>The attached patch documents most of the Socket constants by adding a third field to ext/socket/mkconstants.rb containing the documentation.</p>
<p>I'm not sure if all the documentation I wrote is correct since finding the appropriate information across all the supported platforms was difficult.</p>
<p>May I commit it?</p> Ruby master - Feature #4982 (Closed): Print difference of benchmark runs for `make benchmark`https://bugs.ruby-lang.org/issues/49822011-07-06T13:19:53Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>The attached patch adds printing of the difference in time between BASERUBY and RUNRUBY when <code>make benchmark</code> is run.</p>
<p>This makes it easy to quickly determine if changes have increased or decreased the speed of ruby.</p> Ruby master - Feature #4896 (Closed): Add newpad() support to Curseshttps://bugs.ruby-lang.org/issues/48962011-06-18T06:41:22Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>The ruby curses library lacks support for scrolling regions via newpad(). This patch adds support for newpad() as a subclass of Curses::Window.</p>
<p>May I apply it?</p> Ruby master - Bug #4550 (Closed): Loading an RSA public key during an HTTPS connection corrupts t...https://bugs.ruby-lang.org/issues/45502011-04-04T05:20:42Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
The attached file creates an HTTPS connection to gmail.com then loads an RSA public key.</p>
<p>If a private key is loaded the error does not reproduce.</p>
<p>Loading of the public key corrupts the HTTPS connection resulting in the following error:</p>
<p>SSL_read:: no start line (OpenSSL::SSL::SSLError)</p>
<p>full output:</p>
<p>$ ruby19 -v -Ilib t.rb<br>
ruby 1.9.3dev (2011-03-30 trunk 31213) [x86_64-darwin10.6.0]<br>
opening connection to <a href="http://www.gmail.com" class="external">www.gmail.com</a>...<br>
opened<br>
<- "GET / HTTP/1.1\r\nAccept: <em>/</em>\r\nUser-Agent: Ruby\r\nHost: <a href="http://www.gmail.com%5Cr%5Cn%5Cr%5Cn" class="external">www.gmail.com\r\n\r\n</a>"<br>
-> "HTTP/1.1 301 Moved Permanently\r\n"<br>
-> "Location: <a href="https://mail.google.com/mail/%5Cr%5Cn" class="external">https://mail.google.com/mail/\r\n</a>"<br>
-> "Content-Type: text/html; charset=UTF-8\r\n"<br>
-> "X-Content-Type-Options: nosniff\r\n"<br>
-> "Date: Sun, 03 Apr 2011 20:15:44 GMT\r\n"<br>
-> "Expires: Tue, 03 May 2011 20:15:44 GMT\r\n"<br>
-> "Server: sffe\r\n"<br>
-> "Content-Length: 226\r\n"<br>
-> "X-XSS-Protection: 1; mode=block\r\n"<br>
-> "Cache-Control: public, max-age=2592000\r\n"<br>
-> "Age: 123\r\n"<br>
-> "\r\n"<br>
reading 226 bytes...<br>
-> ""<br>
-> "</p><meta http-equiv="content-type" content="text/html;charset=utf-8">\n<TITLE>301 Moved</TITLE>\n<a name="301-Moved"></a>
<h1 >301 Moved<a href="#301-Moved" class="wiki-anchor">¶</a></h1>\nThe document has moved\n<A HREF="<a href="https://mail.google.com/mail/%5C%22%3Ehere" class="external">https://mail.google.com/mail/\">here</a>.\r\n\r\n"<br>
read 226 bytes<br>
Conn keep-alive<br>
<- "GET / HTTP/1.1\r\nAccept: <em>/</em>\r\nUser-Agent: Ruby\r\nHost: <a href="http://www.gmail.com%5Cr%5Cn%5Cr%5Cn" class="external">www.gmail.com\r\n\r\n</a>"<br>
Conn close because of error SSL_read:: no start line<br>
/usr/local/lib/ruby/1.9.1/openssl/buffering.rb:174:in <code>sysread_nonblock': SSL_read:: no start line (OpenSSL::SSL::SSLError) from /usr/local/lib/ruby/1.9.1/openssl/buffering.rb:174:in </code>read_nonblock'<br>
from /usr/local/lib/ruby/1.9.1/net/protocol.rb:139:in <code>rbuf_fill' from /usr/local/lib/ruby/1.9.1/net/protocol.rb:120:in </code>readuntil'<br>
from /usr/local/lib/ruby/1.9.1/net/protocol.rb:130:in <code>readline' from /usr/local/lib/ruby/1.9.1/net/http.rb:2517:in </code>read_status_line'<br>
from /usr/local/lib/ruby/1.9.1/net/http.rb:2506:in <code>read_new' from /usr/local/lib/ruby/1.9.1/net/http.rb:1296:in </code>transport_request'<br>
from /usr/local/lib/ruby/1.9.1/net/http.rb:1271:in <code>request' from t.rb:18:in </code>block in '<br>
from /usr/local/lib/ruby/1.9.1/net/http.rb:732:in <code>start' from t.rb:11:in </code>'
<p>This bug was originally reported on mechanize: <a href="https://github.com/tenderlove/mechanize/issues#issue/27" class="external">https://github.com/tenderlove/mechanize/issues#issue/27</a><br>
=end</p> Ruby master - Bug #4382 (Closed): Encoding of result string for String#gsub! is not consistent fo...https://bugs.ruby-lang.org/issues/43822011-02-08T05:27:02Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
When String#sub! is called on a string in BINARY encoding the encoding may be changed to the replacement encoding.</p>
<p>This is due to rb_enc_compatible()</p>
<p>If this is a feature the documentation should be updated to indicate this.</p>
<p>Attached is a test patch.<br>
=end</p> Ruby master - Bug #4381 (Closed): Encoding of result is not consistent for String#[]=https://bugs.ruby-lang.org/issues/43812011-02-08T05:11:05Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
The encoding may be changed to a compatible encoding by rb_enc_check().</p>
<p>If this is a feature the documentation should be updated.<br>
=end</p> Ruby master - Bug #4380 (Closed): Encoding of result string for String#gsub! is not consistent fo...https://bugs.ruby-lang.org/issues/43802011-02-08T04:50:19Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
When String#gsub! is called on a string in BINARY encoding the encoding may be changed to the replacement encoding.</p>
<p>Attached is a test patch.<br>
=end</p> Backport192 - Backport #4369 (Closed): Backport r30772 Zlib::GzipReader#unused fix to 1_9_2https://bugs.ruby-lang.org/issues/43692011-02-05T04:58:13Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
This should not wait for 1.9.3</p>
<p>See <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Zlib::GzipReader#unused raises "called on hidden object" error when called (Closed)" href="https://bugs.ruby-lang.org/issues/4360">#4360</a><br>
=end</p> Ruby master - Bug #4340 (Closed): Encoding of result string for String#gsub is not consistenthttps://bugs.ruby-lang.org/issues/43402011-01-29T09:54:28Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
Depending upon where the replacement occurs, the encoding of the result of String#gsub is not consistent.</p>
<p>When the replacement happens at the beginning of the string the encoding of the result is the encoding of the replacement string.</p>
<p>When the replacement happens elsewhere in the string the encoding of the result is the result of the original string.</p>
<p>With String#sub the encoding of the result is the encoding of the original string always.</p>
<p>$ cat t.rb<br>
puts 'using gsub'<br>
hello_world = 'Hello World!'<br>
hello_world.force_encoding Encoding::UTF_8</p>
<p>everybody = 'Everybody'<br>
everybody.force_encoding Encoding::US_ASCII</p>
<p>hello_everybody = hello_world.gsub(/World/, 'Everybody')</p>
<p>p hello_everybody<br>
p hello_everybody.encoding</p>
<p>hi = 'Hi'<br>
hi.force_encoding Encoding::US_ASCII</p>
<p>hi_world = hello_world.gsub(/Hello/, 'Hi')</p>
<p>p hi_world<br>
p hi_world.encoding</p>
<p>puts 'using sub'<br>
hello_world = 'Hello World!'<br>
hello_world.force_encoding Encoding::UTF_8</p>
<p>everybody = 'Everybody'<br>
everybody.force_encoding Encoding::US_ASCII</p>
<p>hello_everybody = hello_world.sub(/World/, 'Everybody')</p>
<p>p hello_everybody<br>
p hello_everybody.encoding</p>
<p>hi = 'Hi'<br>
hi.force_encoding Encoding::US_ASCII</p>
<p>hi_world = hello_world.sub(/Hello/, 'Hi')</p>
<p>p hi_world<br>
p hi_world.encoding</p>
<p>$ ruby19 -v t.rb<br>
ruby 1.9.3dev (2011-01-26 trunk 30659) [x86_64-darwin10.6.0]<br>
using gsub<br>
"Hello Everybody!"<br>
#<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a><br>
"Hi World!"<br>
#<a href="Encoding:US-ASCII" class="external">Encoding:US-ASCII</a><br>
using sub<br>
"Hello Everybody!"<br>
#<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a><br>
"Hi World!"<br>
#<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a><br>
=end</p> Ruby master - Feature #4116 (Closed): OpenSSL::X509::Name provides <=> but not ==https://bugs.ruby-lang.org/issues/41162010-12-04T11:45:14Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
It is not easy to compare to X509 Name objects.</p>
<p>#<=> is provided allowing equality or ordering to be determined only through roundabout means.</p>
<p>#hash and #eql? are provided using the same underlying C call as #<=></p>
<p>The attached patch includes Comparable in OpenSSL::X509::Name and some additional documentation for #initialize.<br>
=end</p> Ruby master - Feature #4100 (Closed): Improve Net::HTTP documentationhttps://bugs.ruby-lang.org/issues/41002010-11-30T05:36:18Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
The attached patch reorganizes and further explains how to use Net::HTTP.</p>
<p>The patch emphasizes using the persistent connection APIs over the simpler but more convenient non-persistent APIs.</p>
<p>The documentation now starts with an example using start/request, continues to describing how to extract data from a response, follow redirects and make POSTs which should be the most common operations.</p>
<p>Following that is examples for setting headers, basic authentication, streaming response bodies, HTTPS and proxies.</p>
<p>HTTPS documentation was moved from net/https.rb to the appropriate locations in Net::HTTP.</p>
<p>The final examples are for the Net::HTTP class methods ::get, ::get_response and ::post_form as they do not maintain persistent connections.</p>
<p>The HTTP request and response class sections have been modified to use rdoc lists.</p>
<p>The patch is on top of Mike Perham's patch in <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: net/http rdoc improvements (Closed)" href="https://bugs.ruby-lang.org/issues/4093">#4093</a> but moves the username/password Net::HTTP::Proxy example to the Net::HTTP::Proxy method.<br>
=end</p> Ruby master - Bug #3671 (Rejected): DateTime dumped by Marshal from ruby 1.8 cannot be loaded by ...https://bugs.ruby-lang.org/issues/36712010-08-10T09:58:18Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
$ ruby -rdate -e 'Marshal.dump DateTime.now, $stdout' | ruby19 -rdate -e 'p Marshal.load $stdin.read'<br>
-e:1:in <code>load': class DateTime needs to have method </code>_load' (TypeError)<br>
from -e:1:in `'</p>
<p>$ ruby -v<br>
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]<br>
$ ruby19 -v<br>
ruby 1.9.3dev (2010-07-07 trunk 28561) [x86_64-darwin10.4.0]</p>
<p>Ruby 1.9 should implement DateTime._load in order to load from older versions<br>
=end</p> Ruby master - Feature #3622 (Closed): Net::HTTP does not wait to send request body with Expect: 1...https://bugs.ruby-lang.org/issues/36222010-07-28T15:08:48Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
HTTP/1.1 allows a client to determine if the server will accept a request body using the Expect header with a value of 100-continue. If the server finds the request header the client sent acceptable it will return with a 100 Continue response and the client will then send the request body.</p>
<p>Instead of waiting for a 100 Continue response Net::HTTP immediately sends the request body and ignores any 100 Continue responses.</p>
<p>The current behavior defeats the purpose of the Expect: 100-continue value and the 100 Continue response code.</p>
<p>If I am attempting to upload a large file like a photo and to a server that requires HTTP authentication I will have to wait until the upload is complete before I can retrieve a 401 response for incorrect authentication.</p>
<p>I have attached a proposed patch that adds a continue timeout. Net::HTTP will wait up to the continue timeout before sending the request body.<br>
=end</p> Ruby master - Bug #3076 (Closed): lib/rake/rdoctask.rb should be removedhttps://bugs.ruby-lang.org/issues/30762010-04-01T17:00:43Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
RDoc provides RDoc::Task (and Rake::RDocTask for backwards compatibility).</p>
<p>This is no longer Rake's responsibility, so it should be removed or changed to require 'rdoc/task'</p>
<p>Also, test/rake/test_rdoc_task.rb should be removed.</p>
<p>This will also fix the following test warnings and errors:</p>
<p>ruby/trunk/lib/rdoc/task.rb:250: warning: already initialized constant RDocTask</p>
<ol>
<li>
<p>Failure:<br>
test_inline_source_is_enabled_by_default(Rake::TestRDocTask) [/Users/drbrain/Work/svn/ruby/trunk/test/rake/test_rdoc_task.rb:65]:<br>
Failed assertion, no message given.</p>
</li>
<li>
<p>Error:<br>
test_inline_source_option_can_be_disabled(Rake::TestRDocTask):<br>
NoMethodError: undefined method <code>inline_source=' for #<RDoc::Task:0x00000101150bb0> /Users/drbrain/Work/svn/ruby/trunk/test/rake/test_rdoc_task.rb:81:in </code>test_inline_source_option_can_be_disabled'<br>
=end</p>
</li>
</ol> Ruby master - Bug #1713 (Closed): IMAP NO response messages are unavailablehttps://bugs.ruby-lang.org/issues/17132009-07-02T07:25:12Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
In RFC 3501 the IMAP server may respond with information the user can use to retry their request.</p>
<p>For the COPY command (6.4.7):</p>
<pre><code> If the destination mailbox does not exist, a server SHOULD return
an error. It SHOULD NOT automatically create the mailbox. Unless
it is certain that the destination mailbox can not be created, the
server MUST send the response code "[TRYCREATE]" as the prefix of
the text of the tagged NO response. This gives a hint to the
client that it can attempt a CREATE command and retry the COPY if
the CREATE is successful.
</code></pre>
<p>Also for the SEARCH command (6.4.4):</p>
<pre><code> If the server does not support the specified [CHARSET], it MUST
return a tagged NO response (not a BAD). This response SHOULD
contain the BADCHARSET response code, which MAY list the
[CHARSET]s supported by the server.
</code></pre>
<p>Net::IMAP doesn't easily give access to this information. For example:</p>
<p>$ cat imap_copy.rb<br>
require 'net/imap'</p>
<p>Net::IMAP.debug = true<br>
imap = Net::IMAP.new 'localhost', 143<br>
imap.login 'test', 'test'<br>
imap.select 'INBOX'<br>
uids = imap.search 'ALL'<br>
begin<br>
imap.copy uids, 'no such mailbox'<br>
puts 'copy successful'<br>
rescue Net::IMAP::NoResponseError => e<br>
p e<br>
end<br>
$ ruby imap_copy.rb<br>
S: * OK Dovecot ready.<br>
[...]<br>
C: RUBY0004 COPY 1 "no such mailbox"<br>
S: RUBY0004 NO [TRYCREATE] Mailbox doesn't exist: no such mailbox<br>
#<Net::IMAP::NoResponseError: Mailbox doesn't exist: no such mailbox></p>
<p>Here the server told us we could probably fix this by sending CREATE first, so we could handle this intelligently. Unfortunately, we can't tell if the mailbox outright doesn't exist or if it simply can't be selected:</p>
<p>irb(main):016:0> imap.list '', 'directory'<br>
C: RUBY0012 LIST "" directory<br>
S: * LIST (\Noselect \HasChildren) "/" "directory"<br>
S: RUBY0012 OK List completed.</p>
<p>irb(main):015:0> imap.copy [1], 'directory'<br>
C: RUBY0011 COPY 1 directory<br>
S: RUBY0011 NO Mailbox isn't selectable: directory</p>
<p>The attached patch adds the response to Net::IMAP::ResponseError which allows us to behave intelligently:</p>
<p>$ cat imap_copy.rb<br>
require 'net/imap'</p>
<p>Net::IMAP.debug = true<br>
imap = Net::IMAP.new 'localhost', 143<br>
imap.login 'test', 'test'<br>
imap.select 'INBOX'<br>
uids = imap.search 'ALL'</p>
<p>begin<br>
imap.copy uids, 'no such mailbox'<br>
puts 'copy successful'<br>
rescue Net::IMAP::NoResponseError => e<br>
raise unless e.response.data.code.name == 'TRYCREATE'<br>
imap.create 'no such mailbox'<br>
imap.copy uids, 'no such mailbox'<br>
end<br>
$ ruby imap_copy.rb<br>
S: * OK Dovecot ready.<br>
[...]<br>
C: RUBY0004 COPY 1 "no such mailbox"<br>
S: RUBY0004 NO [TRYCREATE] Mailbox doesn't exist: no such mailbox<br>
C: RUBY0005 CREATE "no such mailbox"<br>
S: RUBY0005 OK Create completed.<br>
C: RUBY0006 COPY 1 "no such mailbox"<br>
S: RUBY0006 OK [COPYUID 1 64 1] Copy completed.<br>
=end</p> Ruby master - Bug #1474 (Closed): autoload causes "circular require considered harmful" warning w...https://bugs.ruby-lang.org/issues/14742009-05-16T06:25:21Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
$ cat a.rb<br>
autoload :B, 'b'</p>
<p>B<br>
$ cat b.rb<br>
class B<br>
end<br>
$ ruby19 -wv a.rb<br>
ruby 1.9.2dev (2009-05-15 trunk 23433) [i386-darwin9.7.0]<br>
Error loading gem paths on load path in gem_prelude<br>
no implicit conversion from nil to integer<br>
<a href="internal:gem_prelude" class="external">internal:gem_prelude</a>:320:in <code>[]=' <internal:gem_prelude>:320:in </code>push_all_highest_version_gems_on_load_path'<br>
<a href="internal:gem_prelude" class="external">internal:gem_prelude</a>:344:in `'<br>
/Users/drbrain/tmp/b.rb:1: warning: loading in progress, circular require considered harmful - /Users/drbrain/tmp/b.rb<br>
=end</p> Ruby master - Bug #178 (Closed): File.open on sprintf-formatted string fails with encoding conver...https://bugs.ruby-lang.org/issues/1782008-06-18T09:44:02Zdrbrain (Eric Hodel)drbrain@segment7.net
<p>=begin<br>
String#% and File.open are interacting strangely on OS X, so files opened with a sprintf formatted string raise an ArgumentError:</p>
<p>$ ruby19 -vwe 'File.new("foo" % [])'<br>
ruby 1.9.0 (2008-06-18 revision 15873) [i686-darwin9.3.0]<br>
-e:1:in <code>initialize': transcoding not supported (from US-ASCII to UTF8-MAC) (ArgumentError) from -e:1:in </code>new'<br>
from -e:1:in `'</p>
<p>Using just "foo" as the filename works fine:</p>
<p>$ ruby19 -we 'File.new("foo")'</p>
<p>As does String#<<:</p>
<p>$ ruby19 -we 'File.new("foo" << "")'<br>
=end</p>