This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Running getent in a certain way grows it in memory in critical way.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]