Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] Sup-sync exception
@ 2009-11-05 20:29 Mark Anderson
  2009-11-06 15:13 ` rick.tessner
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Anderson @ 2009-11-05 20:29 UTC (permalink / raw)
  To: sup-talk


I have an offlineimap synced IMAP Maildir area, and for some reason I get an error when I try to run sup-sync.

Any ideas?

-Mark

144> sup-sync
/home/manderso/src/sup-git/mainline/lib/sup/util.rb:9: warning: method redefined; discarding old gen_lock_id
/home/manderso/src/sup-git/mainline/lib/sup/util.rb:20: warning: method redefined; discarding old dump_lock_id
[Thu Nov 05 13:25:38 -0700 2009] WARNING: can't find character set by using locale, defaulting to utf-8
/home/manderso/src/sup-git/mainline/lib/sup/message-chunks.rb:36: warning: method redefined; discarding old make_tmpname
/home/manderso/src/sup-git/mainline/lib/sup/imap.rb:119: warning: ambiguous first argument; put parentheses or even spaces
[Thu Nov 05 13:25:39 -0700 2009] using index Redwood::FerretIndex
/home/manderso/src/sup-git/mainline/bin/sup-sync:11: warning: method redefined; discarding old to_s
[Thu Nov 05 13:25:40 -0700 2009] crypto: detected gpg binary in /usr/bin/gpg
[Thu Nov 05 13:25:40 -0700 2009] locking /home/manderso/.sup/lock...
[Thu Nov 05 13:25:40 -0700 2009] loading index...
[Thu Nov 05 13:25:40 -0700 2009] loaded index of 3830 messages
[Thu Nov 05 13:25:40 -0700 2009] scanning maildir /home/manderso/MailExchange/INBOX...
[Thu Nov 05 13:25:42 -0700 2009] done scanning maildir
Scanning maildir:/home/manderso/MailExchange/INBOX...
[Thu Nov 05 13:25:42 -0700 2009] unlocking /home/manderso/.sup/lock...
/home/manderso/src/sup-git/mainline/lib/sup/buffer.rb:15:in `cols': undefined local variable or method `stdscr' for Ncurses:Module (NameError)
        from /home/manderso/src/sup-git/mainline/lib/sup/message-chunks.rb:165:in `initialize'
        from /home/manderso/src/sup-git/mainline/lib/sup/message-chunks.rb:165:in `map'
        from /home/manderso/src/sup-git/mainline/lib/sup/message-chunks.rb:165:in `initialize'
        from /home/manderso/src/sup-git/mainline/lib/sup/message.rb:591:in `new'
        from /home/manderso/src/sup-git/mainline/lib/sup/message.rb:591:in `text_to_chunks'
        from /home/manderso/src/sup-git/mainline/lib/sup/message.rb:511:in `message_to_chunks'
        from /home/manderso/src/sup-git/mainline/lib/sup/message.rb:239:in `load_from_source!'
        from /home/manderso/src/sup-git/mainline/lib/sup/message.rb:335:in `build_from_source'
        from /home/manderso/src/sup-git/mainline/lib/sup/poll.rb:145:in `each_message_from'
        from /home/manderso/src/sup-git/mainline/lib/sup/maildir.rb:160:in `each'
        from /home/manderso/src/sup-git/mainline/lib/sup/maildir.rb:157:in `upto'
        from /home/manderso/src/sup-git/mainline/lib/sup/maildir.rb:157:in `each'
        from /home/manderso/src/sup-git/mainline/lib/sup/util.rb:560:in `send'
        from /home/manderso/src/sup-git/mainline/lib/sup/util.rb:560:in `__pass'
        from /home/manderso/src/sup-git/mainline/lib/sup/util.rb:547:in `method_missing'
        from /home/manderso/src/sup-git/mainline/lib/sup/poll.rb:139:in `each_message_from'
        from /home/manderso/src/sup-git/mainline/lib/sup/util.rb:520:in `send'
        from /home/manderso/src/sup-git/mainline/lib/sup/util.rb:520:in `method_missing'
        from /home/manderso/src/sup-git/mainline/bin/sup-sync:146
        from /home/manderso/src/sup-git/mainline/bin/sup-sync:141:in `each'
        from /home/manderso/src/sup-git/mainline/bin/sup-sync:141

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


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

* Re: [sup-talk] Sup-sync exception
  2009-11-05 20:29 [sup-talk] Sup-sync exception Mark Anderson
@ 2009-11-06 15:13 ` rick.tessner
  2009-11-06 20:06   ` Mark Anderson
  0 siblings, 1 reply; 8+ messages in thread
From: rick.tessner @ 2009-11-06 15:13 UTC (permalink / raw)
  To: sup-talk

[-- Attachment #1: Type: text/plain, Size: 892 bytes --]

Hi,

Excerpts from Mark Anderson's message of Thu Nov 05 12:29:23 -0800 2009:
> 
> I have an offlineimap synced IMAP Maildir area, and for some reason I get an error when I try to run
> sup-sync.

I had that exact same thing.  If you applied a patch that used
Ncurses.cols rather than WRAP_LEN to determine screen width, you'll have
that problem in the non-curses based sup applications.

The patch came from an email with the subject

    [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.

I initially didn't have any problems whatsoever with that patch until I ran
sup-sync. I fixed it with the attached commit.

This patch just does a rescue on that call.  The patch is only
applicable if you had applied a patch that came through previously on
this list for using Ncurses.cols rather than WRAP_LEN in
lib/sup/message-chunks.rb
-- 
Rick Tessner
rick.tessner@gmail.com

[-- Attachment #2: 0001-Corrects-Use-terminal-width-instead-of-hardcoded-80-.patch --]
[-- Type: application/octet-stream, Size: 1637 bytes --]

From 71047a972968dd6fae0b760b400ea05438993fef Mon Sep 17 00:00:00 2001
From: Rick Tessner <rick@onnadayr.ca>
Date: Thu, 15 Oct 2009 12:55:27 -0700
Subject: [PATCH] Corrects "Use terminal width instead of hardcoded 80 as the wrap length."

This corrects commit f0c7e30dec3e18b0ff59dff28c741422e5f7d10e.
---
 lib/sup/message-chunks.rb |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
index a74b442..f19c8fe 100644
--- a/lib/sup/message-chunks.rb
+++ b/lib/sup/message-chunks.rb
@@ -41,6 +41,7 @@ end
 
 module Redwood
 module Chunk
+  WRAP_LEN = 80 # wrap messages and text attachments at this width
 
   class Attachment
     HookManager.register "mime-decode", <<EOS
@@ -108,8 +109,9 @@ EOS
 
       @lines = nil
       if text
+        wrap_len = Ncurses.cols rescue WRAP_LEN  # Ncurses fails in sup-sync & friends ...
         @lines = text.gsub("\r\n", "\n").gsub(/\t/, "        ").gsub(/\r/, "").split("\n")
-        @lines = lines.map {|l| l.chomp.wrap Ncurses.cols}.flatten
+        @lines = lines.map {|l| l.chomp.wrap wrap_len}.flatten
         @quotable = true
       end
     end
@@ -161,7 +163,8 @@ EOS
 
     attr_reader :lines
     def initialize lines
-      @lines = lines.map { |l| l.chomp.wrap Ncurses.cols }.flatten # wrap
+      wrap_len = Ncurses.cols rescue WRAP_LEN  # Ncurses fails in sup-sync & friends ...
+      @lines = lines.map { |l| l.chomp.wrap wrap_len }.flatten # wrap
 
       ## trim off all empty lines except one
       @lines.pop while @lines.length > 1 && @lines[-1] =~ /^\s*$/ && @lines[-2] =~ /^\s*$/
-- 
1.6.3


[-- Attachment #3: Type: text/plain, Size: 140 bytes --]

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

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

* Re: [sup-talk] Sup-sync exception
  2009-11-06 15:13 ` rick.tessner
@ 2009-11-06 20:06   ` Mark Anderson
  2009-11-07  2:16     ` Anthony Martinez
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Anderson @ 2009-11-06 20:06 UTC (permalink / raw)
  To: sup-talk

Excerpts from rick.tessner's message of Fri Nov 06 08:13:19 -0700 2009:
> I had that exact same thing.  If you applied a patch that used
> Ncurses.cols rather than WRAP_LEN to determine screen width, you'll have
> that problem in the non-curses based sup applications.
> 
> The patch came from an email with the subject
> 
>     [PATCH] Use terminal width instead of hardcoded 80 as the wrap length.

I had applied that previous patch, as you guessed.

There was another patch that is complementary in getting the console to recognize the width of the terminal, I forget the tname, but here's what I have in my message-chunks.rb:

  TERM_WIDTH = `stty size 2>/dev/null`.split[1].to_i # to_i returns 0 if it fails
  WRAP_LEN = TERM_WIDTH > 0 && TERM_WIDTH || 80 # wrap messages and text attachments at this width

I don't know why that patch preferred `stty` to ENV["COLUMNS"], since that one had worked for me.

> I initially didn't have any problems whatsoever with that patch until I ran
> sup-sync. I fixed it with the attached commit.
> 
> This patch just does a rescue on that call.  The patch is only
> applicable if you had applied a patch that came through previously on
> this list for using Ncurses.cols rather than WRAP_LEN in
> lib/sup/message-chunks.rb

Thanks, it is much happier now.

-Mark

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


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

* Re: [sup-talk] Sup-sync exception
  2009-11-06 20:06   ` Mark Anderson
@ 2009-11-07  2:16     ` Anthony Martinez
  2009-11-07  4:10       ` Mark Alexander
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony Martinez @ 2009-11-07  2:16 UTC (permalink / raw)
  To: sup-talk; +Cc: sup-devel

Excerpts from Mark Anderson's message of Fri Nov 06 13:06:17 -0700 2009:
> There was another patch that is complementary in getting the console to
> recognize the width of the terminal, I forget the tname, but here's what I
> have in my message-chunks.rb:
> 
>   TERM_WIDTH = `stty size 2>/dev/null`.split[1].to_i # to_i returns 0 if it fails
>   WRAP_LEN = TERM_WIDTH > 0 && TERM_WIDTH || 80 # wrap messages and text attachments at this width
> 
> I don't know why that patch preferred `stty` to ENV["COLUMNS"], since that one
> had worked for me.

That'd be my patch. I used stty because ENV["COLUMNS"] doesn't consistently work
for me:

$ echo $COLUMNS
132
$ perl -wE 'say $ENV{COLUMNS}'
Use of uninitialized value in say at -e line 1.

$ ruby -e 'puts ENV["COLUMNS"]'
nil
$ irb
irb(main):001:0> ENV["COLUMNS"]
=> "132"

In Sup's console mode, ENV["COLUMNS"] is set, but when I tried
  WRAP_LEN = ENV["COLUMNS"]
in message-chunks.rb, it gets nil. It appears to have something to do with
readline:

$ irb --noreadline
irb(main):001:0> ENV["COLUMNS"]
=> nil

I also tried Ncurses.cols, as suggested on sup-devel, and got a similar
exception to yours. `stty`, albeit cheesy, works well enough for right now (even
though I'm not quite happy with it, since, in addition to its reliance on the
output of an external command, it also won't react to window size changes)

Perhaps this should be a configuration option -- give it a number to wrap to
that width, :auto to wrap to the terminal size (in some fashion that will allow
it to resize when the terminal does), and in the absence of any configuration,
80.

-- 
Every program has at least one bug and can be shortened by at least one
instruction -- from which, by induction, one can deduce that every
program can be reduced to one instruction which doesn't work.
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


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

* Re: [sup-talk] Sup-sync exception
  2009-11-07  2:16     ` Anthony Martinez
@ 2009-11-07  4:10       ` Mark Alexander
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Alexander @ 2009-11-07  4:10 UTC (permalink / raw)
  To: Anthony Martinez; +Cc: sup-talk, sup-devel

Excerpts from Anthony Martinez's message of Fri Nov 06 21:16:42 -0500 2009:
> That'd be my patch. I used stty because ENV["COLUMNS"] doesn't consistently work
> for me:
> 
> $ echo $COLUMNS
> 132
> $ perl -wE 'say $ENV{COLUMNS}'
> Use of uninitialized value in say at -e line 1.

It sounds like you didn't do this:

export COLUMNS
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


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

* Re: [sup-talk] Sup-sync exception
  2009-11-20 15:50 Ned Ludd
  2009-11-21  5:18 ` Andrei Thorp
@ 2009-11-23 23:33 ` Rich Lane
  1 sibling, 0 replies; 8+ messages in thread
From: Rich Lane @ 2009-11-23 23:33 UTC (permalink / raw)
  To: Ned Ludd; +Cc: sup-talk

Excerpts from Ned Ludd's message of Fri Nov 20 10:50:47 -0500 2009:
> There was a message about this a week or so ago.  Did anyone ever find a fix?
> 
> When I run "sup-sync", regardless or the source (I tried IMAP and
> Maildir), I get this error:
> 
> $ sup-sync
> Scanning maildir:/home/nedludd/.mail/INBOX...
> /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/source.rb:88:in `done?':
> undefined method `>=' for true:TrueClass (NoMethodError)
>     from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/util.rb:560:in `__pass'
>     from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/util.rb:547:in
> `method_missing'
>     from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/poll.rb:137:in
> `each_message_from'
>     from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/util.rb:520:in
> `method_missing'
>     from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/bin/sup-sync:146:in `block
> in <top (required)>'
>     from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/bin/sup-sync:141:in `each'
>     from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/bin/sup-sync:141:in `<top
> (required)>'
>     from /usr/bin/supbin/sup-sync:19:in `load'
>     from /usr/bin/supbin/sup-sync:19:in `<main>'
> 
> 
> [I'm on Arch with sup 0.9 and Ruby 1.9.1]

Is there a cur_offset key for every source in sources.yaml? If not (or
if it is nil/blank) see if setting cur_offset to 0 fixes it.
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


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

* Re: [sup-talk] Sup-sync exception
  2009-11-20 15:50 Ned Ludd
@ 2009-11-21  5:18 ` Andrei Thorp
  2009-11-23 23:33 ` Rich Lane
  1 sibling, 0 replies; 8+ messages in thread
From: Andrei Thorp @ 2009-11-21  5:18 UTC (permalink / raw)
  To: sup-talk

You can solve this particular problem (I have), but then it uncovers
quite a few other probems with sup and Ruby 1.9. As the maintainer of
the sup package in the AUR, I pretty much recommend using ruby 1.8
until the dev team can beat sup into working.

Sorry,

-AT

On Fri, Nov 20, 2009 at 10:50 AM, Ned Ludd <edwardludd@gmail.com> wrote:
> There was a message about this a week or so ago.  Did anyone ever find a fix?
>
> When I run "sup-sync", regardless or the source (I tried IMAP and
> Maildir), I get this error:
>
> $ sup-sync
> Scanning maildir:/home/nedludd/.mail/INBOX...
> /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/source.rb:88:in `done?':
> undefined method `>=' for true:TrueClass (NoMethodError)
>        from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/util.rb:560:in `__pass'
>        from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/util.rb:547:in
> `method_missing'
>        from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/poll.rb:137:in
> `each_message_from'
>        from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/util.rb:520:in
> `method_missing'
>        from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/bin/sup-sync:146:in `block
> in <top (required)>'
>        from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/bin/sup-sync:141:in `each'
>        from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/bin/sup-sync:141:in `<top
> (required)>'
>        from /usr/bin/supbin/sup-sync:19:in `load'
>        from /usr/bin/supbin/sup-sync:19:in `<main>'
>
>
> [I'm on Arch with sup 0.9 and Ruby 1.9.1]
>
> -----
> Ned Ludd
> _______________________________________________
> sup-talk mailing list
> sup-talk@rubyforge.org
> http://rubyforge.org/mailman/listinfo/sup-talk
>
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

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

* [sup-talk] Sup-sync exception
@ 2009-11-20 15:50 Ned Ludd
  2009-11-21  5:18 ` Andrei Thorp
  2009-11-23 23:33 ` Rich Lane
  0 siblings, 2 replies; 8+ messages in thread
From: Ned Ludd @ 2009-11-20 15:50 UTC (permalink / raw)
  To: sup-talk

There was a message about this a week or so ago.  Did anyone ever find a fix?

When I run "sup-sync", regardless or the source (I tried IMAP and
Maildir), I get this error:

$ sup-sync
Scanning maildir:/home/nedludd/.mail/INBOX...
/usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/source.rb:88:in `done?':
undefined method `>=' for true:TrueClass (NoMethodError)
	from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/util.rb:560:in `__pass'
	from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/util.rb:547:in
`method_missing'
	from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/poll.rb:137:in
`each_message_from'
	from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/lib/sup/util.rb:520:in
`method_missing'
	from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/bin/sup-sync:146:in `block
in <top (required)>'
	from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/bin/sup-sync:141:in `each'
	from /usr/lib/ruby/gems/1.9.1/gems/sup-0.9/bin/sup-sync:141:in `<top
(required)>'
	from /usr/bin/supbin/sup-sync:19:in `load'
	from /usr/bin/supbin/sup-sync:19:in `<main>'


[I'm on Arch with sup 0.9 and Ruby 1.9.1]

-----
Ned Ludd
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


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

end of thread, other threads:[~2009-11-23 23:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-05 20:29 [sup-talk] Sup-sync exception Mark Anderson
2009-11-06 15:13 ` rick.tessner
2009-11-06 20:06   ` Mark Anderson
2009-11-07  2:16     ` Anthony Martinez
2009-11-07  4:10       ` Mark Alexander
2009-11-20 15:50 Ned Ludd
2009-11-21  5:18 ` Andrei Thorp
2009-11-23 23:33 ` Rich Lane

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