incompatible environment variable names

Eric Blake
Wed Aug 4 19:09:00 GMT 2010

On 08/04/2010 12:59 PM, Nellis, Kenneth wrote:
>> From: Steven Collins
>> On Wed, Aug 4, 2010 at 10:23, Nellis, Kenneth wrote:
>>> I came across an interesting (IMHO) incompatibility between
>>> Windows and bash environment variable names.

Not just windows, but any system with environment variables.

Anyone can call execve and set arbitrary strings in the environment that
do not correspond to valid environment variables in the shell.  Bash can
inherit such invalid names, at which point, POSIX says that bash may,
but not must, preserve those invalid names to pass on to children, even
though they cannot be accessed from within the shell itself.

> Well, *somehow* it got into the Cygwin environment, and cygwin.bat directly
> invokes bash, so I interpret this as bash creating the Cygwin environment.
> Where is the hole in this logic?

Bash does not create the cygwin environment.  Rather, it inherits the
environment from the parent process.

Eric Blake    +1-801-349-2682
Libvirt virtualization library

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Cygwin mailing list