Dave Abrahams dave at boostpro.com
Mon Sep 10 16:07:33 BST 2012

Hi Sebastian,

As mentioned in
http://article.gmane.org/gmane.mail.imap.offlineimap.general/5884 I
suspect you may have broken my patch with your modifications, and this
"fallout" doesn't exist in the version I submitted.  Of course, I could
always be wrong, but I can't tell because the test suite breaks for me
even in the release version:

--8<---------------cut here---------------start------------->8---
python setup.py test
running test
test_01_imapsplit (test_00_imaputil.TestInternalFunctions)
Test imaputil.imapsplit() ... ok
test_02_flagsplit (test_00_imaputil.TestInternalFunctions)
Test imaputil.flagsplit() ... ok
test_03_options2hash (test_00_imaputil.TestInternalFunctions)
Test imaputil.options2hash() ... ok
test_04_flags2hash (test_00_imaputil.TestInternalFunctions)
Test imaputil.flags2hash() ... ok
test_05_flagsimap2maildir (test_00_imaputil.TestInternalFunctions)
Test imaputil.flagsimap2maildir() ... ok
test_06_flagsmaildir2imap (test_00_imaputil.TestInternalFunctions)
Test imaputil.flagsmaildir2imap() ... ok
test_07_uid_sequence (test_00_imaputil.TestInternalFunctions)
Test imaputil.uid_sequence() ... ok
test_01_olistartup (test_01_basic.TestBasicFunctions)
Tests if OLI can be invoked without exceptions ... ERROR

ERROR: test_01_olistartup (test_01_basic.TestBasicFunctions)
Tests if OLI can be invoked without exceptions
Traceback (most recent call last):
  File "/Users/dave/src/offlineimap/test/tests/test_01_basic.py", line 65, in test_01_olistartup
  File "/Users/dave/src/offlineimap/test/OLItest/TestRunner.py", line 158, in delete_remote_testfolders
    ''', d, flags=re.VERBOSE)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 142, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or buffer
--8<---------------cut here---------------end--------------->8---

When I add this assertion to TestRunner.py just before the offending

--8<---------------cut here---------------start------------->8---
                assert type(d) == str, "wrong type %r" % (data,)
--8<---------------cut here---------------end--------------->8---

I get:

--8<---------------cut here---------------start------------->8---
AssertionError: wrong type ['(\\HasChildren) "." "INBOX"', ('(\\HasNoChildren) "." {17}', 'INBOX.OLItest "1"'), '', '(\\HasNoChildren) "." "INBOX.OLItest 1"']
--8<---------------cut here---------------end--------------->8---

I guessed at this rewrite of the loop in question:

--8<---------------cut here---------------start------------->8---
            for d in [ d1 for d0 in data for d1 in ((d0,) if isinstance(d0,str) else d0)]:
                assert isinstance(d,str), "not a str %r"%(d,)
                m = re.search(br'''        # Find last quote
                    "((?:                 # Non-tripple quoted can contain...
                    [^"]                | # a non-quote
                    \\"                   # a backslashded quote
                    )*)"                   # closing quote
                    [^"]*$                # followed by no more quotes
                    ''', d, flags=re.VERBOSE)
                if m is not None:
                    folder = bytearray(m.group(1))
                    #folder = folder.replace(br'\"', b'"') # remove quoting
--8<---------------cut here---------------end--------------->8---

but it just led to:

--8<---------------cut here---------------start------------->8---
AssertionError: Expected 0 folders and 0 mails, but sync led to 1 folders and 0 mails
--8<---------------cut here---------------end--------------->8---

The IMAP server is some version of dovecot (the default on MacOS 10.6

on Fri Aug 31 2012, Sebastian Spaeth <Sebastian-AT-SSpaeth.de> wrote:

> Dave Abrahams <dave at boostpro.com> writes:
>> * Fix omitted check for local folder's sync_this value in
>>   SyncableAccount.sync()
> Hi Dave, I just pushed a patch fixing the fallout from your
> change. There was a reason that we would not call getfolder() until we
> had made sure that the remote folder exists and is not filtered out....
> Found it by running our test suite...
> Sebastian
> commit 3476e9ab36b861fefde5211cb39a71623738dd71
> Author: Sebastian Spaeth <Sebastian at SSpaeth.de>
> Date:   Sat Sep 1 03:12:16 2012 +0200
>     Fix fallout when filtering folders
>     Previous commit e7ca5b25cba0679aa800b490d063b24c40864839 combined
>     checks for filtered folders in one place. However, it turns out there
>     was a reason to have them separate. getfolder() on a non-existent Maildir
>     fails and there might not be an equivalent local Maildir folder for a
>     filtered out IMAP folder.
>     Fix this by first checking if the remote folder should be filtered, and
>     only then retrieving the local folder (which should exist then).
>     This bug was found by our test suite!
> _______________________________________________
> OfflineIMAP-project mailing list
> OfflineIMAP-project at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project
> OfflineIMAP homepage: http://software.complete.org/offlineimap

Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

More information about the OfflineIMAP-project mailing list