* [sup-devel] [PATCH] eliminated nil-to-integer error when standard library ruby code calls make_tmpname with n=nil
@ 2011-02-21 21:17 Roni Choudhury
2011-02-21 23:26 ` Alvaro Herrera
0 siblings, 1 reply; 3+ messages in thread
From: Roni Choudhury @ 2011-02-21 21:17 UTC (permalink / raw)
To: sup-devel
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.
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
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [sup-devel] [PATCH] eliminated nil-to-integer error when standard library ruby code calls make_tmpname with n=nil
2011-02-21 21:17 [sup-devel] [PATCH] eliminated nil-to-integer error when standard library ruby code calls make_tmpname with n=nil Roni Choudhury
@ 2011-02-21 23:26 ` Alvaro Herrera
2011-02-21 23:54 ` Roni Choudhury
0 siblings, 1 reply; 3+ messages in thread
From: Alvaro Herrera @ 2011-02-21 23:26 UTC (permalink / raw)
To: sup-devel
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 <alvherre@alvh.no-ip.org>
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [sup-devel] [PATCH] eliminated nil-to-integer error when standard library ruby code calls make_tmpname with n=nil
2011-02-21 23:26 ` Alvaro Herrera
@ 2011-02-21 23:54 ` Roni Choudhury
0 siblings, 0 replies; 3+ messages in thread
From: Roni Choudhury @ 2011-02-21 23:54 UTC (permalink / raw)
To: sup-devel
Excerpts from Alvaro Herrera's message of 2011-02-21 16:26:07 -0700:
> 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?
>
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
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-22 0:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-21 21:17 [sup-devel] [PATCH] eliminated nil-to-integer error when standard library ruby code calls make_tmpname with n=nil Roni Choudhury
2011-02-21 23:26 ` Alvaro Herrera
2011-02-21 23:54 ` Roni Choudhury
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox