From: chrisw@rice.edu (Christopher Warrington)
Subject: [sup-talk] [PATCH] fixed off-by-one error in imap.rb and maildir.rb
Date: Mon, 3 Mar 2008 02:00:33 -0600 [thread overview]
Message-ID: <1204531233-2092-1-git-send-email-chrisw@rice.edu> (raw)
In-Reply-To: <1204528063-sup-7345@chris-tablet>
The end_offset reported by imap and maildir sources was incorrect if there was
only one message in the source. Since end_offset is exclusive, we must add one to
the last known id to get include all valid message ids in the range.
---
lib/sup/imap.rb | 2 +-
lib/sup/maildir.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb
index e785597..1d36976 100644
--- a/lib/sup/imap.rb
+++ b/lib/sup/imap.rb
@@ -176,7 +176,7 @@ class IMAP < Source
def end_offset
unsynchronized_scan_mailbox
- @ids.last
+ @ids.last + 1
end
synchronized :end_offset
diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
index 5c9600d..584e657 100644
--- a/lib/sup/maildir.rb
+++ b/lib/sup/maildir.rb
@@ -123,7 +123,7 @@ class Maildir < Source
def end_offset
scan_mailbox :rescan => true
- @ids.last
+ @ids.last + 1
end
def pct_done; 100.0 * (@ids.index(cur_offset) || 0).to_f / (@ids.length - 1).to_f; end
--
1.5.3.7
next prev parent reply other threads:[~2008-03-03 8:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-03 7:07 [sup-talk] Maildir source with one message Christopher Warrington
2008-03-03 8:00 ` Christopher Warrington [this message]
2008-03-26 16:04 ` [sup-talk] [PATCH] fixed off-by-one error in imap.rb and maildir.rb William Morgan
2008-04-03 16:35 ` Grant Hollingworth
2008-04-04 17:48 ` William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1204531233-2092-1-git-send-email-chrisw@rice.edu \
--to=chrisw@rice.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox