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: Limit to length of command line arguments? (was Cygwin/bash: need environment variables >32K)


There are no unusual file names.  Everything starts with a consonant.

As an example, in bash

$ echo N* | wc
      1    3332   73218
$ ls N* | wc
bash: /bin/ls.exe: Invalid argument
      0       0       0
$ echo i* | wc
      1       4      41
$ ls i* | wc
      4       4      45

sh behaves the same except for the error message

$ ls N* | wc
ls: error 22
      0       0       0

If I give ls an argument that is 32730 characters long, I get the following:

$ ls `gawk 'BEGIN {for (N = 1; N < 32730; N++) {printf "X"}; print
"";exit}'`
bash: /bin/ls.exe: Invalid argument

While if I give it an argument 32729 characters long

$ ls `gawk 'BEGIN {for (N = 1; N < 32729; N++) {printf "X"}; print
"";exit}'`
XXXX[snip]XXXX: File or path name too long

So something changes when the command line arguments get too long.

- Barry

-----Original Message-----
From: Jörg Schaible [mailto:Joerg.Schaible@Elsag-Solutions.com] 
Sent: Thursday, October 23, 2003 2:53 AM
To: cygwin@cygwin.com
Subject: RE: Limit to length of command line arguments? (was Cygwin/bash:
need environment variables >32K)


Hi Barry,

Buchbinder, Barry (NIH/NIAID) wrote on Thursday, October 23, 2003 12:43 AM:
> 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 37k,

<snip>
 
> $ 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. 

You might have an unusual filename (e.g. starting with a dash) that is
interpreted as argument. Try

$ ls -- *

This tells ls to interpret anything after the double dash as file argument
and not as possible option!

Regards,
Jörg

--
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]