danchoi / vmail

a vim interface for gmail
http://danielchoi.com/software/vmail.html
MIT License
786 stars 60 forks source link

checking for new message fails with ArgumentError if INBOX is empty #176

Open pmagwene opened 10 years ago

pmagwene commented 10 years ago

If the Inbox is empty, checking for new messages with u fails with the following error:

VMAIL_ERROR: ArgumentError
comparison of Fixnum with nil failed

However, if there is at least one other message in the Inbox then updating works fine.

Relevant info: OSX 10.8.5, Ruby 2.1, Vmail 2.9.0, MacVim 7.4

pmagwene commented 10 years ago

This problem is also present with both Vmail 2.9.0 and 2.8.7 on a Linux machine tested with Ruby 1.9.3, Ruby 2.1.2 and MacVim 7.4.

pmagwene commented 10 years ago

The problem seems to be specific to the sequence of events where the user starts vmail and the inbox is empty, and then subsequently a new message is received and then the user checks email again.

To recreate it:

  1. delete all messages from inbox
  2. quit vmail
  3. start vmail again
  4. from a different client send email to gmail address
  5. check for new emails in vmail

Here's the full error message:

Checking for new messages. Please wait...VMAIL_ERROR: ArgumentError
comparison of Fixnum with nil failed
/home/pmagwene/.rvm/gems/ruby-1.9.3-p547/gems/vmail-2.9.0/lib/vmail/imap_client.rb:226:in `>'
/home/pmagwene/.rvm/gems/ruby-1.9.3-p547/gems/vmail-2.9.0/lib/vmail/imap_client.rb:226:in `block in check_for_new_messages'
/home/pmagwene/.rvm/gems/ruby-1.9.3-p547/gems/vmail-2.9.0/lib/vmail/imap_client.rb:226:in `select'
/home/pmagwene/.rvm/gems/ruby-1.9.3-p547/gems/vmail-2.9.0/lib/vmail/imap_client.rb:226:in `check_for_new_messages'
/home/pmagwene/.rvm/gems/ruby-1.9.3-p547/gems/vmail-2.9.0/lib/vmail/imap_client.rb:248:in `update'
/home/pmagwene/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/home/pmagwene/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/home/pmagwene/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/home/pmagwene/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/home/pmagwene/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
notalex commented 10 years ago

I have fixed this in the latest release(2.9.1). Please run gem install vmail to update. Do let me know if it works for you so that I may close this ticket.

pmagwene commented 9 years ago

Updated to 2.9.2, but unfortunately I'm still getting the same error message using the steps above to recreate.

For completeness, here's the debug log:

D, [2014-07-21T11:22:13.036685 #4129] DEBUG -- : loading mailboxes...
D, [2014-07-21T11:22:13.077440 #4129] DEBUG -- : Loaded mailboxes: ["INBOX", "Personal", "Receipts", "Travel", "Work", "[Gmail]/All Mail", "[Gmail]/Drafts", "[Gmail]/Important", "[Gmail]/Sent Mail", "[Gmail]/Spam", "[Gmail]/Starred", "[Gmail]/Trash"]
D, [2014-07-21T11:22:13.077750 #4129] DEBUG -- : Setting aliases to {"sent"=>"[Gmail]/Sent Mail", "all"=>"[Gmail]/All Mail", "starred"=>"[Gmail]/Starred", "important"=>"[Gmail]/Important", "drafts"=>"[Gmail]/Drafts", "spam"=>"[Gmail]/Spam", "trash"=>"[Gmail]/Trash"}
D, [2014-07-21T11:22:13.079765 #4129] DEBUG -- : Selecting mailbox "INBOX"
D, [2014-07-21T11:22:13.171838 #4129] DEBUG -- : RUBY0003 OK [READ-WRITE] INBOX selected. (Success)

D, [2014-07-21T11:22:13.172137 #4129] DEBUG -- : Done
D, [2014-07-21T11:22:13.173401 #4129] DEBUG -- : Getting mailbox status
D, [2014-07-21T11:22:13.173509 #4129] DEBUG -- : Getting highest message id
D, [2014-07-21T11:22:13.249353 #4129] DEBUG -- : NO HIGHEST ID: setting @num_messages to 1
D, [2014-07-21T11:22:13.355676 #4129] DEBUG -- : Setting window width to 80
D, [2014-07-21T11:22:13.430279 #4129] DEBUG -- : Selecting mailbox "INBOX"
D, [2014-07-21T11:22:13.513934 #4129] DEBUG -- : RUBY0005 OK [READ-WRITE] INBOX selected. (Success)

D, [2014-07-21T11:22:13.514061 #4129] DEBUG -- : Done
D, [2014-07-21T11:22:13.514408 #4129] DEBUG -- : Getting mailbox status
D, [2014-07-21T11:22:13.514438 #4129] DEBUG -- : Getting highest message id
D, [2014-07-21T11:22:13.590271 #4129] DEBUG -- : NO HIGHEST ID: setting @num_messages to 1
D, [2014-07-21T11:22:13.663257 #4129] DEBUG -- : #search: "\"all\""
D, [2014-07-21T11:22:13.663414 #4129] DEBUG -- : Query: "1:1 all"
D, [2014-07-21T11:22:32.333333 #4129] DEBUG -- : Checking for new messages
D, [2014-07-21T11:22:32.333410 #4129] DEBUG -- : Selecting mailbox "INBOX"
D, [2014-07-21T11:22:32.428020 #4129] DEBUG -- : RUBY0008 OK [READ-WRITE] INBOX selected. (Success)

D, [2014-07-21T11:22:32.428103 #4129] DEBUG -- : Done
D, [2014-07-21T11:22:32.428365 #4129] DEBUG -- : Getting mailbox status
D, [2014-07-21T11:22:32.428389 #4129] DEBUG -- : Getting highest message id
D, [2014-07-21T11:22:32.505000 #4129] DEBUG -- : Highest seqno: 1
D, [2014-07-21T11:22:32.505268 #4129] DEBUG -- : Search #update_query
D, [2014-07-21T11:22:32.582163 #4129] DEBUG -- : - got seqnos: [1]
D, [2014-07-21T11:22:32.582224 #4129] DEBUG -- : - getting seqnos >