Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] remove use of Object#tap
@ 2009-08-30 20:28 Rich Lane
  2009-08-30 20:45 ` Blake Burkhart
  2009-09-01  3:17 ` William Morgan
  0 siblings, 2 replies; 6+ messages in thread
From: Rich Lane @ 2009-08-30 20:28 UTC (permalink / raw)


---
 lib/sup/xapian_index.rb |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb
index c260728..1395601 100644
--- a/lib/sup/xapian_index.rb
+++ b/lib/sup/xapian_index.rb
@@ -362,7 +362,9 @@ class XapianIndex < BaseIndex
   end
 
   def find_docid id
-    term_docids(mkterm(:msgid,id)).tap { |x| fail unless x.size <= 1 }.first
+    docids = term_docids(mkterm(:msgid,id))
+    fail unless docids.size <= 1
+    docids.first
   end
 
   def find_doc id
-- 
1.6.0.4



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [sup-talk] [PATCH] remove use of Object#tap
  2009-08-30 20:28 [sup-talk] [PATCH] remove use of Object#tap Rich Lane
@ 2009-08-30 20:45 ` Blake Burkhart
  2009-08-30 21:50   ` Blake Burkhart
  2009-09-01  3:17 ` William Morgan
  1 sibling, 1 reply; 6+ messages in thread
From: Blake Burkhart @ 2009-08-30 20:45 UTC (permalink / raw)


Excerpts from Rich Lane's message of Sun Aug 30 15:28:55 -0500 2009:
> ---
>  lib/sup/xapian_index.rb |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb
> index c260728..1395601 100644
> --- a/lib/sup/xapian_index.rb
> +++ b/lib/sup/xapian_index.rb
> @@ -362,7 +362,9 @@ class XapianIndex < BaseIndex
>    end
>  
>    def find_docid id
> -    term_docids(mkterm(:msgid,id)).tap { |x| fail unless x.size <= 1 }.first
> +    docids = term_docids(mkterm(:msgid,id))
> +    fail unless docids.size <= 1
> +    docids.first
>    end
>  
>    def find_doc id

After applying this on next in hopes it lets me run sup on ruby 1.8.6, it
doesn't work.

It crashed with this log:
$ SUP_INDEX=xapian ruby -Ilib bin/sup-sync --all --all-sources --restore ~/dumpfile
Loading state dump from /Users/blake/dumpfile...
Read 6790 entries from dump file.
Scanning maildir:/Users/blake/Mail/bburky/INBOX...
[Sun Aug 30 15:38:57 -0500 2009] hook: read 'before-add-message' from /Users/blake/.sup/hooks/before-add-message.rb
[Sun Aug 30 15:38:57 -0500 2009] hook[before-add-message]: Marking message 1234774373-sup-1128 at zo as suptalk, subject is 'Re: [sup-talk] (no subject)'
./lib/sup/label.rb:64:in `<<': expecting a symbol (ArgumentError)
	from ./lib/sup/util.rb:520:in `send'
	from ./lib/sup/util.rb:520:in `method_missing'
	from ./lib/sup/xapian_index.rb:114:in `sync_message'
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:189:in `each'
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:189:in `each_key'
	from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:189:in `each'
	from ./lib/sup/xapian_index.rb:114:in `sync_message'
	from ./lib/sup/xapian_index.rb:87:in `add_message'
	 ... 10 levels...
	from ./lib/sup/util.rb:520:in `method_missing'
	from bin/sup-sync:146
	from bin/sup-sync:141:in `each'
	from bin/sup-sync:141

However, I'm having other odd problems too with labels anyway. On the ferret
version of sup, I'm not able to apply labels with the 'l' command. However, I
have a hook for applying a label from the List-ID that does still work. So
this patch may or may not work, I think I'm possibly having problems of my
own.

Actually, I haven't tried to restore from a dumpfile for ferret. I'll do that
later and see if it works.

-- Blake Burkhart


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [sup-talk] [PATCH] remove use of Object#tap
  2009-08-30 20:45 ` Blake Burkhart
@ 2009-08-30 21:50   ` Blake Burkhart
  2009-08-30 23:55     ` Ben Walton
  0 siblings, 1 reply; 6+ messages in thread
From: Blake Burkhart @ 2009-08-30 21:50 UTC (permalink / raw)


Excerpts from Blake Burkhart's message of Sun Aug 30 15:45:48 -0500 2009:
> After applying this on next in hopes it lets me run sup on ruby 1.8.6, it
> doesn't work.
> 
> It crashed with this log:
> $ SUP_INDEX=xapian ruby -Ilib bin/sup-sync --all --all-sources --restore
> ~/dumpfile
> Loading state dump from /Users/blake/dumpfile...
> Read 6790 entries from dump file.
> Scanning maildir:/Users/blake/Mail/bburky/INBOX...
> [Sun Aug 30 15:38:57 -0500 2009] hook: read 'before-add-message' from
> /Users/blake/.sup/hooks/before-add-message.rb
> [Sun Aug 30 15:38:57 -0500 2009] hook[before-add-message]: Marking message
> 1234774373-sup-1128 at zo as suptalk, subject is 'Re: [sup-talk] (no subject)'
> ./lib/sup/label.rb:64:in `<<': expecting a symbol (ArgumentError)
>     from ./lib/sup/util.rb:520:in `send'
>     from ./lib/sup/util.rb:520:in `method_missing'
>     from ./lib/sup/xapian_index.rb:114:in `sync_message'
>     from
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:1
> 89:in `each'
>     from
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:1
> 89:in `each_key'
>     from
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/set.rb:1
> 89:in `each'
>     from ./lib/sup/xapian_index.rb:114:in `sync_message'
>     from ./lib/sup/xapian_index.rb:87:in `add_message'
>      ... 10 levels...
>     from ./lib/sup/util.rb:520:in `method_missing'
>     from bin/sup-sync:146
>     from bin/sup-sync:141:in `each'
>     from bin/sup-sync:141
> 
> However, I'm having other odd problems too with labels anyway. On the ferret
> version of sup, I'm not able to apply labels with the 'l' command. However, I
> have a hook for applying a label from the List-ID that does still work. So
> this patch may or may not work, I think I'm possibly having problems of my
> own.
I got it to work. Mostly a least. What does a sup-dump file actually store? I
lost all read/unread statuses and all labels (including the spam label thing,
I assume it's just a normal label).

To get it to work, I removed my before-add-message hook. It has worked for a
long time, through different versions of sup, etc. However, It doesn't seem to
be working with xapian.

I don't actually know where this code came from, possibly this list, or maybe
else where. I may have even modified it, I don't really remember. The hook is
this:

listIdMatch = message.raw_header.match(/List-Id:.*?<(.*?)>\s*$/i)

if(listIdMatch)
  listIdLabel = listIdMatch[1].split(/\./).first.sub(/[^0-9A-Za-z]/, "")
  message.add_label listIdLabel
  log "Marking message #{message.id} as #{listIdLabel}, subject is '#{message.subj}'"
end

> Actually, I haven't tried to restore from a dumpfile for ferret. I'll do that
> later and see if it works.

I did try a restore from dumpfile with ferret. It worked except it didn't
remember the labels the same way xapian didn't. However, the hook did work,
and created labels on all mailing list messages.

I think this isn't a xapian problem, because ferret is acting the same.

If I want to recreate the sup files from scratch, what do I need to have? My
config.yaml, sources.yaml, sent.mbox and a dumpfile? Is that all?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [sup-talk] [PATCH] remove use of Object#tap
  2009-08-30 21:50   ` Blake Burkhart
@ 2009-08-30 23:55     ` Ben Walton
  2009-08-31  0:50       ` Rich Lane
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Walton @ 2009-08-30 23:55 UTC (permalink / raw)


Excerpts from Blake Burkhart's message of Sun Aug 30 17:50:09 -0400 2009:

> I got it to work. Mostly a least. What does a sup-dump file actually store? I
> lost all read/unread statuses and all labels (including the spam label thing,
> I assume it's just a normal label).

I also lost labels on my first attempt at switching to xapian.  I gave
up for a few days as there were other issues with labels at the time.
Losing labels during the switch would be a deal breaker, but I assume
this isn't intended (as that would be madness, madness, I say)...is
there a step I'm missing in the following (assuming HEAD of next)?

4. cp ~/.sup/sources.yaml{,.bak}
5. ruby -Ilib bin/sup-dump > dumpfile
6. SUP_INDEX=xapian ruby -Ilib bin/sup-sync --all --all-sources
   --restore dumpfile
7. SUP_INDEX=xapian ruby -Ilib bin/sup -o

Thanks
-Ben


-- 
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302

GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090830/1955cef2/attachment.bin>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [sup-talk] [PATCH] remove use of Object#tap
  2009-08-30 23:55     ` Ben Walton
@ 2009-08-31  0:50       ` Rich Lane
  0 siblings, 0 replies; 6+ messages in thread
From: Rich Lane @ 2009-08-31  0:50 UTC (permalink / raw)


Excerpts from Ben Walton's message of Sun Aug 30 19:55:56 -0400 2009:
> Excerpts from Blake Burkhart's message of Sun Aug 30 17:50:09 -0400 2009:
> 
> > I got it to work. Mostly a least. What does a sup-dump file actually store? I
> > lost all read/unread statuses and all labels (including the spam label thing,
> > I assume it's just a normal label).
> 
> I also lost labels on my first attempt at switching to xapian.  I gave
> up for a few days as there were other issues with labels at the time.
> Losing labels during the switch would be a deal breaker, but I assume
> this isn't intended (as that would be madness, madness, I say)...is
> there a step I'm missing in the following (assuming HEAD of next)?
> 
> 4. cp ~/.sup/sources.yaml{,.bak}
> 5. ruby -Ilib bin/sup-dump > dumpfile
> 6. SUP_INDEX=xapian ruby -Ilib bin/sup-sync --all --all-sources
>    --restore dumpfile
> 7. SUP_INDEX=xapian ruby -Ilib bin/sup -o
> 
> Thanks
> -Ben
> 

This is an issue that was introduced in 906ab35e. I've just resent a
patch for it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: restore-state-fix
Type: application/octet-stream
Size: 3534 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090830/5be2a745/attachment.obj>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [sup-talk] [PATCH] remove use of Object#tap
  2009-08-30 20:28 [sup-talk] [PATCH] remove use of Object#tap Rich Lane
  2009-08-30 20:45 ` Blake Burkhart
@ 2009-09-01  3:17 ` William Morgan
  1 sibling, 0 replies; 6+ messages in thread
From: William Morgan @ 2009-09-01  3:17 UTC (permalink / raw)


Applied. Sup does define a #returning function which is equivalent to
#tap, FWIW.
-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-01  3:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-30 20:28 [sup-talk] [PATCH] remove use of Object#tap Rich Lane
2009-08-30 20:45 ` Blake Burkhart
2009-08-30 21:50   ` Blake Burkhart
2009-08-30 23:55     ` Ben Walton
2009-08-31  0:50       ` Rich Lane
2009-09-01  3:17 ` William Morgan

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