Sorting environment

Stephan Mueller smueller@microsoft.com
Sun Apr 13 21:19:00 GMT 1997


My mailer went goofy and turned indentation (quoted) and non-indented
(new) text  into the same >-quoted text.  Lemme try again, lest anyone
care.

stephan();

> -----Original Message-----
> From:	Stephan Mueller 
> Sent:	Friday, April 11, 1997 2:40 PM
> To:	'Ken Estes'; gnu-win32@cygnus.com
> Subject:	RE: Sorting environment
> 
> > Are you speaking for yourself or MS (when you write from your MS
> > account it appears as if you are offering official commentary on the
> > documentation)? Just because your simple experiment did not uncover
> > the problem does not mean that the documentation is wrong.  You have
> > performed NONE of the steps that I have outlined to trigger this
> > problem.
> 
> I am speaking only for myself, not in any official capacity.  Sorry, I
> forgot to add that disclaimer to my last message.  My simple
> experiment was intended only to show that there exists a non-sorted
> environment case, so it is not necessarily reasonable for any software
> to expect that it is always sorted.
> 
> > I am using WinNT and I am launching my programs from other programs
> > not command.com (which may indeed reorder its envrionment before
> > spawning processes).  It is well known that the environment handling
> > in NT is very different from Win95.  I try to keep my code portable
> to
> > both OS so I need to work in the intersection of these
> > constraints. Even if this is not a problem for 95 it is still a
> > problem for NT and must be solved in Cygwin32.
> 
> To work in the intersection then, you can't assume sortedness of the
> environment.
> 
> > The version of _putenv() that I use comes from the MS development
> > studio for C/C++ so any bugs there in are still part of the standard
> > NT envrionment.
> 
> I had assumed that the _putenv you're using came from the cygwin
> runtime library. BUT note also...
> 
> > All documentaion I have seen requires that NT environment be sorted
> > (more then just one parenthetical comment), thus it is a constraint
> of
> > the Win32 API which intends to be independent of 95/NT and is the
> > target of the Cygwin32 effort. I have personally verified this bug
> > under the conditions I have explained.
> 
> ... that the NT environment and the C-runtime environment are not the
> same thing, although quite likely related.  _putenv applies to the
> C-runtime environment, and may or may not have the same constraints as
> the NT environment.  The NT environment is accessed through Win32 APIs
> like GetEnvironmentVariable and SetEnvironmentVariable.
> 
> I looked for some evidence of the sortedness constraint, as applied to
> the NT environment, and can't find any.  In particular, the Visual C++
> Books Online documentation for CreateProcess does not mention any
> sortedness in the lpEnvironment parameter it takes, nor does the
> documentation on environment variables in general, nor do the examples
> on changing environment variables.  In fact, one of the examples,
> which explicitly constructs an environment 'by hand' using strcpy into
> a buffer and such, does so in non-alphabetical order, and then passes
> that environment to CreateProcess.
> 
> It still appears to me that Win32 makes no sortedness guarantee.  I
> hope this is useful information.
> 
> stephan(speaking only for myself, not Microsoft);
> 
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list