Re: [python] segfaults at Message.get_date
authorAustin Clements <amdragon@MIT.EDU>
Mon, 20 Jun 2011 16:53:29 +0000 (12:53 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:38 +0000 (09:38 -0800)
4b/39526b9b62f69fa1ae490cb195e89a438d0235 [new file with mode: 0644]

diff --git a/4b/39526b9b62f69fa1ae490cb195e89a438d0235 b/4b/39526b9b62f69fa1ae490cb195e89a438d0235
new file mode 100644 (file)
index 0000000..5991e67
--- /dev/null
@@ -0,0 +1,111 @@
+Return-Path: <amdragon@mit.edu>\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 47035431FD0\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Jun 2011 09:53:40 -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 d7nUxEY62Oth for <notmuch@notmuchmail.org>;\r
+       Mon, 20 Jun 2011 09:53:39 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
+       [18.7.68.35])\r
+       by olra.theworths.org (Postfix) with ESMTP id CB431431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 20 Jun 2011 09:53:39 -0700 (PDT)\r
+X-AuditID: 12074423-b7ce8ae000000a29-2e-4dff7b0c300e\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id BA.11.02601.C0B7FFD4; Mon, 20 Jun 2011 12:53:32 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id p5KGrcZt010422; \r
+       Mon, 20 Jun 2011 12:53:39 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p5KGrbiW018893\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 20 Jun 2011 12:53:38 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.72)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1QYhj7-0000zr-Bm; Mon, 20 Jun 2011 12:53:29 -0400\r
+Date: Mon, 20 Jun 2011 12:53:29 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Sebastian Spaeth <Sebastian@sspaeth.de>\r
+Subject: Re: [python] segfaults at Message.get_date\r
+Message-ID: <20110620165329.GN16025@mit.edu>\r
+References: <20110616215439.GA26997@brick> <87boxxq833.fsf@SSpaeth.de>\r
+       <20110617161024.GA8154@optimusprime> <87hb7n300m.fsf@SSpaeth.de>\r
+       <87hb7m5f4s.fsf@gmail.com>\r
+       <BANLkTik8ged+SoUQf5=x0m-CDC6rAKUoWQ@mail.gmail.com>\r
+       <878vsxvu3x.fsf@SSpaeth.de>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <878vsxvu3x.fsf@SSpaeth.de>\r
+User-Agent: Mutt/1.5.20 (2009-06-14)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42IRYrdT0eWp/u9rsKBNzOL6zZnMFrPmzGN0\r
+       YPJ4tuoWs8fiL0tZApiiuGxSUnMyy1KL9O0SuDImf9vOVrCAt+Lco49MDYy3uboYOTkkBEwk\r
+       ft6azwhhi0lcuLeerYuRi0NIYB+jxMz1O6GcDYwSazfuZoVwTjJJXLt7jRnCWcIocXzWJnaQ\r
+       fhYBVYl5Px4wg9hsAhoS2/YvB5srIqAtcbRlByuIzSwgLfHtdzMTiC0sYCyxedFxsF5eAR2J\r
+       1jaY3f8ZJZZPvcsMkRCUODnzCQtEs5bEjX8vgZo5wAYt/8cBEuYE2vVr4wGwmaICKhLX9rez\r
+       TWAUmoWkexaS7lkI3QsYmVcxyqbkVunmJmbmFKcm6xYnJ+blpRbpmunlZpbopaaUbmIEh7aL\r
+       8g7GPweVDjEKcDAq8fA+Kv/vK8SaWFZcmXuIUZKDSUmUd18lUIgvKT+lMiOxOCO+qDQntfgQ\r
+       owQHs5IIb/zjf75CvCmJlVWpRfkwKWkOFiVx3lxvoDaB9MSS1OzU1ILUIpisDAeHkgTv3xKg\r
+       rGBRanpqRVpmTglCmomDE2Q4D9BwS5DFvMUFibnFmekQ+VOMilLivF5VIKNBEhmleXC9sNTz\r
+       ilEc6BVh3iSQKh5g2oLrfgU0mAlo8P9XIFcXlyQipKQaGJdkLXoW2qh8YkIRu2WeT1Blp07q\r
+       +npt+69914K1CvJnVu+59LklMDg38hNHiZzIyrkhyl9XhJzZdPW0StR6nRvLOv/lGmxyutWw\r
+       l19oTUrf6uydNfdsVmxRnGhsOPNBwFb/GPfbvntXVmwx+XWt0DaA117mZgXr7N3cFsmahy7M\r
+       /6e43yt+sRJLcUaioRZzUXEiAGnONK8YAwAA\r
+Cc: notmuch@notmuchmail.org\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: Mon, 20 Jun 2011 16:53:40 -0000\r
+\r
+Quoth Sebastian Spaeth on Jun 20 at  9:29 am:\r
+> On Sun, 19 Jun 2011 19:51:11 -0400, Austin Clements <amdragon@mit.edu> wrote:\r
+> > A double will precisely represent integers up to 2^53, so this\r
+> > conversion shouldn't be a problem until the year 285422109 or so.\r
+> \r
+> But given that it works, is it actually necessary, that xapian\r
+> apparently pulls an int from the database, returns a std::string to\r
+> libnotmuch, which calls a helper function to unserialize it to a double\r
+> and casts it to time_t before handing it to the user how probably uses\r
+> it as a long?\r
+> \r
+> Can't we easily put in longs and get longs back?\r
+\r
+Xapian only knows about strings, so there has to be serialization\r
+somewhere and the serialized form has to have the same collation order\r
+as the numerical order of the original numbers.  You could do this by\r
+storing the bytes of the long in big-endian form, but that's basically\r
+what sortable_serialise does: roughly, the first byte stores the\r
+number of bits needed to represent the number, followed by enough\r
+bytes to hold those bits in big-endian.  Since POSIX permits a wide\r
+range of types to implement time_t, sortable_serialise also has the\r
+major advantage that it can handle any of them.  So, taking\r
+portability and time_t as assumptions, there are no unnecessary\r
+conversion steps here (and, really, it's just string->double->time_t\r
+on Linux and just string->time_t on a platform that uses floating\r
+point time_t's).\r
+\r
+Alternatively, notmuch could switch to using long instead of time_t\r
+for dates, but that seems like a lot of effort for little gain and\r
+results in portability friction whenever notmuch wants to use the\r
+standard C time API's.\r