Subject: Re: [sup-devel] [PATCH] eliminated nil-to-integer error when standard library ruby code calls make_tmpname with n=nil

From: Alvaro Herrera <[email-masked]>
Date: Mon, 21 Feb 2011 20:26:07 -0300

Excerpts from Roni Choudhury's message of lun feb 21 18:17:04 -0300 2011:
> I was getting an error from monkeypatched code that didn't seem to
> call into the standard library properly... this patch seemed to fix
> things for me, but I didn't fully understand what was going on here.

Seems like the way to really solve the problem would be to figure out
what's calling make_tmpname with a nil n, and fix that instead.  Is it
possible for you to figure that out from the trace?

-- 
Álvaro Herrera <[email-masked]>
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel

---

From: Roni Choudhury <[email-masked]>
Date: Mon, 21 Feb 2011 14:17:04 -0700

roni

---
 lib/sup/message-chunks.rb |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index c275f41..90137da 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -34,7 +34,11 @@ require 'tempfile'
 ## monkey-patch time: make temp files have the right extension
 class Tempfile
   def make_tmpname basename, n
-    sprintf '%d-%d-%s', $$, n, basename
+    if n == nil
+      sprintf '%d-nil-%s', $$, basename
+    else
+      sprintf '%d-%d-%s', $$, n, basename
+    end
   end
 end
 
-- 
1.7.3.2

---

From: Roni Choudhury <[email-masked]>
Date: Mon, 21 Feb 2011 16:54:28 -0700

> possible for you to figure that out from the trace?

I believe I did track it down, and it looked like a custom use for
make_tmpname somewhere... I could figure it out again, but I was also
informed in the IRC channel that this fix has already been applied to
master under different circumstances.

roni