zsh-workers
 help / color / mirror / code / Atom feed
* Cygwin: environ problem
@ 2000-07-21 11:56 Andrej Borsenkow
  2000-07-21 13:11 ` Peter Stephenson
  0 siblings, 1 reply; 11+ messages in thread
From: Andrej Borsenkow @ 2000-07-21 11:56 UTC (permalink / raw)
  To: ZSH workers mailing list

Tests for dynamic loading choke almost immediately. The reason is static
libc and environ variable. It is contained in libc.a that is statically
linked so every DLL gets it's own copy.

BUT it looks, that exactly in case of Cygwin this test does not matter.
If I understand correctly, what happens:

- every DLL has control block, that contains pointer to "environ" for
this DLL; this is of type 'char ***' intialised to point to "extern char
**environ", that is a local varible: "user_data->envp = &environ".

- main program has __cygwin_environ that points to actual "true"
environment

- every time environment changes (via setenv()/putnev()) and, of course,
when loading DLL,  cygwin updates local environ to point to
__cygwin_environ, like "*(user_data->envp) = __cygwin_environ"

In other words, every copy of environ is forced to point to the same
location, even if addresses of variables itself are different.

This implies that direct manipulation of environ is not possible (or,
better said, make no sense). Zsh does exactly this - it directly assigns
pointer to new environment block in createparamtable(). This needs to be
fixed for Cygwin.

It just occured to me, that it may be one reason for these misterious
cores on Cygwin.

It looks, like libc.a is actually nothing more than stub library for
cygwin.dll. That is, we can ignore the above test on Cygwin.

We _could_try_ to directly manipulate __cygwin_environ, but I do not
like it - who knows, where and how it is used. BTW comments imply, that
DLLs should actually refer to __cygwin_environ :-)

-andrej

Have a nice DOS!
B >>


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2000-08-21  1:26 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-21 11:56 Cygwin: environ problem Andrej Borsenkow
2000-07-21 13:11 ` Peter Stephenson
2000-07-21 13:39   ` Andrej Borsenkow
2000-07-24  8:14   ` Andrej Borsenkow
2000-07-24 10:39     ` Environ handling broken on Cygwin " Andrej Borsenkow
2000-07-24 10:57       ` Peter Stephenson
2000-07-25 10:49         ` Andrej Borsenkow
2000-08-16 13:28         ` Sourceforge development account Andrej Borsenkow
2000-08-16 13:35           ` Thomas Köhler
2000-08-16 13:41           ` Peter Stephenson
2000-08-21  1:25           ` Chmouel Boudjnah

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).