<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src-test2/lib/libc/stdlib/getenv.c, branch release/7.3.0_cvs</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src-test2/atom?h=release%2F7.3.0_cvs</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src-test2/atom?h=release%2F7.3.0_cvs'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/'/>
<updated>2010-03-21T01:30:13Z</updated>
<entry>
<title>Copy releng/7.3 to release/7.3.0 to mark 7.3-RELEASE.</title>
<updated>2010-03-21T01:30:13Z</updated>
<author>
<name>Ken Smith</name>
<email>kensmith@FreeBSD.org</email>
</author>
<published>2010-03-21T01:30:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=9c4d1c1956ecb0a222fb2f4579c320391fb67f06'/>
<id>urn:sha1:9c4d1c1956ecb0a222fb2f4579c320391fb67f06</id>
<content type='text'>
Approved by:	re (implicit)

This commit was manufactured to restore the state of the 7.3-RELEASE image.
</content>
</entry>
<entry>
<title>MFC:  r181150, r181266</title>
<updated>2008-08-08T00:49:28Z</updated>
<author>
<name>Sean Farley</name>
<email>scf@FreeBSD.org</email>
</author>
<published>2008-08-08T00:49:28Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=a18bcf9339f93eebff55e2caa53f70a3800009f3'/>
<id>urn:sha1:a18bcf9339f93eebff55e2caa53f70a3800009f3</id>
<content type='text'>
Detect if the application has cleared the environ variable by setting
the first value (environ[0]) to NULL.  This is in addition to the
current detection of environ being replaced, which includes being set to
NULL.  Without this fix, the environment is not truly wiped, but appears
to be by getenv() until an *env() call is made to alter the enviroment.

This change is necessary to support those applications that use this
method for clearing environ such as Dovecot and Postfix.  Applications
such as Sendmail and the base system's env replace environ (already
detected).  While neither of these methods are defined by SUSv3, it is
best to support them due to historic reasons and in lieu of a clean,
defined method.

Add extra units tests for clearing environ using four different methods:
1. Set environ to NULL pointer.
2. Set environ[0] to NULL pointer.
3. Set environ to calloc()'d NULL-terminated array.
4. Set environ to static NULL-terminated array.

Noticed by:	Timo Sirainen
Reviewed by:	ache
</content>
</entry>
<entry>
<title>MFC:</title>
<updated>2008-03-06T15:14:36Z</updated>
<author>
<name>Sean Farley</name>
<email>scf@FreeBSD.org</email>
</author>
<published>2008-03-06T15:14:36Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=31aeeda2af88f98fcf58fafcbe0a50e07db415e9'/>
<id>urn:sha1:31aeeda2af88f98fcf58fafcbe0a50e07db415e9</id>
<content type='text'>
Replace the use of warnx() with direct output to stderr using _write().
This reduces the size of a statically-linked binary by approximately 100KB
in a trivial "return (0)" test application.  readelf -S was used to verify
that the .text section was reduced and that using strlen() saved a few
more bytes over using sizeof().  Since the section of code is only called
when environ is corrupt (program bug), I went with fewer bytes over fewer
cycles.

I made minor edits to the submitted patch to make the output resemble
warnx().

    src/lib/libc/stdlib/getenv.c: rev 1.12 -&gt; 1.13

Submitted by:	kib bz
Approved by:	wes (mentor)
</content>
</entry>
<entry>
<title>The precision for a string argument in a call to warnx() needs to be cast</title>
<updated>2007-09-22T02:30:44Z</updated>
<author>
<name>Sean Farley</name>
<email>scf@FreeBSD.org</email>
</author>
<published>2007-09-22T02:30:44Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=8e5b20fa9c48e70a31578d3272401b3e94b7f53d'/>
<id>urn:sha1:8e5b20fa9c48e70a31578d3272401b3e94b7f53d</id>
<content type='text'>
to an int to remove the warning from using a size_t variable on 64-bit
platforms.

Submitted by:	Xin LI &lt;delphij@FreeBSD.org&gt;
Approved by:	wes
Approved by:	re (kensmith)
</content>
</entry>
<entry>
<title>Skip rebuilding environ in setenv() only upon reuse of an active variable;</title>
<updated>2007-09-15T21:48:54Z</updated>
<author>
<name>Sean Farley</name>
<email>scf@FreeBSD.org</email>
</author>
<published>2007-09-15T21:48:54Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=21c376969a92384b3d4bd7638283474a66c9a737'/>
<id>urn:sha1:21c376969a92384b3d4bd7638283474a66c9a737</id>
<content type='text'>
inactive variables should cause a rebuild of environ, otherwise, exec()'d
processes will be missing a variable in environ that has been unset then
set.

Submitted by:	Taku Yamamoto &lt;taku@tackymt.homeip.net&gt;
Reviewed by:	ache
Approved by:	wes (mentor)
Approved by:	re (kensmith)
</content>
</entry>
<entry>
<title>Added environ-replacement detection.  For programs that "clean" (i.e., su)</title>
<updated>2007-07-20T23:30:13Z</updated>
<author>
<name>Sean Farley</name>
<email>scf@FreeBSD.org</email>
</author>
<published>2007-07-20T23:30:13Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=9bab236702b4f33a990011b08a2deebbb8ea6e0c'/>
<id>urn:sha1:9bab236702b4f33a990011b08a2deebbb8ea6e0c</id>
<content type='text'>
or replace (i.e., zdump) the environment after a call to setenv(), putenv()
or unsetenv() has been made, a few changes were made.
  - getenv() will return the value from the new environ array.
  - setenv() was split into two functions:  __setenv() which is most of the
    previous setenv() without checks on the name and setenv() which
    contains the checks before calling __setenv().
  - setenv(), putenv() and unsetenv() will unset all previous values and
    call __setenv() on all entries in the new environ array which in turn
    adds them to the end of the envVars array.  Calling __setenv() instead
    of setenv() is done to avoid the temporary replacement of the '=' in a
    string with a NUL byte.  Some strings may be read-only data.

Added more regression checks for clearing the environment array.

Replaced gettimeofday() with getrusage() in timing regression check for
better accuracy.

Fixed an off-by-one bug in __remove_putenv() in the use of memmove().  This
went unnoticed due to the allocation of double the number of environ
entries when building envVars.

Fixed a few spelling mistakes in the comments.

Reviewed by:	ache
Approved by:	wes
Approved by:	re (kensmith)
</content>
</entry>
<entry>
<title>Significantly reduce the memory leak as noted in BUGS section for</title>
<updated>2007-07-04T00:00:41Z</updated>
<author>
<name>Sean Farley</name>
<email>scf@FreeBSD.org</email>
</author>
<published>2007-07-04T00:00:41Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=2966d28c322dcfa4b9db2558da0b91839e7798b9'/>
<id>urn:sha1:2966d28c322dcfa4b9db2558da0b91839e7798b9</id>
<content type='text'>
setenv(3) by tracking the size of the memory allocated instead of using
strlen() on the current value.

Convert all calls to POSIX from historic BSD API:
 - unsetenv returns an int.
 - putenv takes a char * instead of const char *.
 - putenv no longer makes a copy of the input string.
 - errno is set appropriately for POSIX.  Exceptions involve bad environ
   variable and internal initialization code.  These both set errno to
   EFAULT.

Several patches to base utilities to handle the POSIX changes from
Andrey Chernov's previous commit.  A few I re-wrote to use setenv()
instead of putenv().

New regression module for tools/regression/environ to test these
functions.  It also can be used to test the performance.

Bump __FreeBSD_version to 700050 due to API change.

PR:		kern/99826
Approved by:	wes
Approved by:	re (kensmith)
</content>
</entry>
<entry>
<title>Back out all POSIXified *env() changes.</title>
<updated>2007-05-01T16:02:44Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2007-05-01T16:02:44Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=ba174a5e38b1ab764c4a36ef4dd83e80c4add148'/>
<id>urn:sha1:ba174a5e38b1ab764c4a36ef4dd83e80c4add148</id>
<content type='text'>
Not because I admit they are technically wrong and not because of bug
reports (I receive nothing). But because I surprisingly meets so
strong opposition and resistance so lost any desire to continue that.

Anyone who interested in POSIX can dig out what changes and how
through cvs diffs.
</content>
</entry>
<entry>
<title>Make putenv() fully conforms to Open Group specs Issue 6</title>
<updated>2007-04-30T16:56:18Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2007-04-30T16:56:18Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=15fdb055e5a9a944685cf8bcf94e5858589a6740'/>
<id>urn:sha1:15fdb055e5a9a944685cf8bcf94e5858589a6740</id>
<content type='text'>
(also IEEE Std 1003.1-2001)

The specs explicitly says that altering passed string
should change the environment, i.e. putenv() directly puts its arg
into environment (unlike setenv() which just copies it there).
It means that putenv() can't be implemented via setenv()
(like we have before) at all. Putenv() value lives (allows modifying)
up to the next putenv() or setenv() call.
</content>
</entry>
<entry>
<title>Make setenv, putenv, getenv and unsetenv conforming to Open Group specs</title>
<updated>2007-04-30T02:25:02Z</updated>
<author>
<name>Andrey A. Chernov</name>
<email>ache@FreeBSD.org</email>
</author>
<published>2007-04-30T02:25:02Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=bdda89347122e9814a3a681adfc4d950fa914066'/>
<id>urn:sha1:bdda89347122e9814a3a681adfc4d950fa914066</id>
<content type='text'>
Issue 6 (also IEEE Std 1003.1-2001) in following areas:
args, return, errors.

Putenv still needs rewriting because specs explicitly says that
altering passed string later should change the environment (currently we
copy the string so can't provide that).
</content>
</entry>
</feed>
