From owner-freebsd-current@FreeBSD.ORG Sat Jul 14 17:03:31 2007 Return-Path: X-Original-To: freebsd-current@FreeBSD.ORG Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BC44616A403; Sat, 14 Jul 2007 17:03:31 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 1D0A413C4A3; Sat, 14 Jul 2007 17:03:30 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.1/8.14.1) with ESMTP id l6EH3TOD037479; Sat, 14 Jul 2007 21:03:29 +0400 (MSD) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nagual.pp.ru; s=default; t=1184432609; bh=T6BxPsSE8Vh6yIWrACRXJtlr5/0eJJZruYuR2jT HvD0=; l=1028; h=Received:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:User-Agent; b=TbjiBmKgCjqVpHn+q2ZN 86g5px1/osrBCl/sU5b3JjRLuRXxBL8KMj6/ww+toAM3+kKajuVB/xkggxy+wHvp83F iRKUJ0Vtn3w8IeiXerKg0qnNTPoMlgVVMjdVslUe3j4YjEnQtScqfZbCmiiCBG6EobH n822QEELILxRwAsBY= Received: (from ache@localhost) by nagual.pp.ru (8.14.1/8.14.1/Submit) id l6EH3TII037478; Sat, 14 Jul 2007 21:03:29 +0400 (MSD) (envelope-from ache) Date: Sat, 14 Jul 2007 21:03:28 +0400 From: Andrey Chernov To: "Sean C. Farley" Message-ID: <20070714170328.GA37383@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , "Sean C. Farley" , freebsd-current References: <20070713202433.GA19856@nagual.pp.ru> <20070713203915.GA20270@nagual.pp.ru> <20070713171942.Q26096@thor.farley.org> <20070713224608.GB21695@nagual.pp.ru> <20070713184543.A26096@thor.farley.org> <20070714004116.GA22909@nagual.pp.ru> <20070713200048.X26971@thor.farley.org> <20070714014319.GA24701@nagual.pp.ru> <20070714022638.GA25256@nagual.pp.ru> <20070714080553.I27236@thor.farley.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070714080553.I27236@thor.farley.org> User-Agent: Mutt/1.5.16 (2007-06-09) Cc: freebsd-current Subject: Re: Environment handling broken in /bin/sh with changes to t,set,put}env() X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jul 2007 17:03:31 -0000 On Sat, Jul 14, 2007 at 10:25:03AM -0500, Sean C. Farley wrote: > No. I see it too. Here are the changes: > 1. __merge_environ no longer touches environ. Only __rebuild_environ(), > __build_env() and __clean_env() alter environ. > 2. watchEnviron renamed to intEnviron. > 3. __rebuild_environ() uses intEnviron when cycling through the > environment; it only sets environ. > > This way environ is not changed unless it has at least one name-value > pair. > > The new patch is here: > http://www.farley.org/freebsd/tmp/setenv/clearenv/patch2 Ok. BTW, I see no needs to duplicate code here: rtrnVal = __rebuild_environ(envVarsTotal); if (rtrnVal == -1) { savedErrno = errno; __clean_env(true); errno = savedErrno; } return (rtrnVal); Failure: savedErrno = errno; __clean_env(true); errno = savedErrno; return (-1); instead of simple: rtrnVal = __rebuild_environ(envVarsTotal); if (rtrnVal == -1) goto Failure; like before in this function. -- http://ache.pp.ru/