Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [issue105] crash exception when viewing attachment with /s in filename
@ 2010-05-29  2:31 =?utf-8?q?=C3=81lvaro_Herrera_=3Csup-bugs=40masanjin=2Enet=3E?=
  0 siblings, 0 replies; only message in thread
From: =?utf-8?q?=C3=81lvaro_Herrera_=3Csup-bugs=40masanjin=2Enet=3E?= @ 2010-05-29  2:31 UTC (permalink / raw)
  To: sup-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 1448 bytes --]


New submission from Álvaro Herrera <alvherre@alvh.no-ip.org>:

Got this exception today:

--- RuntimeError from thread: main
cannot generate tempfile `/home/alvherre/tmp/13416-9-/pgpatches/regexp'
/usr/lib/ruby/1.8/tempfile.rb:52:in `initialize'
/usr/lib/ruby/1.8/sup/message-chunks.rb:152:in `new'
/usr/lib/ruby/1.8/sup/message-chunks.rb:152:in `write_to_disk'
/usr/lib/ruby/1.8/sup/message-chunks.rb:145:in `view!'
/usr/lib/ruby/1.8/sup/modes/thread-view-mode.rb:839:in `view'
/usr/lib/ruby/1.8/sup/modes/thread-view-mode.rb:341:in `activate_chunk'
/usr/lib/ruby/1.8/sup/mode.rb:59:in `send'
/usr/lib/ruby/1.8/sup/mode.rb:59:in `handle_input'
/usr/lib/ruby/1.8/sup/buffer.rb:279:in `handle_input'
/usr/bin/sup-mail:277

The problem is that the attachment contains forward slashes in the filename, and 
this makes tempfile to raise an exception because it's expecting the directory 
to exist.

Example message: http://archives.postgresql.org/msgtxt.php?
id=201005290201.o4T21bk04708@momjian.us

The attached patch (to 0.11) fixes the problem.

----------
files: msgchunks.patch
messages: 240
nosy: alvherre
priority: bug
ruby_version: 1.8
status: unread
sup_version: 0.11
title: crash exception when viewing attachment with /s in filename

_________________________________________
Sup issue tracker <sup-bugs@masanjin.net>
<http://masanjin.net/sup-bugs/issue105>
_________________________________________

[-- Attachment #2: msgchunks.patch --]
[-- Type: application/octet-stream, Size: 372 bytes --]

--- message-chunks.rb.orig	2010-05-28 22:24:30.000000000 -0400
+++ message-chunks.rb	2010-05-28 22:24:37.000000000 -0400
@@ -149,7 +149,7 @@
     end
 
     def write_to_disk
-      file = Tempfile.new(@filename || "sup-attachment")
+      file = Tempfile.new(@filename.gsub("/", "_") || "sup-attachment")
       file.print @raw_content
       file.close
       file.path

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-29  2:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-29  2:31 [sup-devel] [issue105] crash exception when viewing attachment with /s in filename =?utf-8?q?=C3=81lvaro_Herrera_=3Csup-bugs=40masanjin=2Enet=3E?=

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox