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 5E49A431FB6 for ; Mon, 4 Jun 2012 00:08:32 -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 MrtFbJbowH-Q for ; Mon, 4 Jun 2012 00:08:30 -0700 (PDT) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 3C4B7431FAF for ; Mon, 4 Jun 2012 00:08:30 -0700 (PDT) Received: by vbbfc26 with SMTP id fc26so3922644vbb.26 for ; Mon, 04 Jun 2012 00:08:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type:x-gm-message-state; bh=Mp6IuJtRzw3lg+oMnyGldGAEZSjUe1CJWqaatsOhfHk=; b=LCBbYwdko1j+ltbelyQGrwGERnYP1KhMzMe9yvotJRaaUn3odWR0+Qa0SSxkg1Nyz1 dcPAq8vUlazFwyYUF8M/Pe9Rh07ObBwmeXvwGZi0PunEOa6llqxRz4jqU5X3dUd9m+Ei 5nQw/rZ2sq9uaQKWt5BTandQ+PHeTgIpqoKXg7zDIz4gVOfMyjCJkZDsNYzc3enSHRt0 1Al10+JTFn+2T9GUE2s5xOZ+n1V2r+wAhWb8ShabMSHMg9AxDJC28cbamYhbOXjIhKZ9 0VKeXwZ5g3p8i52xLmAh/nHmreBQsdJHbgULnIPHq+G22GDMi5pM4jUz0Kh0UkEGIU4O 8oCw== Received: by 10.220.115.81 with SMTP id h17mr11162796vcq.66.1338793709612; Mon, 04 Jun 2012 00:08:29 -0700 (PDT) Received: from localhost (nikula.org. [92.243.24.172]) by mx.google.com with ESMTPS id by3sm16079090vdc.17.2012.06.04.00.08.28 (version=SSLv3 cipher=OTHER); Mon, 04 Jun 2012 00:08:29 -0700 (PDT) From: Jani Nikula To: Austin Clements , notmuch@notmuchmail.org Subject: Re: [PATCH 4/4] lib: Treat messages in new/ as maildir messages with no flags set In-Reply-To: <1338742656-11640-5-git-send-email-amdragon@mit.edu> References: <1338742656-11640-1-git-send-email-amdragon@mit.edu> <1338742656-11640-5-git-send-email-amdragon@mit.edu> User-Agent: Notmuch/0.13+9~ga1668d0 (http://notmuchmail.org) Emacs/23.1.1 (i686-pc-linux-gnu) Date: Mon, 04 Jun 2012 07:08:26 +0000 Message-ID: <87mx4jr1ud.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQmV5I5Ma/uGkDnsRvbN9brByiIbzv7ZyK4Xu5tP6LPoBahH+AuHTUwRr1W/q3KdyhaHCHZy 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: Mon, 04 Jun 2012 07:08:32 -0000 On Sun, 03 Jun 2012, Austin Clements wrote: > 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. There's no harm in copy-pasting some of the rationale here. It's easier to find later on. The series LGTM, modulo the commit message nitpicks. > --- > 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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch