Re: Windows env-Bug?
- From: Gerhard Reithofer <gerhard.reithofer@xxxxxxxxxxxxxx>
- Date: Sat, 28 Jul 2007 11:28:29 +0200
On Thu, 26 Jul 2007, Joe English wrote:
David Gravereaux wrote:
Currently, a DLL (in the chain of things) might call win32's
SetEnvironmentVariable() which is not reflected by libc's cache of the real
....
That's another reason I think Tcl's treatment of ::env
ought to be changed. Instead of trying (and often failing)
to keep ::env in sync with the system environment at all times,
Tcl could initialize ::env from the system environment
at program startup only.
Slave interps and new threads would inherit ::env from their
parent interp, and the current interp's ::env would be used
to initialize the system environment for child processes
spawned via [exec], [open "|..."], and the like.
Decoupling ::env from the system environment after initialization
would also solve a number of thread-safety problems.
What do you mean by "Decoupling"?
Controlling (and not "monitoring") the process environment is one of the
basic methods of the "interprocess communication", its one way to
forward informations to subprocesses and change information on current
process level.
The "current process level" arguments is discussed controversly, I don't
know a standard for that as the $env mechanims has been created very
long before threads hav been introduced.
In my specific situation I have to create more that 100 environment
variables which are required by the subprocess (configuration options).
One specific reason for using Tcl is, that some unix tools (awk, sed,
....) fail by working too long variable values and I think this may also
be a problem under windows in some situations (eg. very a log PATH
variable?).
Tcl has no problem with very long lists, variable contents ... an also
allows platform indepenent path handling.
Thus it is the perfect platform independent "configuration machine" in
this situation and allows very convenient and efficient "environment
handling" for subprocesses.
But it must be ensured, that the internal state of ::env variable
reflect the platform specific environment of the subprocess.
One more reason to work on ::env is the fact, that windows treats
environment variables case-insensitive, unix does not:
Unix:
% set env(a) 1
1
% set env(A) 2
2
% puts "$env(a) $env(A)"
1 2
Windows:
% set env(a) 1
1
% set env(A) 2
2
% puts "$env(a) $env(A)"
2 2
parray only lists env(a) (the 1st one).
--
Gerhard Reithofer
Tech-EDV Support Forum - http://support.tech-edv.co.at
.
- Follow-Ups:
- Re: Windows env-Bug?
- From: Alexandre Ferrieux
- Re: Windows env-Bug?
- References:
- Windows env-Bug?
- From: Gerhard Reithofer
- Re: Windows env-Bug?
- From: David Gravereaux
- Re: Windows env-Bug?
- From: Donal K. Fellows
- Re: Windows env-Bug?
- From: David Gravereaux
- Re: Windows env-Bug?
- From: Joe English
- Windows env-Bug?
- Prev by Date: Strange tcl_platform names.
- Next by Date: Re: Strange tcl_platform names.
- Previous by thread: Re: Windows env-Bug?
- Next by thread: Re: Windows env-Bug?
- Index(es):
Relevant Pages
|