From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-1.sys.kth.se (smtp-1.sys.kth.se [130.237.32.175]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id pAD0CdQv007464 for ; Sat, 12 Nov 2011 19:12:39 -0500 (EST) Received: from mailscan-1.sys.kth.se (mailscan-1.sys.kth.se [130.237.32.91]) by smtp-1.sys.kth.se (Postfix) with ESMTP id C22EF156333 for ; Sun, 13 Nov 2011 01:12:33 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-1.sys.kth.se ([130.237.32.175]) by mailscan-1.sys.kth.se (mailscan-1.sys.kth.se [130.237.32.91]) (amavisd-new, port 10024) with LMTP id IiHjqlWkMnQy for ; Sun, 13 Nov 2011 01:12:33 +0100 (CET) X-KTH-Auth: kristaps [77.201.233.73] X-KTH-mail-from: kristaps@bsd.lv X-KTH-rcpt-to: tech@mdocml.bsd.lv Received: from [192.168.1.57] (73.233.201.77.rev.sfr.net [77.201.233.73]) by smtp-1.sys.kth.se (Postfix) with ESMTP id E81FF154137 for ; Sun, 13 Nov 2011 01:12:32 +0100 (CET) Message-ID: <4EBF0B70.8040500@bsd.lv> Date: Sun, 13 Nov 2011 01:12:32 +0100 From: Kristaps Dzonsons User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 To: tech@mdocml.bsd.lv Subject: Re: fix two crashes in mandocdb References: <20111113000929.GD16229@iris.usta.de> In-Reply-To: <20111113000929.GD16229@iris.usta.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 13/11/2011 01:09, Ingo Schwarze wrote: > Hi, > > here are two easy, but important bugfixes for mandocdb(8). > > Chunk 1 is required such that mandocdb doesn't die on extremely > long files. In my /usr/share/man tree, i have a few very large > files - not real manuals, but they get in the way. > > The man parser produces several tens of thousands of text nodes > from these files. When mandocdb.c attempts to parse them, it > abuses recursion to walk a linear list, resulting in O(N) > stack size requirements. Stacks with several tens of thousands > of frames don't work well, the program consistently segfaulted; > overflowing thew stack, i guess. > > With the for loop, time requirements are still O(N), but at > least we get constant stack size. I guess we should scour > the tree for similar bugs. This might as well crash massively > oversized man(7) manuals during normal formatting. > > > Chunk 2 is required to avoid running out of file descriptors > when walking large directory trees. Otherwise, mandocdb keeps > crashing on me because it hits the system resource limit on > open file descriptors. > > > Using this, i can now run > > # mandocdb /usr/share/man > > on my main development machine. > > OK? Ingo, great find! Please check this in. Thanks again, Kristaps -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv