1 Return-Path: <tomi.ollila@iki.fi>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 9FBED431FB6
\r
6 for <notmuch@notmuchmail.org>; Thu, 20 Dec 2012 07:40:16 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id l2r++ll-zbFq for <notmuch@notmuchmail.org>;
\r
16 Thu, 20 Dec 2012 07:40:13 -0800 (PST)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 0ECEC431FAE
\r
19 for <notmuch@notmuchmail.org>; Thu, 20 Dec 2012 07:40:13 -0800 (PST)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 268AE100094;
\r
22 Thu, 20 Dec 2012 17:40:06 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: david@tethera.net, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH 1/3] CLI: add talloc leak report,
\r
26 controlled by an environment variable.
\r
27 In-Reply-To: <1355714648-23144-2-git-send-email-david@tethera.net>
\r
28 References: <1355714648-23144-1-git-send-email-david@tethera.net>
\r
29 <1355714648-23144-2-git-send-email-david@tethera.net>
\r
30 User-Agent: Notmuch/0.14+211~g71b47e9 (http://notmuchmail.org) Emacs/24.2.1
\r
31 (x86_64-unknown-linux-gnu)
\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
33 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
34 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
35 Date: Thu, 20 Dec 2012 17:40:05 +0200
\r
36 Message-ID: <m2hangivfu.fsf@guru.guru-group.fi>
\r
38 Content-Type: text/plain
\r
39 Cc: David Bremner <bremner@debian.org>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Thu, 20 Dec 2012 15:40:16 -0000
\r
54 On Mon, Dec 17 2012, david@tethera.net wrote:
\r
56 > From: David Bremner <bremner@debian.org>
\r
58 > The argument handling in notmuch.c seems due for an overhaul, but
\r
59 > until then use an environment variable to specify a location to write
\r
60 > the talloc leak report to. This is only enabled for the (interesting)
\r
61 > case where some notmuch subcommand is invoked.
\r
64 I'd still suggest to have similar command-line interface option(s) as
\r
65 samba4 use: --leak-report and/or --leak-report-full
\r
67 (search --leak-r in talloc(3) namual page)
\r
71 > notmuch.c | 16 ++++++++++++++--
\r
72 > 1 file changed, 14 insertions(+), 2 deletions(-)
\r
74 > diff --git a/notmuch.c b/notmuch.c
\r
75 > index 9516dfb..fb49c5a 100644
\r
78 > @@ -322,8 +322,20 @@ main (int argc, char *argv[])
\r
79 > for (i = 0; i < ARRAY_SIZE (commands); i++) {
\r
80 > command = &commands[i];
\r
82 > - if (strcmp (argv[1], command->name) == 0)
\r
83 > - return (command->function) (local, argc - 1, &argv[1]);
\r
84 > + if (strcmp (argv[1], command->name) == 0) {
\r
86 > + char *talloc_report;
\r
88 > + ret = (command->function) (local, argc - 1, &argv[1]);
\r
90 > + talloc_report=getenv ("NOTMUCH_TALLOC_REPORT");
\r
91 > + if (talloc_report && strcmp(talloc_report, "") != 0) {
\r
92 > + FILE *report = fopen (talloc_report, "w");
\r
93 > + talloc_report_full (NULL, report);
\r
100 > fprintf (stderr, "Error: Unknown command '%s' (see \"notmuch help\")\n",
\r
104 > _______________________________________________
\r
105 > notmuch mailing list
\r
106 > notmuch@notmuchmail.org
\r
107 > http://notmuchmail.org/mailman/listinfo/notmuch
\r