Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 From: ericblake AT comcast DOT net (Eric Blake) To: cygwin AT cygwin DOT com Subject: Re: Bash login breaks if too many environment variables are set Date: Fri, 16 Sep 2005 16:36:00 +0000 Message-Id: <091620051636.3255.432AF47000065F0D00000CB722007456720A050E040D0C079D0A@comcast.net> > >It looks to me as if a buffer or stack is reused if some maximum is > >exceeded with effect that the system sometimes works. > > From your strace output, it looks to me like windows itself is returning > garbage when we ask it for the list of environment variables. I don't think all places in Windows have the limitation. Corinna reported (and I have reproduced on Win2k, CYGWIN-NT-5.0) that it is quite easy to create an environment larger than 32k and see it in a child process: $ foo=`perl -e 'print "a"x31000'` $ export foo $ /bin/env | wc -c 34664 But it certainly does look like at least one version of Windows (the OP was using CYGWIN_NT-5.1), when manipulating the environment during .bat execution, is tracking total environment size in a signed short, then croaking as the variable wraps around. The output of 'export -p' just before the breaking point will not be exactly 32k, since Cygwin and bash both add variables to the environment before export has a chance to print it. Meanwhile, it also exposes a bug in xargs, using the above environment: $ xargs --help xargs: environment is too large for exec Oops - xargs was over-eager in not exceeding ARG_MAX, even though --help implied there was nothing to exec, and even though on cygwin the environ and command line do not share common storage in exec*(). -- Eric Blake -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/