Subject: Env bug Report
From: [email-masked] (Ken Estes)

26 Jan 1997 15:44:04 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Original-To: [email-masked]
In-reply-to: <[email-masked]> ([email-masked])
Original-Sender: [email-masked]

There are some subtle interactions with Bash and the NT environment.
NT requires that environmental variables be alphabetized and under
SOME circumstances bash does not do the required alphabetization.  Our
programs behave very differently when we replace

	export SM_HOME=j:/src/estes ; \
	  j:/smarts/sysapi/winnt-i386/runcmd.exe 

with

	SM_HOME=j:/src/estes \
	  j:/smarts/sysapi/winnt-i386/runcmd.exe 

We invoke a wrapper program (runcmd) which modifies the environment
using NT primitives (getenv, putenv to change PATH and not SM_HOME)
then invokes other programs.  When the environment is not in
alphabetical order you end up with two version of the variable in the
environment. The variable that a child process will see will depend on
the language it is written in! You will see one of these version in C
(getenv of PATH will show what you put in with putenv) but perl will
show you the original version of the variable (before rumcd inherited
it!  This is possible since this older version was never removed from
the environment an perl uses different primitives to load the ENV hash
array).

Ironically it is the EXPORT version does not work correctly.

Use GetEnvironmentStrings() to examine the environment for
alphabetization, and to look for duplicate variables.

This problem occurs with build 17.1.  I will be happy to debug it
further if someone can point me to where the env magic takes place. I
know that things are usually alphabetized so I think the cygwin dll
already has the code for this.  Also there is some other magic going
on with PATH (et al.) and slashes changing from forward to NT style
when you export.  I would like to document this since I do
not like to rely on magic that I do not understand.

Ken Estes
[email-masked]
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".