Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: putenv()/environ bug

On Mon, 30 Jul 2007, Peter Stephenson wrote:

On Sun, 29 Jul 2007 14:08:42 -0500 (CDT)
"Sean C. Farley" <scf@xxxxxxxxxxx> wrote:
On Sat, 28 Jul 2007, Andrey Borzenkov wrote:
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.

That would work for me.  If anyone would like me to test any patches,
I will.

This sounds the best, and it's working on Fedora 7.

I've tested if both setenv() and unsetenv() are available and if they
are we don't do any management of the environment ourselves, so the
hack in addenv() doesn't occur... I hope that works, otherwise the
implementation of the library is fairly well broken, the whole point
of setenv/unsetenv being to be able to do this in a standard fashion.

The only references to environ we make with this code are to read it
at the start to initialise internval variables and to pass it to
execs.  This seems to be sanctioned by POSIX.

As a TODO indicates, this means we don't actually need to store an
"env" string in the parameter structure, just a flag saying we've
stuck the value in the environment.  That can change when this stuff
is clearly working.

This change fixes the issue concerning the *env() functions in FreeBSD
7-CURRENT.  It works also with 6-STABLE.  Thank you.


P.S.  I am not subscribed; please keep me in the Cc.

Messages sorted by: Reverse Date, Date, Thread, Author