From: Andrey Borzenkov <arvidjaar@newmail.ru>
To: zsh-workers@sunsite.dk
Cc: "Sean C. Farley" <scf@freebsd.org>
Subject: Re: putenv()/environ bug
Date: Sat, 28 Jul 2007 22:46:15 +0400 [thread overview]
Message-ID: <200707282246.16663.arvidjaar@newmail.ru> (raw)
In-Reply-To: <20070725184302.S23862@thor.farley.org>
[-- Attachment #1: Type: text/plain, Size: 2261 bytes --]
On Thursday 26 July 2007, Sean C. Farley wrote:
> On Wed, 25 Jul 2007, Peter Stephenson wrote:
> > On Wed, 25 Jul 2007 10:09:22 -0500 (CDT)
> >
> > "Sean C. Farley" <scf@FreeBSD.org> wrote:
> >> As noticed here following a change in FreeBSD's *env() functions, zsh
> >> is mixing *env() (putenv() in this case) functions with direct access
> >> to the environ variable's contents against the IEEE Std 1003.1
> >> specification.
> >>
> >> BTW, is there a particular reason the standard *env() functions
> >> cannot be used for all operations to environ if found?
> >
The code in question is quite old and I believe it predates (un-)setenv. And
you simply did not have any way to *unset* environment string in some
systems; I think (un-)setenv is BSD extension.
> > There's a long history of fiddling with these for problems on various
> > systems, so I'm a little unwilling to change it without some guidance.
> >
> > For example,
> >
> > /*
> > * Under Cygwin we must use putenv() to maintain consistency.
> > * Unfortunately, current version (1.1.2) copies argument and may
> > * silently reuse existing environment string. This tries to
> > * check for both cases
> > */
>
> I understand.
>
> > This is a little confusing since the code in question (addenv in
> > params.c) doesn't actually use putenv().
>
> Legacy comments are only meant to throw developers off the track. :)
>
Huh? addenv() is using zputenv() that is using putenv() where avaialable. Now
it may be legacy in the sense Cygwin implemenation has changed; but
unfortunately I use Cygwin no more nor have environment to check it.
> > Given we manipulate environ quite a lot anyway, is there any harm in
> > using only the zsh versions of zgetenv() and zputenv()? There's a
> > getenv() instead of a zgetenv() in init.c: I think that was just a
> > typo by me.
>
> *code snipped*
>
> Unfortunately, this does not fix the problem. unsets are only affecting
> the zsh environment but not environ.
What about - check if (un-)setenv is available and use them. On legacy systems
use existing implementation. This probably will mean we will be using native
utilities everywhere on modern systems.
-andrey
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2007-07-28 18:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-25 15:09 Sean C. Farley
2007-07-25 20:53 ` Peter Stephenson
2007-07-26 0:14 ` Sean C. Farley
2007-07-28 18:46 ` Andrey Borzenkov [this message]
2007-07-29 19:08 ` Sean C. Farley
2007-07-30 20:39 ` Peter Stephenson
2007-07-30 20:52 ` Peter Stephenson
2007-07-30 22:44 ` Sean C. Farley
2007-07-31 9:00 ` Peter Stephenson
2007-07-31 18:09 ` Sean C. Farley
2007-07-30 22:39 ` Sean C. Farley
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=200707282246.16663.arvidjaar@newmail.ru \
--to=arvidjaar@newmail.ru \
--cc=scf@freebsd.org \
--cc=zsh-workers@sunsite.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).