delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/18/20:09:08

X-Spam-Check-By: sourceware.org
Message-ID: <43CEE6AC.96F19B3A@dessent.net>
Date: Wed, 18 Jan 2006 17:09:00 -0800
From: Brian Dessent <brian AT dessent DOT net>
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: problen with run command and the environment
References: <20060119005520 DOT 19356 DOT qmail AT web35614 DOT mail DOT mud DOT yahoo DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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

Jeff Hardy wrote:

> I'll accept what you say, but even environment
> variables that are in my windows environment are not
> in the environment of programs run under "run". By
> environment, I mean that if you type set in a cmd
> window, you get the windows environment. Practically
> none of those environment variables that appear when I
> type "set" in the cmd window are in programs run under
> the cygwin "run" command. Also, this behaviour was not
> observed in cygwin before I updated it recently. I
> looked at the source of "run" and see all it does is a
> CreateProcess with NULL in the environment pointer
> which I thought simply passes "run"'s environment to
> the newly created process. I put a printf in run.c
> just before the CreateProcess call and got the HOME
> environment variable and printed it. The value that is
> printed is correct. The HOME environment variable in
> the new process is incorrect.

Yes, this is a real bug in run.  It is a consequence of run being a
Cygwin application but calling CreateProcess directly, which circumvents
Cygwin's routines for spawning processes.  This means that Cygwin does
not have a chance to "fix up" the windows environment, since Cygwin
maintains its own copy of the environment.

The solution seems to be along the lines of what cgf pointed to -- have
run sync its Cygwin environment to the windows environment prior to
CreateProcess.

Brian

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019