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 X-WM-Posted-At: avacado.atomice.net; Mon, 1 Jul 02 01:47:35 +0100 Message-ID: <007501c22098$e3f49510$0100a8c0@advent02> From: "Chris January" To: References: <012901c22052$3470a5c0$0100a8c0 AT advent02> <20020630170455 DOT GA10399 AT redhat DOT com> <017401c22082$fca36840$0100a8c0 AT advent02> <20020630232515 DOT GA5001 AT redhat DOT com> Subject: Re: problem with inheriting environment Date: Mon, 1 Jul 2002 01:47:35 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 > >> >The settings in the CYGWIN environment variable don't seem to be > >> >inherited by child processes with latest CVS. > >> > >> This isn't enough information for me to go on. You don't see > >> "CYGWIN=whatever" in your child processes? You say CYGWIN=tty and the > >> CYGWIN environment variable says "tty" but you don't have a tty? You > >> say "CYGWIN=ntsec" but the enhanced permissions are not there? > >I set CYGWIN=ntsec and the ehanced permissions are not there. > >I set CYGWIN=check_case:strict and the case checking is relaxed. > >The CYGWIN environment variable does not appear in the environ_init debug > >output of the child process, > > There is no debug output from a child process which would show the CYGWIN > environment variable. > > >and parse_options is not called. > > As I said, the CYGWIN environment variable is getting set for me. I > don't know how to explain what you're seeing. > > If I can't duplicate the problem, there is no way that I'll be able to > debug it. > > This sounds similar to the problem that you reported before. > > If you can figure out why it's happening, I'd be happy to try to rectify > the situation. Setting a breakpoint in environ_init and inspecting the > passed-in environment block should provide some clue about what is > happening. To duplicate, add the 'export' flag to your CYGWIN environment variable. In _addenv, there is the line: envhere = cur_environ ()[offset] = (char *) (ENVMALLOC ? strdup (name) : name); ENVMALLOC is not set by default, so the entry in the environment table gets set to the value of name. However when name goes out of scope in the calling process, it's contents may be overwritten. Now the environment table entry will be pointing to random memory. Therefore, strdup must be called in all situations. Also, the original entry should be free'ed to prevent a memory leak. Chris -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/