delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/04/11/22:36:43

From: smueller AT microsoft DOT com (Stephan Mueller)
Subject: RE: Sorting environment
11 Apr 1997 22:36:43 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <9106B0327B3ACF11ACEF00805FD47A0B02871522.cygnus.gnu-win32@RED-67-MSG.dns.microsoft.com>
Original-To: "'Ken Estes'" <estes AT smarts DOT com>, gnu-win32 AT cygnus DOT com
X-Priority: 3
X-Mailer: Internet Mail Service (5.0.1458.8)
Original-Sender: owner-gnu-win32 AT cygnus DOT com

> 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


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