[Bug 10231] /bin/sh not handling some environment variable

bugzilla at busybox.net bugzilla at busybox.net
Fri Aug 25 10:08:55 UTC 2017


--- Comment #5 from Ron Yorston <rmy at pobox.com> ---
It appears that even the original Bourne shell works the same way as ash in
BusyBox:  environment variables are sanitised when imported into the shell and
child processes get an environment initialised from the shell variables.

I have encountered your requirement before, though.  I maintain the busybox-w32
port of BusyBox to Microsoft Windows.  Environment variables in Windows have
their own foibles:  they're case-insensitive and some have names that aren't
allowed in the shell though are acceptable to cmd.exe.

See, for example, this issue:


where a user wanted to access an environment variable named PROGRAMFILES(X86). 
They also wanted it to be passed to child processes, because Windows binaries
expect to find such variables and might break if they can't.

My solution was to import the variable with a name (PROGRAMFILES_X86_) that
could be used in the shell while retaining the invalid name so that it would be
passed to child processes.  This last part was broken by the commit mentioned
above, though nobody has noticed until now.

I'll need to revisit my fix in busybox-w32.  However, I'm not sure that
something similar would be appropriate in the Unix version of BusyBox.  The
long history of the existing behaviour has trained Unix users not to put
characters in their environment variable names that aren't acceptable to the

You are receiving this mail because:
You are on the CC list for the bug.

More information about the busybox-cvs mailing list