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 6BB98431FD6 for ; Sun, 3 Jun 2012 09:58:17 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled 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 DXEFtDBpvvIA for ; Sun, 3 Jun 2012 09:58:15 -0700 (PDT) Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU [18.7.68.37]) by olra.theworths.org (Postfix) with ESMTP id 4DC43431FAE for ; Sun, 3 Jun 2012 09:58:15 -0700 (PDT) X-AuditID: 12074425-b7f9b6d0000008c4-6c-4fcb97a75ee7 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP id 51.B9.02244.7A79BCF4; Sun, 3 Jun 2012 12:58:15 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q53GwEYI011012; Sun, 3 Jun 2012 12:58:14 -0400 Received: from drake.dyndns.org (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q53GwDZq004210 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sun, 3 Jun 2012 12:58:14 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1SbE7k-000380-O1; Sun, 03 Jun 2012 12:57:52 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 4/4] lib: Treat messages in new/ as maildir messages with no flags set Date: Sun, 3 Jun 2012 12:57:36 -0400 Message-Id: <1338742656-11640-5-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1338742656-11640-1-git-send-email-amdragon@mit.edu> References: <1338742656-11640-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixCmqrbt8+ml/g57JXBbXb85kdmD0eLbq FnMAYxSXTUpqTmZZapG+XQJXxoOvrSwFF/kr/t5pZ21g3M3TxcjJISFgItH6+z8LhC0mceHe ejYQW0hgH6PEnPbYLkYuIHs9o8SkhT+ZIJyHTBKtc86zQjhzGSUervvECtLCJqAhsW3/ckYQ W0RAWmLn3dlAcQ4OZgE1iT9dKiBhYYEwiQXLzzOD2CwCqhJ3W26D2bwCDhLTH8xkhLhCXuLp /T42kFZOAUeJ3gMmEAc5SHxouMI+gZF/ASPDKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0LvdzM Er3UlNJNjKCQYXdR3cE44ZDSIUYBDkYlHt5Ps075C7EmlhVX5h5ilORgUhLlnTb1tL8QX1J+ SmVGYnFGfFFpTmrxIUYJDmYlEd5OO6Acb0piZVVqUT5MSpqDRUmcd53mbn8hgfTEktTs1NSC 1CKYrAwHh5IEb880oEbBotT01Iq0zJwShDQTByfIcB6g4RNBaniLCxJzizPTIfKnGHU55h06 d51RiCUvPy9VSpxXBBitQgIgRRmleXBzYLH+ilEc6C1hXnWQKh5gmoCb9ApoCRPQEoPDJ0GW lCQipKQaGM0yOTftuJYd8Jl3enf5BafGcw/0k+/dXnm67msFQ9hzS6M23oPrli/ZFPDMcEft yr8MD2t05S9X1rme62H/JvvEqqfs5iaTMP1lX28wBJ/xaCoTjbw5gUOkV6Gj8MUSnU/Xnern VXmdP3fYnXG3m97JilPZr/nSDLyOxnOeK/7X6jyl5McaViWW4oxEQy3mouJEAJtShdXQAgAA 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: Sun, 03 Jun 2012 16:58:17 -0000 This fixes the broken test added a few patches ago by synchronizing the tags of messages in new/, even if they have no "info" part. See the test patch for rationale. --- lib/message.cc | 20 +++++++++++++------- test/maildir-sync | 1 - 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index bbac2ff..978de06 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -1090,13 +1090,19 @@ notmuch_message_maildir_flags_to_tags (notmuch_message_t *message) continue; flags = strstr (filename, ":2,"); - if (! flags) - continue; - - seen_maildir_info = 1; - flags += 3; - - combined_flags = talloc_strdup_append (combined_flags, flags); + if (flags) { + seen_maildir_info = 1; + flags += 3; + combined_flags = talloc_strdup_append (combined_flags, flags); + } else if (STRNCMP_LITERAL (dir, "new/") == 0) { + /* Messages are delivered to new/ with no "info" part, but + * they effectively have default maildir flags. According + * to the spec, we should ignore the info part for + * messages in new/, but some MUAs (mutt) can set maildir + * flags on messages in new/, so we're liberal in what we + * accept. */ + seen_maildir_info = 1; + } } /* If none of the filenames have any maildir info field (not even diff --git a/test/maildir-sync b/test/maildir-sync index 6360fd2..01348d3 100755 --- a/test/maildir-sync +++ b/test/maildir-sync @@ -167,7 +167,6 @@ notmuch tag +unread +draft -flagged subject:"Non-compliant maildir info" test_expect_equal "$(cd $MAIL_DIR/cur/; ls non-compliant*)" "non-compliant-maildir-info:2,These-are-not-flags-in-ASCII-order-donottouch" test_begin_subtest "Files in new/ get default synchronized tags" -test_subtest_known_broken OLDCONFIG=$(notmuch config get new.tags) notmuch config set new.tags test add_message [subject]='"File in new/"' [dir]=new [filename]='file-in-new' -- 1.7.10