zsh-workers
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: Cygwin: environ problem
Date: Fri, 21 Jul 2000 15:56:45 +0400	[thread overview]
Message-ID: <000101bff30a$be2cc1d0$21c9ca95@mow.siemens.ru> (raw)

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 >>


             reply	other threads:[~2000-07-21 11:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-21 11:56 Andrej Borsenkow [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000101bff30a$be2cc1d0$21c9ca95@mow.siemens.ru' \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).