public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Mike Mueller <mike@subfocal.net>
To: cygwin@cygwin.com
Subject: Re: Cygwin app not receiving modified PATH env var
Date: Wed, 18 Jun 2008 08:51:00 -0000	[thread overview]
Message-ID: <20080618080059.GF7632@samus.subfocal.net> (raw)
In-Reply-To: <20080618010536.GE7632@samus.subfocal.net>

On Tue, Jun 17, 2008 at 09:05:36PM -0400, Mike Mueller wrote:
> On Mon, Jun 16, 2008 at 11:41:52PM -0400, Mike Mueller wrote:
> > I have a program (native win32) that is capable of launching
> > sub-processes, using apr (apache portable runtime), which is essentially
> > a wrapper around CreateProcess in the Windows API.  My program creates a
> > modified environment (changes the PATH env var), and passes this new
> > environment to CreateProcess.
> > 
> > When I run a native Windows program, for example, a .bat script that
> > says "echo %PATH%", I see the correctly modified PATH env var.
> > 
> > When I run a Cygwin program, the PATH is the original unmodified path
> > (rephrased in cygwin format), maybe inherited from the parent process?
> > The modified PATH being passed to CreateProcess is not discovered by the
> > Cygwin app.
> > 
> > I would've expected the two to behave the same in this situation.  Has
> > anyone done anything like this before?  Is there a known issue here, or
> > is this a new bug?  Workarounds?
> 
> No thoughts on this?  How & when does Cygwin take a snapshot of the
> Windows environment?  I'm still trying to figure out how my modified
> environment is not being picked up...

A little further info.  It looks like apr detects a unicode environment,
so ultimately is calling CreateProcessW (not CreateProcessA).

Also, if I pass environment variables other than PATH, they are set
properly when the child executes.  I'm even able to override other
variables that are set already in the environment, and the new value is
seen by the child.  PATH is the only variable I can't get to work.

I also tried the 'noenvcache' option, with no effect.

Mike

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

  reply	other threads:[~2008-06-18  8:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17  7:21 Mike Mueller
2008-06-18  4:56 ` Mike Mueller
2008-06-18  8:51   ` Mike Mueller [this message]
2008-06-18  9:30     ` Corinna Vinschen
2008-06-18 10:53       ` Mike Mueller
2008-06-18 12:04         ` Corinna Vinschen
2008-06-18 14:52           ` Mike Mueller
2008-06-18  9:27   ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080618080059.GF7632@samus.subfocal.net \
    --to=mike@subfocal.net \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).