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 CA217431FCB for ; Sat, 24 Jan 2015 07:21:13 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 2.338 X-Spam-Level: ** X-Spam-Status: No, score=2.338 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DNS_FROM_AHBL_RHSBL=2.438] 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 Xh3bIB7Tl7dD for ; Sat, 24 Jan 2015 07:21:10 -0800 (PST) Received: from upsilon.cc (upsilon.cc [178.32.142.91]) by olra.theworths.org (Postfix) with ESMTP id 793A7431FAE for ; Sat, 24 Jan 2015 07:21:10 -0800 (PST) Received: from timira.takhisis.invalid (unknown [78.194.69.54]) by upsilon.cc (Postfix) with ESMTPSA id BA56B7A02F; Sat, 24 Jan 2015 16:21:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upsilon.cc; s=mail; t=1422112867; bh=NTzuPtBVt7rmQXLrvwjVuWW6uW1a8jway1HJPYBIl0o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BDq2DgvUSocQUWSdoAoEH49+GROx7pLEsoesdveS0l9aDDFdqqa9pwYDKEjCciBgO 1wHkGmv1tzuKEcEx2DLbwdwCa5wm7snLjnR4CEDzl7hOHMEoNqHiVPqQLwc7uLoKZK Vu7o4HgNPbqD6QRQn1k/wOjoyrXmDy3594Uo67dY= Received: by timira.takhisis.invalid (Postfix, from userid 1000) id 7DF2A600E1; Sat, 24 Jan 2015 16:21:06 +0100 (CET) Date: Sat, 24 Jan 2015 16:21:06 +0100 From: Stefano Zacchiroli To: notmuch@notmuchmail.org Subject: Re: [PATCH 2/3] notmuch-mutt: support for messages that lack Message-ID headers Message-ID: <20150124152106.GA23037@upsilon.cc> References: <1422090701-19385-1-git-send-email-zack@upsilon.cc> <1422090701-19385-3-git-send-email-zack@upsilon.cc> <871tmkql6j.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <871tmkql6j.fsf@nikula.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "Jan N. Klug" 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: Sat, 24 Jan 2015 15:21:13 -0000 First of all thanks for your feedback, Jani! (both here, and the other day on IRC, of course) On Sat, Jan 24, 2015 at 04:59:16PM +0200, Jani Nikula wrote: > On Sat, 24 Jan 2015, Stefano Zacchiroli wrote: > > > > For those messages, compute a synthetic Message-ID based on the SHA1 > > of the whole message, in the same way that notmuch would do. See: > > http://git.notmuchmail.org/git/notmuch/blob/HEAD:/lib/sha1.c > > As I said on IRC, I think this is a notmuch implementation detail, and > we don't make any promises about always generating missing message-ids > the same way. That said, I don't see any reason why we'd change this > anytime soon, so the solution is probably good enough for now. ACK. I've noted down the code URL in the patch for reference, and also as a warning to keep an eye on. > > To do the above, rewrite get_message_id() to scan the current message > > line by line, incrementally computing a SHA1. As a consequence, drop > > the dependency on Mail::Internet. > > I am not so sure this is a good idea however, see below. So, fun part here is that I had initially made a similar comment to Jan. Then got convinced to do as the current patch does to avoid loading full messages (potentially with large attachments and the like) in memory. But I didn't think of header folding, and you're absolutely correct in saying that might be a problem. I've just found out Mail::Header->new which I believe solves both problems: avoid loading the full message into memory (it will only load the headers) and proper parsing folded Message-IDs, without having to use more complex regexp hackery. Jan: do you agree with using Mail::Header->new and fall back to line-by-line hasing only in case Message-ID is not found? If so, having an updated patch based on the one I've posted here would be awesome! If you cannot do that just let me know and I'll get to it, eventually :). Cheers. -- Stefano Zacchiroli . . . . . . . zack@upsilon.cc . . . . o . . . o . o Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o Former Debian Project Leader . . @zack on identi.ca . . o o o . . . o . « the first rule of tautology club is the first rule of tautology club »