This is the mail archive of the 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]

Limit to length of command line arguments? (was Cygwin/bash: need environment variables >32K)

While doing some other work, I've come to the impression that this is not a
fileutils problem.  In a directory with ~1700 htm files whose names take

$ zip archive_name *.htm
bash: /bin/zip: Invalid argument


$ echo * | tr ' ' '\n' | zip -@

worked fine.  I did it again using sh.

$ zip archive_name *.htm

silently did nothing while

$ echo * | tr ' ' '\n' | zip -@

worked as expected.

I then remembered that in this directory,

$ cp -pv *.htm target_dir

worked fine under sh last week but does not now.

In another experiment, under bash

$ ls

works fine while

$ ls *
bash: /bin/ls.exe: Invalid argument

There has been a big change my cygwin installation since last week.  I got a
new box, upgrading from Win98SE to XP Pro.  So this is a new installation of
cygwin, but other than this line-length problem, everything seems to be
working OK (ignoring minor glitches probably due to various configuration
files getting lost in the transition).

Although I could re-do my scripts to work around this problem I'd appreciate
any help in figuring out what is wrong with my cygwin installation.

Thanks for your time and consideration.

- Barry Buchbinder

-----Original Message-----
From: Buchbinder, Barry (NIH/NIAID) 
Sent: Wednesday, October 22, 2003 9:53 AM
To: 'Klein Andre ICM N AS PD B 3'; ''
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 *`


$ echo $T


$ 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 [] 
Sent: Wednesday, October 22, 2003 7:16 AM
To: ''
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

Following problems arise in my environment:
(a) environment variable with 30K line 9: /usr/bin/rm: Resource temporarily unavailable
(b) environment variable with 100K 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...


-----Original Message-----
From: Corinna Vinschen []
Sent: Mittwoch, 22. Oktober 2003 12:01
To: ''
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
> 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 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 Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                      
Red Hat, Inc.

Unsubscribe info:
Problem reports:

Attachment: cygcheck.out
Description: Binary data

Unsubscribe info:
Problem reports:

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