X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=rsHiSRHtCXvaZKa2+OwGrppc2xIBf2G+kbsZSL8WW58
	gqNXJL0e8DXqErcDo6ZMfe85kra3QL5gMGKhstbCR1f0GVnGlArZU1whJYmT8df3
	TZjLH3aAyQs6e2YaGh9nG2x8vEtBa1SE0NLr3dKifJV6PsdKW9JOBTbdbj1HyFQk
	=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 s=default; bh=iUhxgvqHSHPFiRh6SZfOYXnFzW4=; b=ZccMDUofV00CA38oA
	Q5dX239c9/IwIgeIYAVB0Uj5bs0Pv4qsnIgB0oVvG/jE2yV9SIm0pzBHmc5amiP3
	w4ZBuzWAIa9Ez5wsGftZd1cteQnlXIAUDntimA1Ap5BI/Ie7v+wWVgsPc7xc+mO7
	i9w8DSAR/jpLHQGccbAs9MxXYM=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: mail6.worldispnetwork.com
Message-ID: <530DE028.8060305@shaddybaddah.name>
Date: Wed, 26 Feb 2014 23:38:00 +1100
From: Shaddy Baddah <lithium-cygwin@shaddybaddah.name>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20131104 Icedove/17.0.10
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Running getent in a certain way grows it in memory in critical way.
References: <530DCFDE.4050402@shaddybaddah.name> <20140226123315.GV2246@calimero.vinschen.de>
In-Reply-To: <20140226123315.GV2246@calimero.vinschen.de>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Hi Corinna,

On 2014/02/26 23:33+1100, Corinna Vinschen wrote:
> On Feb 26 22:28, Shaddy Baddah wrote:
<snip/>
>> Not believing what I had seen, I downloaded the code and checked it. I
>> inspected more_help() function, and suspecting the for loop my have
>> runaway, I eyed it over. It looks fine to me. I did notice
>> open_memstream(), and because I'm not familiar with its usage, I didn't
>> give it too much thought. I now think the method of dynamically growing
>> memory allocation may be a culprit. But I get ahead of myself.
>
> Hmm, I guess that's my fault.  While porting getent, I found that
> the output of `getent --help' was always missing the stuff which
> was supposed to be following after the -V,--version:
>
>    Mandatory or optional arguments to long options are also mandatory or optional
>    for any corresponding short options.
>
>    Supported databases:
>    ahosts ahostsv4 ahostsv6 group hosts initgroups passwd protocols
>    services
>
>    For bug reporting instructions, please see:
>    http://cygwin.com/problems.html.
>
> In my case it didn't run wild, it just omitted the aforementioned text.
> After some debugging it turned out that newlib's open_memstream
> functionality had a bug.  It neglected to initialize the variable
> containing the current number of bytes written to the mem buffer to 0.
> I fixed this bug in newlib, but obviously it's not yet in the released
> Cygwin version 1.7.28.  It will be in 1.7.29, though.  So, for the
> time being, either refrain from calling `getent --help', or update
> to the latest Cygwin snapshot from http://cygwin.com/snapshots/,
> which will not have this problem.

Phew. Thanks for that. It seemed like one of those problems that may
have been to specific to my system and not easily reproducible.

I'll wait for 1.7.29.

-- 
Thanks,
Shaddy



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

