Subject: [sup-talk] draft files aren't deleted when a draft message is deleted in the inbox

From: [email-masked] (jeff covey)
Date: Wed, 12 Sep 2007 23:38:39 -0400

this may be part of my draft problem:

i postponed a message and decided later not to finish it.  it was in my
inbox with a "draft" label.  i hit "d", and it disappeared from the inbox,
but ~/.sup/drafts/0 is still there with its contents.

thanks,

-- 
jeff covey
http://jeffcovey.net/

---

From: [email-masked] (William Morgan)
Date: Thu, 13 Sep 2007 18:34:49 -0700

Excerpts from jeff.covey's message of Wed Sep 12 20:38:39 -0700 2007:
> i postponed a message and decided later not to finish it.  it was in
> my inbox with a "draft" label.  i hit "d", and it disappeared from the
> inbox, but ~/.sup/drafts/0 is still there with its contents.

Interesting. Are there weird permissions on that directory, that would
otherwise preclude you from deleting a file?

Can you apply this diagnostic patch and post the "XX" log messages,
please?

Index: lib/sup/draft.rb
===================================================================
--- lib/sup/draft.rb    (revision 566)
+++ lib/sup/draft.rb    (working copy)
@@ -35,7 +35,19 @@
     raise ArgumentError, "can't find entry for draft: #{mid.inspect}" unless entry
     raise ArgumentError, "not a draft: source id #{entry[:source_id].inspect}, should be #{DraftManager.source_id.inspect} for #{mid.inspect} / docno #{docid}" unless entry[:source_id].to_i == DraftManager.source_id
     Index.drop_entry docid
-    File.delete @source.fn_for_offset(entry[:source_info])
+
+    fn = @source.fn_for_offset(entry[:source_info])
+    Redwood::log "XX about to delete: #{fn}"
+    rv = 
+      begin
+        File.delete fn
+      rescue Exception => e
+        Redwood::log "XX exception (e.class): #{e.message}"
+        nil
+      end
+    Redwood::log "XX deletion had return value #{rv.inspect}"
+    Redwood::log "XX file still there? #{File.exists? fn}"
+
     UpdateManager.relay self, :delete, mid
   end
 end

-- 
William <wmorgan-sup at masanjin.net>