From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20547 invoked from network); 25 Jul 2007 20:54:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 25 Jul 2007 20:54:56 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 33800 invoked from network); 25 Jul 2007 20:54:50 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Jul 2007 20:54:50 -0000 Received: (qmail 1226 invoked by alias); 25 Jul 2007 20:54:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23703 Received: (qmail 1216 invoked from network); 25 Jul 2007 20:54:47 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 25 Jul 2007 20:54:47 -0000 Received: (qmail 33552 invoked from network); 25 Jul 2007 20:54:47 -0000 Received: from mtaout03-winn.ispmail.ntl.com (81.103.221.49) by a.mx.sunsite.dk with SMTP; 25 Jul 2007 20:54:44 -0000 Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com with ESMTP id <20070725205442.NYPH13.mtaout03-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com>; Wed, 25 Jul 2007 21:54:42 +0100 Received: from pws-pc.ntlworld.com ([81.107.45.67]) by aamtaout01-winn.ispmail.ntl.com with SMTP id <20070725205442.VWDL219.aamtaout01-winn.ispmail.ntl.com@pws-pc.ntlworld.com>; Wed, 25 Jul 2007 21:54:42 +0100 Date: Wed, 25 Jul 2007 21:53:21 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Cc: "Sean C. Farley" Subject: Re: putenv()/environ bug Message-Id: <20070725215321.00e3b110.p.w.stephenson@ntlworld.com> In-Reply-To: <20070725093254.T20275@thor.farley.org> References: <20070725093254.T20275@thor.farley.org> X-Mailer: Sylpheed 2.3.1 (GTK+ 2.10.13; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 25 Jul 2007 10:09:22 -0500 (CDT) "Sean C. Farley" wrote: > As noticed here[1] following a change[2] 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? 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 */ This is a little confusing since the code in question (addenv in params.c) doesn't actually use putenv(). 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. Index: Src/init.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/init.c,v retrieving revision 1.76 diff -u -r1.76 init.c --- Src/init.c 6 Jul 2007 21:52:39 -0000 1.76 +++ Src/init.c 25 Jul 2007 20:53:06 -0000 @@ -832,7 +832,7 @@ if (emulation == EMULATE_ZSH) ptr = home; else - ptr = getenv("HOME"); + ptr = zgetenv("HOME"); if (ptr && ispwd(ptr)) pwd = ztrdup(ptr); else if ((ptr = zgetenv("PWD")) && (strlen(ptr) < PATH_MAX) && -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/