From: Felipe Contreras <felipe.contreras@gmail.com>
To: Ali Polatel <alip@exherbo.org>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH] ruby: make sure the database is closed
Date: Tue, 24 Apr 2012 03:45:46 +0300 [thread overview]
Message-ID: <CAMP44s2qmPWZk=1N8L1aOnDb7b81kthNB-Gj798wdwBdtbBjFQ@mail.gmail.com> (raw)
In-Reply-To: <CADv3eyxcu=2ZJ7GH3WULKMqe6FdmzhPtU6K9MLcCQ4m0cWmM7A@mail.gmail.com>
On Tue, Apr 24, 2012 at 2:46 AM, Ali Polatel <alip@exherbo.org> wrote:
> 2012/4/24 Felipe Contreras <felipe.contreras@gmail.com>:
>> Personally I don't see why an object, like say a query would remain
>> working correctly after the database is gone, either by calling
>> .close() directly, or just loosing the pointer to the original object.
>> I don't think users would expect that, or, even if they somehow found
>> it useful, that most likely would be very seldom, and hardly worth
>> worrying about it.
>
> Working correctly is not expected but wouldn't it be more appropriate
> to throw an exception rather than dumping core or printing on standard error?
Sure, if that was possible.
> I wonder whether we can make both work somehow.
> Maybe by using talloc explicitly and keeping reference pointers?
> I don't know whether it's worth bothering.
Maybe, I don't see how, that's just not how C works. Maybe talloc does
have some way to figure out if a pointer has been freed, but I doubt
that, and I can't find it by grepping through the API.
Another option would be hook into talloc's destructor so we know when
an object is freed and taint it, but then we would be overriding
notmuch's destructor, and there's no way around that (unless we tap
into talloc's internal structures). A way to workaround that would be
to modify notmuch's API so that we can specify a destructor for
notmuch objects, but that would be tedious, and I doubt a lof people
beside us would benefit from that.
In the meantime, it doesn't hurt to apply this patch.
--
Felipe Contreras
next prev parent reply other threads:[~2012-04-24 0:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-23 12:43 [PATCH] ruby: make sure the database is closed Felipe Contreras
2012-04-23 14:04 ` Ali Polatel
2012-04-23 15:07 ` Felipe Contreras
2012-04-23 20:43 ` Ali Polatel
2012-04-23 22:45 ` Felipe Contreras
2012-04-23 23:46 ` Ali Polatel
2012-04-24 0:45 ` Felipe Contreras [this message]
2012-04-24 1:15 ` Austin Clements
2012-04-24 10:30 ` Felipe Contreras
2012-04-25 20:22 ` Ali Polatel
-- strict thread matches above, loose matches on Subject: below --
2012-04-23 12:48 Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMP44s2qmPWZk=1N8L1aOnDb7b81kthNB-Gj798wdwBdtbBjFQ@mail.gmail.com' \
--to=felipe.contreras@gmail.com \
--cc=alip@exherbo.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).