Re: [PATCH] ruby: make sure the database is closed
authorFelipe Contreras <felipe.contreras@gmail.com>
Tue, 24 Apr 2012 00:45:46 +0000 (03:45 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:41 +0000 (09:46 -0800)
39/cd48f99e76425b10774126f59ebf0c22ec5b61 [new file with mode: 0644]

diff --git a/39/cd48f99e76425b10774126f59ebf0c22ec5b61 b/39/cd48f99e76425b10774126f59ebf0c22ec5b61
new file mode 100644 (file)
index 0000000..2d16c99
--- /dev/null
@@ -0,0 +1,103 @@
+Return-Path: <felipe.contreras@gmail.com>\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 CD88E431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 17:45:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, 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 cDZXVI7Z2G6o for <notmuch@notmuchmail.org>;\r
+       Mon, 23 Apr 2012 17:45:49 -0700 (PDT)\r
+Received: from mail-ey0-f181.google.com (mail-ey0-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 1522C431FAE\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 17:45:48 -0700 (PDT)\r
+Received: by eaa1 with SMTP id 1so39195eaa.26\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 17:45:46 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=mime-version:in-reply-to:references:date:message-id:subject:from:to\r
+       :cc:content-type;\r
+       bh=9jB0H7t1Q145JF1nCAeKJ6200LjvFMz1QyMp7qdchs0=;\r
+       b=TIniuAnvs3WnfqLO0RWWoyJ1JNIsFymZCljSbrbCydsQMJ+cdoyQcM/kSjnnxPQS4R\r
+       xUKk1hlpQ7gnpzIRchORMAHF87N0QtpCepREkVI+fmSg3fkDBMfymXTyz7rXeyYdMkr9\r
+       T4/La0DMiX3PJ7r79puSv9NQyQbXkPojywaF6Yz7CkaazwzpHhEVidZ/nX34tpfbuzhM\r
+       KZifffitQe2Ft+lUt+cNopBC7DbTGOFm52ScIOoQbU/Y7CAhgkzJlkpArYiDUehzBzC7\r
+       Q8seqmSfvdTlSZAoKFiT7Xb1MK07/rOpmpdYeN0+s/ZGbDmW5nidV12PpqkQEnbUygsR\r
+       zoRA==\r
+MIME-Version: 1.0\r
+Received: by 10.14.96.129 with SMTP id r1mr2915427eef.86.1335228346317; Mon,\r
+       23 Apr 2012 17:45:46 -0700 (PDT)\r
+Received: by 10.213.103.18 with HTTP; Mon, 23 Apr 2012 17:45:46 -0700 (PDT)\r
+In-Reply-To:\r
+ <CADv3eyxcu=2ZJ7GH3WULKMqe6FdmzhPtU6K9MLcCQ4m0cWmM7A@mail.gmail.com>\r
+References: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com>\r
+       <CADv3eywAvyMuh3vWLwyuf0Ui_kskwp9875pGxCR1GTm7deN9Pg@mail.gmail.com>\r
+       <CAMP44s3SyU4WVV0_McHWseNL=jmMnAXO2EdZK4Xk-wrCHPVD8A@mail.gmail.com>\r
+       <CADv3eywb0tguYowTAK5Ag9YZ48zFZA0QJVNEj_cZcCpr-76Bbg@mail.gmail.com>\r
+       <CAMP44s0=m+PmVBdVytHaYujpaZu=2WH+1F_VoMzpfXH+SS_ZmQ@mail.gmail.com>\r
+       <CADv3eyxcu=2ZJ7GH3WULKMqe6FdmzhPtU6K9MLcCQ4m0cWmM7A@mail.gmail.com>\r
+Date: Tue, 24 Apr 2012 03:45:46 +0300\r
+Message-ID:\r
+ <CAMP44s2qmPWZk=1N8L1aOnDb7b81kthNB-Gj798wdwBdtbBjFQ@mail.gmail.com>\r
+Subject: Re: [PATCH] ruby: make sure the database is closed\r
+From: Felipe Contreras <felipe.contreras@gmail.com>\r
+To: Ali Polatel <alip@exherbo.org>\r
+Content-Type: text/plain; charset=UTF-8\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: Tue, 24 Apr 2012 00:45:49 -0000\r
+\r
+On Tue, Apr 24, 2012 at 2:46 AM, Ali Polatel <alip@exherbo.org> wrote:\r
+> 2012/4/24 Felipe Contreras <felipe.contreras@gmail.com>:\r
+\r
+>> Personally I don't see why an object, like say a query would remain\r
+>> working correctly after the database is gone, either by calling\r
+>> .close() directly, or just loosing the pointer to the original object.\r
+>> I don't think users would expect that, or, even if they somehow found\r
+>> it useful, that most likely would be very seldom, and hardly worth\r
+>> worrying about it.\r
+>\r
+> Working correctly is not expected but wouldn't it be more appropriate\r
+> to throw an exception rather than dumping core or printing on standard error?\r
+\r
+Sure, if that was possible.\r
+\r
+> I wonder whether we can make both work somehow.\r
+> Maybe by using talloc explicitly and keeping reference pointers?\r
+> I don't know whether it's worth bothering.\r
+\r
+Maybe, I don't see how, that's just not how C works. Maybe talloc does\r
+have some way to figure out if a pointer has been freed, but I doubt\r
+that, and I can't find it by grepping through the API.\r
+\r
+Another option would be hook into talloc's destructor so we know when\r
+an object is freed and taint it, but then we would be overriding\r
+notmuch's destructor, and there's no way around that (unless we tap\r
+into talloc's internal structures). A way to workaround that would be\r
+to modify notmuch's API so that we can specify a destructor for\r
+notmuch objects, but that would be tedious, and I doubt a lof people\r
+beside us would benefit from that.\r
+\r
+In the meantime, it doesn't hurt to apply this patch.\r
+\r
+-- \r
+Felipe Contreras\r