From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 38FBE431FD0 for ; Sun, 19 Jun 2011 16:51:14 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, 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 4a3j476znMrb for ; Sun, 19 Jun 2011 16:51:13 -0700 (PDT) Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com [209.85.216.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 8B18B431FB6 for ; Sun, 19 Jun 2011 16:51:13 -0700 (PDT) Received: by qwb7 with SMTP id 7so1267190qwb.26 for ; Sun, 19 Jun 2011 16:51:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=j+YfXaIeM4Xt13+Z+HAbXY4MCvXq1YTpqC866rVrfSo=; b=DwnOhB9WG6dYyuNXjeFJZ736QPc9QgutjN0X+55FVgD4Zkk5KBqd0hLjlH7LgwsYrJ 4zNs1hMSFsOpRkavROMRHEj6bTqrbW0fMFYCMeiOtLV4POk+SDzBf2VXWGncZZAJJSLW 9TDNnu2EKpTui1S/lFCJe2nDyPOTvwm/1GE9I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=CTfm2nwMrQnI76gKULBwFIoKOG7uWfu+KsvlCQKmYIWo3qwP4m96DT4bgHf3PMiFS5 b9L/6J4cVMV7tvdaGDUHhI7PL6XONRzj9qOzMSkfU59nVKj1Ke4yVdBLz3B+8XKRw//O 1ANdKiRV9VozRfKWDXIgPsRWfSiAguQnio/BM= MIME-Version: 1.0 Received: by 10.229.41.70 with SMTP id n6mr3426610qce.252.1308527471252; Sun, 19 Jun 2011 16:51:11 -0700 (PDT) Sender: amdragon@gmail.com Received: by 10.229.32.197 with HTTP; Sun, 19 Jun 2011 16:51:11 -0700 (PDT) In-Reply-To: <87hb7m5f4s.fsf@gmail.com> References: <20110616215439.GA26997@brick> <87boxxq833.fsf@SSpaeth.de> <20110617161024.GA8154@optimusprime> <87hb7n300m.fsf@SSpaeth.de> <87hb7m5f4s.fsf@gmail.com> Date: Sun, 19 Jun 2011 19:51:11 -0400 X-Google-Sender-Auth: 7Dp9V-uz1wfhrvxewHJ7fJ-m7Og Message-ID: Subject: Re: [python] segfaults at Message.get_date From: Austin Clements To: Dmitry Kurochkin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Patrick Totzke , notmuch@notmuchmail.org 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, 19 Jun 2011 23:51:14 -0000 On Sun, Jun 19, 2011 at 5:45 AM, Dmitry Kurochkin wrote: > Hi Sebastian, Patrick. > > On Sat, 18 Jun 2011 12:30:01 +0200, Sebastian Spaeth wrote: >> On Fri, 17 Jun 2011 17:10:24 +0100, Patrick Totzke : >> > #0 =A00x006eb87d in Xapian::Document::Internal::get_value(unsigned int= ) const () from /usr/lib/sse2/libxapian.so.22 >> > #1 =A00x006eb952 in Xapian::Document::get_value(unsigned int) const ()= from /usr/lib/sse2/libxapian.so.22 >> > #2 =A00x00523963 in notmuch_message_get_date () from /usr/local/lib/li= bnotmuch.so.1 >> >> One question, what type is libnotmuch really returning here? The code: >> >> >> time_t >> notmuch_message_get_date (notmuch_message_t *message) >> { =A0 ... >> =A0 =A0 return Xapian::sortable_unserialise (value); >> } >> >> But Xapian API says that sortable_unserialise() returns floating type "d= ouble" >> >> http://xapian.org/docs/apidoc/html/namespaceXapian.html#326fe2d6b0ee59ac= 9536f3960e8fd99b >> "Convert a string encoded using sortable_serialise back to a floating >> point number." >> >> But time_t is usually a (signed) long and not floating point. Obviously >> things have worked just fine so far, but is libnotmuch really returning >> the right type here? Sorry, I expose my total lack of basic C++ knowledg= e >> here... >> > > Converting double to time_t does not look good. =A0Notmuch converts > between time_t and double both when setting and getting the date. =A0I > guess it should work good in most cases at least. =A0Perhaps Carl knows > better that it is safe. A double will precisely represent integers up to 2^53, so this conversion shouldn't be a problem until the year 285422109 or so.