This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problen with run command and the environment


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]