Re: [PATCH 3/6] cli: make the hacky from guessing more liberal
authorJani Nikula <jani@nikula.org>
Thu, 17 Oct 2013 11:52:27 +0000 (14:52 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:27 +0000 (09:57 -0800)
78/b66aea2332ace29e39f7758490c351976f7f8f [new file with mode: 0644]

diff --git a/78/b66aea2332ace29e39f7758490c351976f7f8f b/78/b66aea2332ace29e39f7758490c351976f7f8f
new file mode 100644 (file)
index 0000000..d8aa265
--- /dev/null
@@ -0,0 +1,135 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 461E3431FB6\r
+       for <notmuch@notmuchmail.org>; Thu, 17 Oct 2013 04:52:35 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 2WJ6VVcCFY93 for <notmuch@notmuchmail.org>;\r
+       Thu, 17 Oct 2013 04:52:30 -0700 (PDT)\r
+Received: from mail-ea0-f181.google.com (mail-ea0-f181.google.com\r
+       [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id B3B49431FAE\r
+       for <notmuch@notmuchmail.org>; Thu, 17 Oct 2013 04:52:30 -0700 (PDT)\r
+Received: by mail-ea0-f181.google.com with SMTP id d10so996859eaj.40\r
+       for <notmuch@notmuchmail.org>; Thu, 17 Oct 2013 04:52:29 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:subject:in-reply-to:references\r
+       :user-agent:date:message-id:mime-version:content-type;\r
+       bh=ki+FtPgghhmEVOAl/RQiUm/GfuxZb+WzLbzfoZhF2xc=;\r
+       b=TIkXH3HkXJK+krQHDFFzyJ3fOHyXE5UFJOHZaIN/wegl5/kMeGYwtXNQEs4+Cv87cp\r
+       wQuoj9n6Y7gmIttPDbkq8G2M888KBvH5oGuC+aWGKYgrtUfVSS1t8QdS/5auuEbCsEX8\r
+       Zu4MQm1vW5yQxqbnFT69pyCKNY4M0aLtX79o5Ha1yyqOqKy2Lji2Fkb+jKg47wgcuXOP\r
+       CGB2MJRenYNmXCWFk6CiS1lRgbvQOZqeJHIA42s7c2S+5BJndyJBUJPebSjD9YhA8WHx\r
+       W7+hi6jot5z2Ppw1kJnN5FuArYFEN02ODwPs9VyuXcgFGKUJdHqukOqP+ppEQw2pAhDh\r
+       yWzw==\r
+X-Gm-Message-State:\r
+ ALoCoQnuc1O/OMfxQtHPde5oPstPfTLXguRKyxjfnyDBGcwiXZUtCvDB8EYLgmpsSxsDjPszCKmK\r
+X-Received: by 10.14.183.130 with SMTP id q2mr3625742eem.64.1382010749510;\r
+       Thu, 17 Oct 2013 04:52:29 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+       [88.195.111.91]) by mx.google.com with ESMTPSA id\r
+       x47sm192119360eea.16.1969.12.31.16.00.00\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Thu, 17 Oct 2013 04:52:28 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 3/6] cli: make the hacky from guessing more liberal\r
+In-Reply-To: <87li1sb9l8.fsf@qmul.ac.uk>\r
+References: <cover.1381948853.git.jani@nikula.org>\r
+       <7dd03cd9c1677be8c5937d11b376d4cbd26c64f5.1381948853.git.jani@nikula.org>\r
+       <87li1sb9l8.fsf@qmul.ac.uk>\r
+User-Agent: Notmuch/0.16+97~g6878b0b (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Thu, 17 Oct 2013 14:52:27 +0300\r
+Message-ID: <87hacgqflw.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 17 Oct 2013 11:52:35 -0000\r
+\r
+On Thu, 17 Oct 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> On Wed, 16 Oct 2013, Jani Nikula <jani@nikula.org> wrote:\r
+>> This is in preparation of switching to gmime header parsing. Accept\r
+>> "for" and "by" preceded by tabs in the received header. This is a bit\r
+>> flaky, but so is the whole guessing code.\r
+>\r
+> I am happy with the change but I think a little more explanation of the\r
+> problem it fixes would be helpful. Is it that there could be a \n \t\r
+> before the "for"/"by" or something else?\r
+\r
+It's the same header folding by tabs here too. In your mail that I'm\r
+replying to, the received headers are folded with tabs. (This may be due\r
+to mailman doing bad things, but that's irrelevant.) There may be a tab\r
+preceding the "for"/"by" instead of a space. Obviously this could be\r
+made more robust, but if you look at what the from guessing does, you\r
+realize it's quite hacky anyway, and a last resort. So I didn't bother,\r
+at least not for now, for this series. Minimal change to make tests\r
+pass.\r
+\r
+>> ---\r
+>>  notmuch-reply.c | 4 ++--\r
+>>  1 file changed, 2 insertions(+), 2 deletions(-)\r
+>>\r
+>> diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+>> index 9d6f843..4b67e66 100644\r
+>> --- a/notmuch-reply.c\r
+>> +++ b/notmuch-reply.c\r
+>> @@ -423,7 +423,7 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message\r
+>>      /* First we look for a " for <email@add.res>" in the received\r
+>>       * header\r
+>>       */\r
+>> -    ptr = strstr (received, " for ");\r
+>> +    ptr = strstr (received, "for ");\r
+>\r
+> The comment should be updated to match the code (and depending on the\r
+> answer to the above maybe explain that too)\r
+\r
+Agreed.\r
+\r
+BR,\r
+Jani.\r
+\r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>>  \r
+>>      /* Note: ptr potentially contains a list of email addresses. */\r
+>>      addr = user_address_in_string (ptr, config);\r
+>> @@ -440,7 +440,7 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message\r
+>>       * system in this step of the receive chain\r
+>>       */\r
+>>      by = received;\r
+>> -    while((by = strstr (by, " by ")) != NULL) {\r
+>> +    while((by = strstr (by, "by ")) != NULL) {\r
+>>     by += 4;\r
+>>     if (*by == '\0')\r
+>>         break;\r
+>> -- \r
+>> 1.8.4.rc3\r
+>>\r
+>> _______________________________________________\r
+>> notmuch mailing list\r
+>> notmuch@notmuchmail.org\r
+>> http://notmuchmail.org/mailman/listinfo/notmuch\r