Package: libruby1.8
Version: 1.8.7.248-1
Severity: normal
Tags: patch

I have some code that does web fetches and sometimes expects them to
fail, but interprets the failure and continues running.

That's how it used to work, but as of the latest libruby1.8 upgrade, it
breaks with the following exception:

/usr/lib/ruby/1.8/net/http.rb:1060:in `request': undefined method `closed?' for 
nil:NilClass (NoMethodError)

The problem is evidently that @socket may sometimes be nil in this case.

I've attached a patch (against the live net/http.rb file) that seems
to fix the issue, though it ought to be scrutinised a bit more -- I
don't know if it's just masking an deeper underlying problem /
erroneous assumption.

-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'oldstable'), (500, 'unstable'), (500, 
'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libruby1.8 depends on:
ii  libc6                  2.9-7             GNU C Library: Shared libraries
ii  libncurses5            5.7+20081213-1    shared libraries for terminal hand
ii  zlib1g                 1:1.2.3.3.dfsg-12 compression library - runtime

libruby1.8 recommends no packages.

libruby1.8 suggests no packages.

-- no debconf information
--- /usr/lib/ruby/1.8/net/http.rb.orig	2010-01-07 23:53:20.000000000 -0500
+++ /usr/lib/ruby/1.8/net/http.rb	2010-01-07 23:52:54.000000000 -0500
@@ -1057,7 +1057,7 @@
       res
     rescue => exception
       D "Conn close because of error #{exception}"
-      @socket.close unless @socket.closed?
+      @socket.close unless @socket.nil? || @socket.closed?
       raise exception
     end
 

Attachment: signature.asc
Description: Digital signature

Reply via email to