Re: [PATCH] notmuch-new.c infinite recursion symlink bug
authorAustin Clements <amdragon@mit.edu>
Tue, 21 Jun 2011 16:01:17 +0000 (12:01 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:39 +0000 (09:38 -0800)
16/a7026cd18e6125f8386085438ada268363dc7c [new file with mode: 0644]

diff --git a/16/a7026cd18e6125f8386085438ada268363dc7c b/16/a7026cd18e6125f8386085438ada268363dc7c
new file mode 100644 (file)
index 0000000..e9f6067
--- /dev/null
@@ -0,0 +1,90 @@
+Return-Path: <amdragon@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 CC399431FD0\r
+       for <notmuch@notmuchmail.org>; Tue, 21 Jun 2011 09:01:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,\r
+       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 cuya1VQ-rRCh for <notmuch@notmuchmail.org>;\r
+       Tue, 21 Jun 2011 09:01:18 -0700 (PDT)\r
+Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com\r
+       [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 4EF50431FB6\r
+       for <notmuch@notmuchmail.org>; Tue, 21 Jun 2011 09:01:18 -0700 (PDT)\r
+Received: by qyk9 with SMTP id 9so2045036qyk.5\r
+       for <notmuch@notmuchmail.org>; Tue, 21 Jun 2011 09:01:17 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=domainkey-signature:mime-version:sender:in-reply-to:references:date\r
+       :x-google-sender-auth:message-id:subject:from:to:content-type\r
+       :content-transfer-encoding;\r
+       bh=DEPv2cG8I+YymjPZ/Io4rESDFYFxU1w9gZCIcatLDp4=;\r
+       b=hXpZuSPlqASJQZdeQXvb8whbPn+ce20EeYgEtQf3B52m00K3BM6cO7WKrXjGu7riwk\r
+       s7sKz78Xo1pXjz1uSncTf+IKU63pcmOANIIxaFfsKTOe9+HiOxH5zThAm47x7zPxCPSW\r
+       3Gwwg42tcr8+JkORNjr4S2Jdmdwrdn8BPjVg4=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+       h=mime-version:sender:in-reply-to:references:date\r
+       :x-google-sender-auth:message-id:subject:from:to:content-type\r
+       :content-transfer-encoding;\r
+       b=AyfDRys8ZmzsRqS3uDjo63JTzVM8nY7yCwjRyktdUD7JFW2LUScg4r0c5SJIcUxqK9\r
+       oE5bXqwzjZ6iYbRGb9ynfVv/NjyeGQfS5iFb9fxNtOYOlT/9NytO49y1LFKgNUvXGmH4\r
+       /bvGDTs/Q4o9UlEmTkq81xY9Y76V+y2zCj3hM=\r
+MIME-Version: 1.0\r
+Received: by 10.229.18.67 with SMTP id v3mr5268842qca.100.1308672077488; Tue,\r
+       21 Jun 2011 09:01:17 -0700 (PDT)\r
+Sender: amdragon@gmail.com\r
+Received: by 10.229.32.197 with HTTP; Tue, 21 Jun 2011 09:01:17 -0700 (PDT)\r
+In-Reply-To: <4E0091AE.5070609@fifthhorseman.net>\r
+References: <20110610073208.GA74787@codecafe.com>\r
+       <4E0091AE.5070609@fifthhorseman.net>\r
+Date: Tue, 21 Jun 2011 12:01:17 -0400\r
+X-Google-Sender-Auth: s8hXmck4YsOkSc_igawn0-ls_c8\r
+Message-ID: <BANLkTik_o6d03g7Jsy-sUbjCp9HR7Q=rkw@mail.gmail.com>\r
+Subject: Re: [PATCH] notmuch-new.c infinite recursion symlink bug\r
+From: Austin Clements <amdragon@mit.edu>\r
+To: notmuch <notmuch@notmuchmail.org>\r
+Content-Type: text/plain; charset=ISO-8859-1\r
+Content-Transfer-Encoding: quoted-printable\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, 21 Jun 2011 16:01:18 -0000\r
+\r
+On Tue, Jun 21, 2011 at 8:42 AM, Daniel Kahn Gillmor\r
+<dkg@fifthhorseman.net> wrote:\r
+> My point is: there are lots of ways to get infinite recursions via\r
+> symlinks; =A0hard-coding a check for one specific way seems like a\r
+> sub-optimal approach, because it leaves the other paths still present,\r
+> and introduces an unexpected/surprising asymmetry.\r
+>\r
+> I'm not sure what the specific right way is to solve the problem you\r
+> identified, though.\r
+\r
+A simple solution to this problem would be to record the inode numbers\r
+of each visited directory, probably in a hash table in\r
+add_files_state_t.  At the beginning of add_files_recursive, right\r
+after it stat's the directory, check if st.st_ino is in this hash\r
+table; if it is, return immediately, otherwise add it to the hash\r
+table and proceed as usual.\r
+\r
+Alternatively, because of folder search, it might be better to keep a\r
+stack of inode numbers to eliminate loops while retaining notmuch's\r
+current approach of repeatedly indexing mail that's symlinked in\r
+multiple folders.\r