X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org From: "Dave Korn" To: References: <042c01c836a1$e6c0d1d0$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <20071205123104 DOT GH26345 AT calimero DOT vinschen DOT de> Subject: RE: Odd behaviour of __cygwin_environ? Date: Wed, 5 Dec 2007 15:00:59 -0000 Message-ID: <04a001c8374f$a58b1a00$2e08a8c0@CAM.ARTIMI.COM> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <20071205123104.GH26345@calimero.vinschen.de> Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On 05 December 2007 12:31, Corinna Vinschen wrote: > On Dec 4 18:17, Dave Korn wrote: >> I'm trying to track down a bug where a child process doesn't inherit all >> the environment variables set in its parent, so I figured I'd add a bunch >> of strace debugging. I wrote this routine to dump an envp[]-style >> pointer-array environment block: [...] >> Am I giving myself a race here? I thought it would be OK to dump >> __cygwin_environ from inside cur_environ because we're in the "if >> (*main_environ != __cygwin_environ)" clause, which IIUIC is switching over >> from the earlystartup minimal win32 environment to the full posix >> environment, > > Did you read the comment right in front of the cur_environ() function? Yep, but I didn't get the implication! > This happens every time the application code has changed the > environment, not using the setenv/putenv functions, but rather by > replacing the global environ pointer with it's self-built environment > block. Usually this also means that the former environment block has > been free'd by the application. This means that at this point you see > __cygwin_environ with some non-0 probability referencing garbage. Ah, that's reassuring. > If you want to see the actual environment block, print __cygwin_environ > after the if-clause. If you encounter an incomplete environment block > at this point, it might also be of some interest to see from where > cur_environ() has been called. > > Do you have a very big environment? Yep, huge! > Keep in mind that the size of the > native environment block is restricted to 32K. I thought when cygexec was in effect the posix environment and commandline were passed around-behind-the-back-of CreateProcess, bypassing that limit? Or does it only handle the commandline but not environment? cheers, DaveK -- Can't think of a witty .sigline today.... -- 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/