Re: Environment handling broken in /bin/sh with changes to t,set,put}env()

From: Sean C. Farley <scf_at_FreeBSD.org>
Date: Fri, 13 Jul 2007 17:27:58 -0500 (CDT)
On Sat, 14 Jul 2007, Andrey Chernov wrote:

> On Sat, Jul 14, 2007 at 12:24:33AM +0400, Andrey Chernov wrote:
>> 1) I care in first hand about unsetenv() as my example states. There
>> nowhere said in the specs that unsetenv() may modify environ _content_,
>> manpage says about pointers only.
>
> Moreover, they directly states (at least for some cases) that environment
> should be left completely untouched, like that:
>
> "If the named variable does not exist in the current environment, the
> environment shall be unchanged and the function is considered to have
> completed successfully."

*snipped part about setenv()*

I agree that setenv() and unsetenv() follow the same requirement.

Does that mean that environ is untouched or that the environment is
unchanged?  They seem to use both words (environ and environment) in the
documentation making me think they are not necessarily the same thing.
Currently, non-getenv() calls rebuilds the environ array if having never
been changed before, but the "environment" is "unchanged" if the
variable does not exist.  Should that not meet that requirement?

Sean
-- 
scf_at_FreeBSD.org
Received on Fri Jul 13 2007 - 20:28:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:14 UTC