From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.90.87.14 with SMTP id k14cs1331981agb; Thu, 31 Dec 2009 15:43:47 -0800 (PST) Received: by 10.224.70.143 with SMTP id d15mr9571369qaj.182.1262303026744; Thu, 31 Dec 2009 15:43:46 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 38si22771276qyk.17.2009.12.31.15.43.46; Thu, 31 Dec 2009 15:43:46 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 855E315B802D; Thu, 31 Dec 2009 18:43:46 -0500 (EST) Received: from magnesium.club.cc.cmu.edu (MAGNESIUM.CLUB.CC.cmu.edu [128.237.157.15]) by rubyforge.org (Postfix) with ESMTP id DD19C185828E for ; Thu, 31 Dec 2009 18:37:21 -0500 (EST) Received: (qmail 32706 invoked from network); 31 Dec 2009 23:37:21 -0000 Received: from pion.club.cc.cmu.edu (HELO localhost.localdomain) (128.237.157.88) by magnesium.club.cc.cmu.edu with SMTP; 31 Dec 2009 23:37:21 -0000 From: Rich Lane To: sup-devel@rubyforge.org Date: Thu, 31 Dec 2009 15:36:49 -0800 Message-Id: <1262302618-20503-2-git-send-email-rlane@club.cc.cmu.edu> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> References: <1262302618-20503-1-git-send-email-rlane@club.cc.cmu.edu> Subject: [sup-devel] [PATCH 01/10] open mail source files as binary X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org --- 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