Home | History | Annotate | Download | only in stdlib
History log of /src/lib/libc/stdlib/_env.c
RevisionDateAuthorComments
 1.15  02-Jan-2024  christos pass lint.
 1.14  18-Jul-2023  riastradh libc: Use RB_TREE_INITIALIZER to nix initfini.c/_env.c coupling.

Doesn't actually help to remove _env.c from programs that don't use
it, though, because various internal things like __diagassert13 still
call getenv.
 1.13  12-Mar-2022  christos reallocarr returns errno. preserve it.
 1.12  12-Mar-2022  nia _env: use reallocarr
 1.11  20-Apr-2021  christos Instead of compiling files with -fcommon, create an include file and declare
the 3 symbols that need to be common using an attribute. Put all the 3 symbol
definitions in libc in one place (initfini.c). Reviewed by joerg@
 1.10  22-Feb-2020  kamil Avoid NULL pointer arithmetics on environ

_env.c:260:9, pointer expression with base 0 overflowed to 0
_env.c:260:9, load of null pointer of type 'char *'
 1.9  20-Jan-2015  christos branches: 1.9.16;
Fix non _REENTRANT build.
 1.8  09-Sep-2013  tron Don't scrub the environment unless we are going to change it. This should
prevent crashes in applications which carefully and manually construct
a temporary environment and later restore the original environment
like Emacs 24.

Problem reported by Thomas Klausner on "pkgsrc-users" mailing list.
 1.7  19-Aug-2013  matt Put the startup code in .text.startup
 1.6  06-Oct-2011  christos branches: 1.6.2; 1.6.4; 1.6.8; 1.6.10; 1.6.16;
Provide symbol definitions for environ and __progname. These are duplicate
definitions to the ones provided by csu, but harmless since the linker resolves
them. There are 3 non weak data symbols provided in crt0.o:

D __progname [initialized data, assigned to ""]
B __ps_strings [BSS since assigned to 0]
C environ [common, uninitialized]

__ps_strings had already a second definition in libc (in BSS), now we added
__progname and __ps_strings (in BSS).

To get rid of the duplicate definition, we can remove them from csu, and
move the assignments to libc.

This is done so that libc has no undefined symbols so that linker maps
that want to do:
...
local:
*;
...
don't end up producing link failures for libc.
 1.5  17-Nov-2010  tron Include "namespace.h" to get namespace protection.
 1.4  16-Nov-2010  tron Implement mark & sweep garbage collection as suggested by Enami Tsugutomo
on "current-users" mailing list. Garbage collection is performed if:
1.) We previously allocated memory for the environment array which
is no longer used because the application overwrote "environ".
2.) We find a non-NULL pointer in the allocated environment array after
the end of the environment. This happens if the applications attempts
to clear the environment with something like "environ[0] = NULL;".
 1.3  16-Nov-2010  enami Fix typos in comment.
 1.2  14-Nov-2010  tron 1.) Rename internal function __findvar() to __findenvvar().
2.) Add a wrapper function __findenv() which implements the previous
*internal* interface. It turns out that ld.elf_so(1) and pthread(3)
both use it.

Stripping e.g. "LD_LIBRARY_PATH" from the environment while running
setuid binaries works again now.
 1.1  14-Nov-2010  tron Improve and simplify implementation of *env(3) functions:
- Use RB tree to keep track of memory allocated via setenv(3) as
suggested by Enami Tsugutomo in private e-mail.
This simplifies the code a lot as we no longer need to keep the size
of "environ" in sync with an array of allocated environment variables.
It also makes it possible to free environment variables in unsetenv(3)
if something has changed the order of the "environ" array.
- Fix a bug in getenv(3) and getenv_r(3) which would return bogus
results e.g. for " getenv("A=B") " if an environment variable "A"
with value "B=C" exists.
- Clean up the internal functions:
- Don't expose the read/write lock for the environment to other parts
of "libc". Provide locking functions instead.
- Use "bool" to report success or failure.
- Use "ssize_t" or "size_t" instead of "int" for indexes.
- Provide internal functions with simpler interfaces e.g. don't
combine return values and reference arguments.
- Don't copy "environ" into an allocated block unless we really need
to grow it.

Code reviewed by Joerg Sonnenberger and Christos Zoulas, tested by
Joerg Sonnenberger and me. These changes also fix problems in
zsh 4.3.* and pam_ssh according to Joerg.
 1.6.16.1  14-Sep-2013  bouyer Pull up following revision(s) (requested by tron in ticket #940):
lib/libc/stdlib/_env.c: revision 1.8
Don't scrub the environment unless we are going to change it. This should
prevent crashes in applications which carefully and manually construct
a temporary environment and later restore the original environment
like Emacs 24.
Problem reported by Thomas Klausner on "pkgsrc-users" mailing list.
 1.6.10.1  14-Sep-2013  bouyer Pull up following revision(s) (requested by tron in ticket #940):
lib/libc/stdlib/_env.c: revision 1.8
Don't scrub the environment unless we are going to change it. This should
prevent crashes in applications which carefully and manually construct
a temporary environment and later restore the original environment
like Emacs 24.
Problem reported by Thomas Klausner on "pkgsrc-users" mailing list.
 1.6.8.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.4.1  14-Sep-2013  bouyer Pull up following revision(s) (requested by tron in ticket #940):
lib/libc/stdlib/_env.c: revision 1.8
Don't scrub the environment unless we are going to change it. This should
prevent crashes in applications which carefully and manually construct
a temporary environment and later restore the original environment
like Emacs 24.
Problem reported by Thomas Klausner on "pkgsrc-users" mailing list.
 1.6.2.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.16.1  08-Apr-2020  martin Merge changes from current as of 20200406

RSS XML Feed