Environment handling broken in /bin/sh with changes to {get,set,put}env()

Michal Mertl mime at traveller.cz
Wed Jul 4 13:53:46 UTC 2007


I have just recompiled world to find out that /bin/sh is emitting
strange warnings after the recent changes to {get,set,put}env() and sh

When the shell starts and locale variables (e.g. LANG) are set in the
environment, the warning "sh: environment corrupt; missing value for
LANG" gets printed out on the stderr.

I have tracked it down to the changes in {get,set,put}env and
src/bin/sh/var.c 1.36. I have checked (by inserting printf just before
the call) that the arguments passed to putenv() in var.c are reasonable,
yet the above mentioned warning is issued.

The shell seems to work correctly ('ls -l' shows correct date format in
different locales) even when the blocks of code with localevars() (BTW
the most cryptic function I've seen in some time) are completely
ifdef'ed out.


More information about the freebsd-current mailing list