Re: how to specify notmuch colors in emacs24
[notmuch-archives.git] / 47 / 39c8b1bf71dcff0c0e035cbb532de0710ea862
1 Return-Path: <taylor@codecafe.com>\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 CC0CA431FD0\r
6         for <notmuch@notmuchmail.org>; Fri, 10 Jun 2011 00:50:32 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 BwanKUUnpuqp for <notmuch@notmuchmail.org>;\r
16         Fri, 10 Jun 2011 00:50:32 -0700 (PDT)\r
17 Received: from mail-gx0-f181.google.com (mail-gx0-f181.google.com\r
18         [209.85.161.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 1CD83431FB6\r
21         for <notmuch@notmuchmail.org>; Fri, 10 Jun 2011 00:50:32 -0700 (PDT)\r
22 Received: by gxk9 with SMTP id 9so1855307gxk.26\r
23         for <notmuch@notmuchmail.org>; Fri, 10 Jun 2011 00:50:31 -0700 (PDT)\r
24 Received: by 10.236.186.106 with SMTP id v70mr2014013yhm.408.1307692231410;\r
25         Fri, 10 Jun 2011 00:50:31 -0700 (PDT)\r
26 Received: from localhost (cpe-70-113-59-5.austin.res.rr.com [70.113.59.5])\r
27         by mx.google.com with ESMTPS id o47sm1196854yhn.16.2011.06.10.00.50.29\r
28         (version=TLSv1/SSLv3 cipher=OTHER);\r
29         Fri, 10 Jun 2011 00:50:30 -0700 (PDT)\r
30 Date: Fri, 10 Jun 2011 02:50:27 -0500\r
31 From: Taylor Carpenter <taylor@codecafe.com>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH] notmuch-new.c infinite recursion symlink bug\r
34 Message-ID: <20110610075027.GA75006@codecafe.com>\r
35 References: <20110610073208.GA74787@codecafe.com>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain; charset=us-ascii\r
38 Content-Disposition: inline\r
39 In-Reply-To: <20110610073208.GA74787@codecafe.com>\r
40 User-Agent: Mutt/1.5.21 (2010-09-15)\r
41 X-Mailman-Approved-At: Mon, 20 Jun 2011 15:19:13 -0700\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\r
45 List-Id: "Use and development of the notmuch mail system."\r
46         <notmuch.notmuchmail.org>\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
50 List-Post: <mailto:notmuch@notmuchmail.org>\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
54 X-List-Received-Date: Fri, 10 Jun 2011 07:50:32 -0000\r
55 \r
56 On 06/10/11 at 02:32P, Taylor Carpenter wrote:\r
57 > If a symlink points to . then there will be an infinite recursion.  The included patch fixes that.\r
58 \r
59 \r
60 I did not realize this was needed in the count function as well.  New\r
61 patch included that does both.\r
62 \r
63 --- notmuch-new.c.orig  2011-06-10 00:03:09.000000000 -0500\r
64 +++ notmuch-new.c 2011-06-10 02:46:18.000000000 -0500\r
65 @@ -233,6 +233,8 @@\r
66      struct stat st;\r
67      notmuch_bool_t is_maildir, new_directory;\r
68      const char **tag;\r
69 +    char lpath[PATH_MAX], filepath[PATH_MAX];\r
70 +    size_t len;\r
71  \r
72      if (stat (path, &st)) {\r
73   fprintf (stderr, "Error reading directory %s: %s\n",\r
74 @@ -296,6 +298,14 @@\r
75    */\r
76   /* XXX: Eventually we'll want more sophistication to let the\r
77    * user specify files to be ignored. */\r
78 +\r
79 + if (entry->d_type == DT_LNK) {\r
80 +     snprintf(filepath, sizeof(filepath), "%s/%s", path, entry->d_name);\r
81 +     if ((len = readlink(filepath, lpath, sizeof(lpath))) > 0)\r
82 +         if (strncmp(lpath, ".", len-1) == 0)\r
83 +             continue;\r
84 + }\r
85 +\r
86   if (strcmp (entry->d_name, ".") == 0 ||\r
87       strcmp (entry->d_name, "..") == 0 ||\r
88       (is_maildir && strcmp (entry->d_name, "tmp") == 0) ||\r
89 @@ -615,6 +625,8 @@\r
90      struct dirent **fs_entries = NULL;\r
91      int num_fs_entries = scandir (path, &fs_entries, 0, dirent_sort_inode);\r
92      int i = 0;\r
93 +    char lpath[PATH_MAX], filepath[PATH_MAX];\r
94 +    size_t len;\r
95  \r
96      if (num_fs_entries == -1) {\r
97   fprintf (stderr, "Warning: failed to open directory %s: %s\n",\r
98 @@ -633,6 +645,13 @@\r
99    */\r
100   /* XXX: Eventually we'll want more sophistication to let the\r
101    * user specify files to be ignored. */\r
102 + if (entry->d_type == DT_LNK) {\r
103 +     snprintf(filepath, sizeof(filepath), "%s/%s", path, entry->d_name);\r
104 +     if ((len = readlink(filepath, lpath, sizeof(lpath))) > 0)\r
105 +         if (strncmp(lpath, ".", len-1) == 0)\r
106 +             continue;\r
107 + }\r
108 +\r
109   if (strcmp (entry->d_name, ".") == 0 ||\r
110       strcmp (entry->d_name, "..") == 0 ||\r
111       strcmp (entry->d_name, ".notmuch") == 0)\r
112 \r
113 \r
114 \r
115 \r