delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
Date: | Wed, 5 Dec 2007 13:31:04 +0100 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Odd behaviour of __cygwin_environ? |
Message-ID: | <20071205123104.GH26345@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <042c01c836a1$e6c0d1d0$2e08a8c0 AT CAM DOT ARTIMI DOT COM> |
MIME-Version: | 1.0 |
In-Reply-To: | <042c01c836a1$e6c0d1d0$2e08a8c0@CAM.ARTIMI.COM> |
User-Agent: | Mutt/1.5.16 (2007-06-09) |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
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 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? 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. 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? Keep in mind that the size of the native environment block is restricted to 32K. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |