Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: =?utf-8?q?=C3=81lvaro_Herrera_=3Csup-bugs=40masanjin=2Enet=3E?=@rubyforge.org
To: sup-devel@rubyforge.org
Subject: [sup-devel] [issue105] crash exception when viewing attachment with /s in filename
Date: Sat, 29 May 2010 02:31:27 +0000	[thread overview]
Message-ID: <1275100287.61.0.534667728298.issue105@masanjin.net> (raw)
In-Reply-To: <1275100287.61.0.534667728298.issue105@masanjin.net>

[-- 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

           reply	other threads:[~2010-05-29  2:31 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1275100287.61.0.534667728298.issue105@masanjin.net>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1275100287.61.0.534667728298.issue105@masanjin.net \
    --to==?utf-8?q?=c3=81lvaro_herrera_=3csup-bugs=40masanjin=2enet=3e?=@rubyforge.org \
    --cc=sup-bugs@masanjin.net \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox