X-Recipient: archive-cygwin AT delorie DOT 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=uZEr5yMsyFptXQXxiC27ZFEnTtHVyXzwQR79VpDZ+nMeHrAOKqmoJ tCeSapaVrbWkh139ixkDQi/V6M5/vPIiXhuVe6bKvY6waLT6zturr8rn5H3bBsXA GH+ZhwSISpgHxbeZZvRcl8kTxe3J7X45MYovYvWtwMB+KOcjG53r9k= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=GvjcZsXV5njmnIQsyACkupm16xQ=; b=ZTI8t1oyeFgvPELH+yb7hOAlEo4a iIK1QtwgJpZlVTpQtUorsUavj0Vpi4+kftj37mN0zhaVVkWGRO6UBSByVsKiDTwE GfXinYRaogdmeKPRHSP7Cn/pMvh3XA7GR4JST2oaULvy8knBvln9dcL2yMG1YUWF p5eVm1JM5SVlS0E= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Date: Wed, 26 Feb 2014 13:33:15 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Running getent in a certain way grows it in memory in critical way. Message-ID: <20140226123315.GV2246@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <530DCFDE DOT 4050402 AT shaddybaddah DOT name> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="y6IdC9+/ilDqdjNX" Content-Disposition: inline In-Reply-To: <530DCFDE.4050402@shaddybaddah.name> User-Agent: Mutt/1.5.21 (2010-09-15) --y6IdC9+/ilDqdjNX Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Feb 26 22:28, Shaddy Baddah wrote: > I noticed getent on my 64-bit install for the first time today. > Excited (as I often type it into a Cygwin window, force of habit, to > no avail), I successfully ran; getent hosts www.google.com.au. >=20 > I then decided to check the usage: >=20 > getent --help >=20 > It printed the first bit of blurb (taken from a Debian system, as I'm > not about to try this again on Cygwin, but it should be equivalent): >=20 > $ getent --help > Usage: getent [OPTION...] database [key ...] > Get entries from administrative database. >=20 > -i, --no-idn disable IDN encoding > -s, --service=3DCONFIG Service configuration to be used > -?, --help Give this help list > --usage Give a short usage message > -V, --version Print program version >=20 > At this point, there was no more output. Instead the harddrive started > thrashing and Windows stalled almost to a standstill. Every now and then > I could get the mouse cursor to move. > [...] > 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 opt= ional 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. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --y6IdC9+/ilDqdjNX Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTDd8LAAoJEPU2Bp2uRE+guwIP+wam5G9fPIU37esu4mmfW1hV mRrGrRHfNSDGxfoHYMC0WbCDzBu180fabgLTTlNAKpxZU8QqXkFJEeAdxwSDIzUn cLSr8aPqEhbKY1oTkPzyqyZsxP3hmnxzs45bKBM76sNor4D4R7IvWuKXJWrlByST 6GL9tXQUsRKh6r02yhwGvCXpKC0OQlMxbrc3KMODB/2742YLqb4QBgaje9SAbkV1 ROL+iH7WUa/eT/gSATTxBbIL1EIl0fzkmqTRU4Dm0bur5aEKNmWS7vPXSwzlVLR6 htJYVkhnm5Jc7NrigOfsbKO9/QEk39IYCWQCFcTB02m6O4IW047FPaPQGW17MZt4 njaQZbmfWfMX/Soox8VXPfTWL2x1Zzzt8MeJA3CHLubWVHHeE/E6XrZr6zV6or/A re7HWyP4eykUqjArohE32+K3cXmjKcttggw8xh+wdEjrTJaaKkDZFk0GCz5KEHeM xEMkPlcw8KfXMeh9ecvop5C2wNa6oJFJv+ptcuXuhFHmYqQVFcE41djg4ZDPiDfL Pnp2S92DUSYYO0odRpU6fVsF3c6/gVEh5FRHJkON6WIeGWcgTY7D1v8wHpvj/vjJ 7wolQ0jrprHx9Q9OQI/oXPRxIbuB0tv7fhPI0OOSJmMGQu4ljvMgCpTiEx/YROU7 l6VzJD+ZUMVgpIwHfxyM =+5r7 -----END PGP SIGNATURE----- --y6IdC9+/ilDqdjNX--