This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Cygwin/bash: need environment variables >32K


I have no long command line!
In my environment most Cygwin executables do not work,
if long environment variables are set (resp. exported).

Please have a look at my very short example below.
First I create an environment variable VAR with length 40K,
which is exported as well!
Afterwards the "ls" is not working!!!

File test.sh:
--------------------
LINE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
VAR=
for n in 1 2 3 4 ; do
    VAR=${VAR}";$LINE"
    VAR=${VAR}";$LINE"
    VAR=${VAR}";$LINE"
    VAR=${VAR}";$LINE"
    VAR=${VAR}";$LINE"
    VAR=${VAR}";$LINE"
    VAR=${VAR}";$LINE"
    VAR=${VAR}";$LINE"
    VAR=${VAR}";$LINE"
    VAR=${VAR}";$LINE"
done
export VAR

ls
-------------------

Within a DOS console I get following output
>bash test.sh
test.sh: line 17: /usr/bin/ls: Invalid argument

If the bash is started explicitly before, the "ls" does nothing (even no
error trace):
bash> ./test.sh

If I reduce the length of VAR to 20K (by doing only 2 iteration in the for
loop)
all is working fine!

Can anyone reproduce this behaviour?
It is really critical for the use of Cygwin in out project  ;-)

Thanks
Andre


-----Original Message-----
From: Buchbinder, Barry (NIH/NIAID) [mailto:BBuchbinder@niaid.nih.gov]
Sent: Mittwoch, 22. Oktober 2003 15:53
To: 'Klein Andre ICM N AS PD B 3'; 'cygwin@cygwin.com'
Subject: RE: Cygwin/bash: need environment variables >32K


It may be a command line problem.  I constructed, in a directory with a lot
of files, a 90k environmental variable by doing

$ T=`echo *`

Then

$ echo $T

and

$ echo $T | wc

showed that bash environmental variables can be that large and that the
command line can handle them.

$ cp $T target_dir

was unhappy ("Invalid argument"), so the problem seems to be with how long
of a command line cp can handle.  (Presumably "Invalid argument" results
from the way the arguments get truncated.)  one might suspect that rm, its
fileutils sibling, has the same limitation.

-----Original Message-----
From: Klein Andre ICM N AS PD B 3 [mailto:andre.klein@siemens.com] 
Sent: Wednesday, October 22, 2003 7:16 AM
To: 'cygwin@cygwin.com'
Subject: RE: Cygwin/bash: need environment variables >32K

Thanks for your answer!

I've tried to make the example more simple (s. attachments).
It sets a long environment variable and simply invokes the
cygwin rm executable afterwards...

I open a DOS box and invoke the example with
>bash run.sh

Following problems arise in my environment:
(a) environment variable with 30K 
	run.sh: line 9: /usr/bin/rm: Resource temporarily unavailable
(b) environment variable with 100K
	run.sh: line 9: /usr/bin/rm: Invalid argument
(c) environment variable with 20K
	rm works fine

So this clearly shows, that the length of my environment variable
affects the execution of the cygwin "rm" executable.

I hope you can reproduce this in your environment?!
Is there any way to avoid these problems?
Unfortunately we need such long variables...

Andre


-----Original Message-----
From: Corinna Vinschen [mailto:corinna-cygwin@cygwin.com]
Sent: Mittwoch, 22. Oktober 2003 12:01
To: 'cygwin@cygwin.com'
Subject: Re: Cygwin/bash: need environment variables >32K


On Wed, Oct 22, 2003 at 11:30:54AM +0200, Klein Andre ICM N AS PD B 3 wrote:
> I need to set a very long environment variable CLASSPATH within Cygwin
bash.
> But there seems to be an upper limit of 32K for environment variables!?!?
> 
> Is there any way to increase this upper limit?
> 
> I have attached 2 small files for demonstrating the problem.
> Start run.sh and the invocation of the executable (java) failes...

It's not the length of the environment variable which is the problem,
it's the way the application is called.  java is a native windows
application and on process creation, the windows command line can not
exceed 32K.  Does java not support the CLASSPATH environment variable?
Do you need to give it as argument explicitely?

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]