Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Rich Lane <rlane@club.cc.cmu.edu>
To: sup-devel@rubyforge.org
Subject: [sup-devel] [PATCH 01/10] open mail source files as binary
Date: Thu, 31 Dec 2009 15:36:49 -0800	[thread overview]
Message-ID: <1262302618-20503-2-git-send-email-rlane@club.cc.cmu.edu> (raw)
In-Reply-To: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu>

---
 lib/sup/maildir.rb     |    4 ++--
 lib/sup/mbox/loader.rb |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
index c2bd27a..0852576 100644
--- a/lib/sup/maildir.rb
+++ b/lib/sup/maildir.rb
@@ -59,7 +59,7 @@ class Maildir < Source
         File.stat(tmp_path)
       rescue Errno::ENOENT #this is what we want.
         begin
-          File.open(tmp_path, 'w') do |f|
+          File.open(tmp_path, 'wb:BINARY') do |f|
             yield f #provide a writable interface for the caller
             f.fsync
           end
@@ -207,7 +207,7 @@ private
   def with_file_for id
     fn = @ids_to_fns[id] or raise OutOfSyncSourceError, "No such id: #{id.inspect}."
     begin
-      File.open(fn) { |f| yield f }
+      File.open(fn, 'rb:BINARY') { |f| yield f }
     rescue SystemCallError, IOError => e
       raise FatalSourceError, "Problem reading file for id #{id.inspect}: #{fn.inspect}: #{e.message}."
     end
diff --git a/lib/sup/mbox/loader.rb b/lib/sup/mbox/loader.rb
index 520e2ec..ec28d3b 100644
--- a/lib/sup/mbox/loader.rb
+++ b/lib/sup/mbox/loader.rb
@@ -22,7 +22,7 @@ class Loader < Source
       raise ArgumentError, "not an mbox uri" unless uri.scheme == "mbox"
       raise ArgumentError, "mbox URI ('#{uri}') cannot have a host: #{uri.host}" if uri.host
       raise ArgumentError, "mbox URI must have a path component" unless uri.path
-      @f = File.open uri.path
+      @f = File.open uri.path, 'rb:BINARY'
       @path = uri.path
     else
       @f = uri_or_fp
@@ -114,7 +114,7 @@ class Loader < Source
 
   def store_message date, from_email, &block
     need_blank = File.exists?(@filename) && !File.zero?(@filename)
-    File.open(@filename, "a") do |f|
+    File.open(@filename, "ab:BINARY") do |f|
       f.puts if need_blank
       f.puts "From #{from_email} #{date.rfc2822}"
       yield f
-- 
1.6.3.3

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


  reply	other threads:[~2009-12-31 23:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-31 23:36 [sup-devel] Ruby 1.9 encoding fixes Rich Lane
2009-12-31 23:36 ` Rich Lane [this message]
2009-12-31 23:36   ` [sup-devel] [PATCH 02/10] display_size is just size on Ruby 1.9 Rich Lane
2009-12-31 23:36     ` [sup-devel] [PATCH 03/10] add String#check Rich Lane
2009-12-31 23:36       ` [sup-devel] [PATCH 04/10] add String#ascii Rich Lane
2009-12-31 23:36         ` [sup-devel] [PATCH 05/10] fixup Iconv#easy_decode for Ruby 1.9 Rich Lane
2009-12-31 23:36           ` [sup-devel] [PATCH 06/10] add String#transcode Rich Lane
2009-12-31 23:36             ` [sup-devel] [PATCH 07/10] transcode output from mime-decode hook too Rich Lane
2009-12-31 23:36               ` [sup-devel] [PATCH 08/10] decode raw header/message to ascii before viewing Rich Lane
2009-12-31 23:36                 ` [sup-devel] [PATCH 09/10] use header from the RMail::Message in Message#parse_header Rich Lane
2009-12-31 23:36                   ` [sup-devel] [PATCH 10/10] decode header fields of enclosed messages Rich Lane
2010-01-01 20:59   ` [sup-devel] [PATCH 01/10] open mail source files as binary Anthony Martinez
2010-01-01 21:43     ` William Morgan
2010-01-01 21:48       ` Rich Lane
2010-01-01 21:57         ` William Morgan
2010-01-02  1:16       ` Anthony Martinez
2010-01-01 19:09 ` [sup-devel] Ruby 1.9 encoding fixes William Morgan
     [not found]   ` <1262442839-sup-7738@peray>
2010-01-03 14:48     ` William Morgan
2010-01-03 15:48       ` Nicolas Pouillard

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=1262302618-20503-2-git-send-email-rlane@club.cc.cmu.edu \
    --to=rlane@club.cc.cmu.edu \
    --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