Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4B05E40DAE3 for ; Tue, 9 Nov 2010 12:39:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.89 X-Spam-Level: X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YbZdbEn8mz4o; Tue, 9 Nov 2010 12:38:50 -0800 (PST) Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id DE76740DAD3; Tue, 9 Nov 2010 12:38:49 -0800 (PST) Received: by yoom.home.cworth.org (Postfix, from userid 1000) id 8A26A25412B; Tue, 9 Nov 2010 12:38:49 -0800 (PST) From: Carl Worth To: Michal Sojka , notmuch@notmuchmail.org Subject: Re: [PATCH v4 0/4] Maildir synchronization In-Reply-To: <87iq066cbd.fsf@steelpick.2x.cz> References: <87tyk3vpxd.fsf@wsheee.2x.cz> <1288560558-18915-1-git-send-email-sojkam1@fel.cvut.cz> <877hgsrjau.fsf@yoom.home.cworth.org> <87d3qhq527.fsf@resox.2x.cz> <874obrmww9.fsf@yoom.home.cworth.org> <87iq066cbd.fsf@steelpick.2x.cz> User-Agent: Notmuch/0.4 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Tue, 09 Nov 2010 12:38:49 -0800 Message-ID: <87oc9ykzae.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2010 20:39:01 -0000 --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Transfer-Encoding: quoted-printable On Tue, 09 Nov 2010 11:06:30 +0100, Michal Sojka wrot= e: > This sounds good. Still it will be neccessary to synchronize with all > files, not only the first one. OK. I'll add that to the list of things I'll fix up. > > I'd like to get things merged today, so I plan to take your patches and > > then add new commits on top to implement the functions I described > > above. >=20 > Great! Seems that it is still not finished and I do not want to do > duplicite work, so let me know what is the current status and whether > you need some help from me (e.g. tests for multiple messages with same > ID). I should be on IRC today. Yesterday ended up being very busy, but I'm working on this stuff now. My plan is to merge it and then release notmuch 0.5. (And yes, if I had a more strict release manager then 0.5 would have been released yesterday as-is---but it turns out my release manager had an equally busy day yesterday). If you wanted to write some more tests, then that would be very useful. I've been changing the way the tests are written, so you might want to look at the attached file to see what I'm doing and match it. Notable differences: * Using test_begin_subtest and test_expect_equal rather than the list-of-commands to test_expect_success. * Not emitting separate line-item results for things that are already tested in other scripts, (like "add message" and "search for message", etc.) The updating I've done here only goes as far as just before "Add a message to new/ without info". And it looks like one change I made inadvertently broke a later test, so it's expected that "Check that removing info did not change tags" currently fails. [And this failure shows what I don't like about test_expect_success---if we were using test_expect_equal it would be trivial to see what problem I made here.] Finally, when going through these tests I saw: "Removing of unread tag should fail without cur/" And that's behavior I do not want. Adding and removing tags should be reliable whether or not the maildir synchronization can succeed. In this specific case, the right answer is probably to say that a directory without "new" and "cur" is not a maildir so no synchronization should be done. Notmuch does need to be able to support things like mh format still. Do the current patches break that by doing maildir-style renaming in non-maildir directories? If so, we'll need to fix that as well. And that might require an "is_maildir" term to be stored for directory documents in the database. Again, that's something I can help with. Thanks again, =2DCarl --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQFM2bFZ6JDdNq8qSWgRAoc0AKCSOhpUcAj9zi97HqEv11RvrXTyrACfffC7 5wx1KHaiPBWaTrD8v9LglZ8= =t4Ei -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Disposition: inline; filename=maildir-sync #!/bin/bash test_description="maildir synchronization" . ./test-lib.sh # Much easier to examine differences if the "notmuch show # --format=json" output includes some newlines. Also, need to avoid # including the local value of MAIL_DIR in the result. filter_show_json() { sed -e 's/, /,\n/g' | sed -e "s|${MAIL_DIR}/|MAIL_DIR/|" echo } cat >> "$NOTMUCH_CONFIG" < /dev/null output=$(notmuch search tag:inbox | notmuch_search_sanitize) output+=" " mv "${gen_msg_filename}" "${gen_msg_filename}S" increment_mtime "$(dirname "${gen_msg_filename}")" output+=$(NOTMUCH_NEW) output+=" " output+=$(notmuch search tag:inbox | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test message (inbox unread) No new mail. Detected 1 file rename. thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test message (inbox)" test_begin_subtest "Adding message with 'S' flag prevents 'unread' tag" add_message [subject]='"test message 2"' [date]='"Sat, 01 Jan 2000 12:00:00 -0000"' [filename]='"msg-002:2,S"' && output=$(notmuch search tag:inbox | notmuch_search_sanitize) test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test message (inbox) thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; test message 2 (inbox)" test_begin_subtest "Adding 'replied' flag adds 'R' tag to filename" notmuch tag +replied tag:inbox output=$(ls -1 "${MAIL_DIR}") test_expect_equal "$output" "msg-001:2,RS msg-002:2,RS" test_begin_subtest "notmuch show works with renamed file (without notmuch new)" output=$(notmuch show --format=json id:msg-001@notmuch-test-suite | filter_show_json) test_expect_equal "$output" '[[[{"id": "msg-001@notmuch-test-suite", "match": true, "filename": "MAIL_DIR/msg-001:2,RS", "timestamp": 946728000, "date_relative": "2000-01-01", "tags": ["inbox","replied"], "headers": {"Subject": "test message", "From": "Notmuch Test Suite ", "To": "Notmuch Test Suite ", "Cc": "", "Bcc": "", "Date": "Sat, 01 Jan 2000 12:00:00 -0000"}, "body": [{"id": 1, "content-type": "text/plain", "content": "This is just a test message (#1)\n"}]}, []]]]' test_expect_success 'notmuch reply works with renamed file (without notmuch new)' 'notmuch reply id:msg-001@notmuch-test-suite' test_begin_subtest "notmuch new detects no file rename after tag->flag synchronization" increment_mtime "$(dirname ${gen_msg_filename})" output=$(NOTMUCH_NEW) test_expect_equal "$output" "No new mail." test_expect_success "Add a message to new/ without info" ' generate_message [subject]="\"test message 3\"" [date]="\"Sat, 01 Jan 2000 12:00:00 -0000\"" [dir]=new && NOTMUCH_NEW > actual && test_cmp - actual < actual && test_cmp - actual < expected && notmuch show id:$gen_msg_id|grep -o "filename:.*$" > actual && test_cmp expected actual && test -f "$gen_msg_filename" ' test_expect_success "Check that the message was not renamed" ' ls "${MAIL_DIR}/new" > actual && test_cmp - actual < actual && test_cmp - actual < actual && test_cmp - actual < actual && test_cmp - actual < actual test_cmp - actual < actual && test_cmp - actual < actual && test_cmp - actual < actual && test_cmp - actual < actual && test_cmp - actual < expected && mv $MAIL_DIR/msg-001:2,RS $MAIL_DIR/msg-001:2, && mv $MAIL_DIR/msg-002:2,RS $MAIL_DIR/msg-002:2, && increment_mtime $MAIL_DIR ' test_expect_success 'Test whether dump/new/restore synchronizes the maildir flags with the database' ' notmuch dump dump.txt && notmuch new && notmuch restore dump.txt && ls $MAIL_DIR > actual && test_cmp expected actual ' test_done --=-=-= -- carl.d.worth@intel.com --=-=-=--