X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; q=dns; s=
	default; b=hgxtt356+MxkEWgp2cXS6vGYf9zdGS466JJ4jFaQs3FXiN1t2jzW4
	tdSIqke11oTgJpy7kly3x2L9StBnGvqpucbEop8Hn1BLCwYg8yQgzEcQzuOyRX2e
	cXdMpNgVTDyoDiYeaW66qWTSA4CWiwYKaZ0k0FPjQJ/b35oaq5+srg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; s=default;
	 bh=WT7v8t4jjCx8l3WM6cAdo9CodJ0=; b=OW7zJ0ZUPKRqEll7QkohwnULBtgC
	x4Kimj9JyW1ZYYPblKw8+fM3rUxur9Jls7yCPA7MRruU5GsE/YRZMIgxFCvrC7z2
	TIPa1HQaknjzS/hgQT9Kc5ybFuh1/FcSMLp/O2oSzBWlAFspHaypAix5Li7tGDM9
	4j45pAv1D7LqUUk=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Fri, 14 Feb 2014 17:38:37 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Interesting footnote about environment variables block
Message-ID: <20140214163837.GH2246@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <1052349406.20140214115021@mtu-net.ru> <52FDE698.3010707@lysator.liu.se> <28dada277ca348b5b5833b45d18e030a@BL2PR03MB145.namprd03.prod.outlook.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;	protocol="application/pgp-signature"; boundary="BNd1cQq+8a6XQVk/"
Content-Disposition: inline
In-Reply-To: <28dada277ca348b5b5833b45d18e030a@BL2PR03MB145.namprd03.prod.outlook.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

--BNd1cQq+8a6XQVk/
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Feb 14 16:22, Stephan Mueller wrote:
> Andrey Repin wrote:
>=20
> > http://www.microsoft.com/resources/documentation/windows/xp/all/proddoc=
s/en-us/ntcmds_shelloverview.mspx?pf=3Dtrue
> >=20
> >> The maximum total environment variable size for all variables, which
> >> includes variable names and the equal sign, is 65,536KB.
>=20
> The actual limit, on old OSes (such as Windows XP) is 64KB or 65536 bytes=
.  This text appears to contain a typo; likely someone decided to change fr=
om one representation to the other, and forgot to change the units when the=
y changed the number.  Newer OSes have lifted the 64KB limitation; I forget=
 exactly when.=20
>=20
> > http://msdn.microsoft.com/en-us/library/windows/desktop/ms682653(v=3Dvs=
.85).aspx
> > (And consequently,
> > http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=3Dvs=
.85).aspx
> > )
>=20
> These docs are the documentation for the CreateProcess API.  I'm guessing=
 the relevant text here is:
>=20
> 	The ANSI version of this function, CreateProcessA fails if the total siz=
e of the environment block for the process exceeds 32,767 characters.
>=20
> The limit described here is independent of the one in the XP documentatio=
n.  The typical behaviour of a large number of Windows FooA APIs is to wide=
n their argument strings from ANSI to UTF-16, and then call the FooW API to=
 do the actual work.  The 32K limit here is likely related to the size of t=
he buffer used for the temporary wide copy of the argument.
>=20
> > I don't know, how it is applicable to Cygwin.
>=20
> Likewise.=20

Cygwin is using fooW functions, so we should be on the safe side.
Except that a big Windows environment tends to move the usual
start addresses of the stack from the usual 0x30000 to something
else.  This can unfortunately break fork if the Windows environment
is >64K and the Windows environment changed in the forking process.


Corinna


--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--BNd1cQq+8a6XQVk/
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJS/kaNAAoJEPU2Bp2uRE+gLJ8P/2CLJRhbZiSVHu6qYuzt4BfZ
89jcqTDCC2RyD5ieHouYykHk8+PJ/Dfq6x2pJdXUyvIghVHIFzpd0i95u71eVjKk
CA39QY3Gcq8nT0R+wS60ZLwHczJJUC0IvMk2ZhGzMhCNXxYAykffdFu9dFcoFz7h
gwjTBXSNGp2LWy2hZ4YJfF6Q7dUAHPsg7d70Yhtt5F1SEFAQwsamddzWmw2jwQNe
rin9o+ObCx7qUMXJpsZrz8vxQ3Q/wKZ+ZIO5N3/CeXFPIfwZBLLWJUhcX1B+6cWB
TY/oT5uZGzhrPN+lDEj3azkp6zn+5WjBspMFIwNrO9rqtuO1ir9JfDrmUlZebc+M
hKFgWX/F9/5dxjmTy2H/pX9G5ME/LtPpl4C6kUQVB+K3iSgaQ/KGH5/YvIpewN6s
cKUOZvg+/oRymKrv8acSWxbQAjo1NjEXjUfgjDIJSAQEoCAm0gdd6p4Oqb3izRXX
QlR50Wbmwx58L8N1ASvjkiDiK/6yzc3xNflP9FAaAD7nia+UVffyvgZLfQz6mJ26
7nlR1TpqpA16An/9Cb+mwcanf7SBGbs4L0hupty6fCzaYTcQmJAY431XXX6xefPD
KcDPNnqnH5W97kN9TzVYBwtwRUtqx+suDZUlzhacWAe4C2DHyXqnq7BaHXtDBjK4
Xpr+94UKH/uO9h9OAHdv
=vjpX
-----END PGP SIGNATURE-----

--BNd1cQq+8a6XQVk/--
