Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#6706 closed bug (fixed)

unsetenv("a") does not remove all settings of the environment variable "a"

Reported by: scottmc Owned by: nobody
Priority: normal Milestone: R1
Component: - General Version: R1/alpha2
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

gnulib test suite fails test-unsetenv.c:

unsetenv("a") does not remove all settings of the environment variable "a" from the environment.

Attachments (1)

test-unsetenv.c (2.0 KB ) - added by scottmc 14 years ago.

Download all attachments as: .zip

Change History (4)

by scottmc, 14 years ago

Attachment: test-unsetenv.c added

comment:1 by phoudoin, 14 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev38904.

comment:2 by phoudoin, 14 years ago

Seems that our putenv() implementation is not POSIX compliant :

http://www.opengroup.org/onlinepubs/009695399/functions/putenv.html

"the string pointed to by string shall become part of the environment, so altering the string shall change the environment. "

We don't support that, as we always copy the string in src/system/libroot/posix/stdlib/env.cpp:update_variable().

comment:3 by axeld, 14 years ago

Our env variable implementation is indeed not POSIX compatible, but that was actually by intention; the POSIX interface is just horrible (especially for things that use threading), and there were several apps that did not use it correctly in the first place. So unless you need to fix an actual problem (that causes application misbehaviour), I would leave the implementation as is.

Note: See TracTickets for help on using tickets.