public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* bash /usr/bin/ls invalid argument
@ 2003-10-28  0:12 Jared Ingersoll
  2003-10-28  1:13 ` Andrew DeFaria
  2003-10-28 12:57 ` Hannu E K Nevalainen
  0 siblings, 2 replies; 7+ messages in thread
From: Jared Ingersoll @ 2003-10-28  0:12 UTC (permalink / raw)
  To: 'cygwin@cygwin.com'

Hi,

I'm using bash 2.05b-16 on Win2K pro and I'm running into problems listing
directory contents with a wildcard. This particular directory has over 8000
files in it, most of which (99%) are files that start with send.log.*. When
I issue the following commands, I get the same error:

$ ls send.log.*
bash: /usr/bin/ls: Invalid argument

$ ls send.log.2003*
bash: /usr/bin/ls: Invalid argument

$ ls send.log.200307*
bash: /usr/bin/ls: Invalid argument

However, if i issuse the same command in the same directory for a different
filename (amount to less that 1% of the files) it works:

$ ls receive.log.2003*
receive.log.20030703  receive.log.20030806  receive.log.20030903
receive.log.20031001
receive.log.20030707  receive.log.20030807  receive.log.20030904
receive.log.20031002
receive.log.20030708  receive.log.20030808  receive.log.20030905
receive.log.20031003
receive.log.20030712  receive.log.20030809  receive.log.20030906
receive.log.20031004

Any ideas what might be going on? Obviously, for scripting purposes I need
to be able to list the directory contents with a wildcard (actually want to
use this with grep). 

$ grep IDxxxxxxxxxxxxxxxxxxxxxx send*
bash: /usr/bin/grep: Invalid argument


I tried this with the bourne shell and it seems to do the same thing.

Jared


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bash /usr/bin/ls invalid argument
  2003-10-28  0:12 bash /usr/bin/ls invalid argument Jared Ingersoll
@ 2003-10-28  1:13 ` Andrew DeFaria
  2003-10-28 12:57 ` Hannu E K Nevalainen
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew DeFaria @ 2003-10-28  1:13 UTC (permalink / raw)
  To: cygwin

Jared Ingersoll wrote:

>Hi,
>
>I'm using bash 2.05b-16 on Win2K pro and I'm running into problems listing directory contents with a wildcard. This particular directory has over 8000 files in it, most of which (99%) are files that start with send.log.*. When I issue the following commands, I get the same error:
>
>$ ls send.log.*
>bash: /usr/bin/ls: Invalid argument
>
>$ ls send.log.2003*
>bash: /usr/bin/ls: Invalid argument
>
>$ ls send.log.200307*
>bash: /usr/bin/ls: Invalid argument
>
>However, if i issuse the same command in the same directory for a different filename (amount to less that 1% of the files) it works:
>
>$ ls receive.log.2003*
>receive.log.20030703  receive.log.20030806  receive.log.20030903
>receive.log.20031001
>receive.log.20030707  receive.log.20030807  receive.log.20030904
>receive.log.20031002
>receive.log.20030708  receive.log.20030808  receive.log.20030905
>receive.log.20031003
>receive.log.20030712  receive.log.20030809  receive.log.20030906
>receive.log.20031004
>
>Any ideas what might be going on? Obviously, for scripting purposes I need to be able to list the directory contents with a wildcard (actually want to use this with grep). 
>
>$ grep IDxxxxxxxxxxxxxxxxxxxxxx send*
>bash: /usr/bin/grep: Invalid argument
>
>I tried this with the bourne shell and it seems to do the same thing.
>
man xargs.
-- 
The careful application of terror is also a form of communication.



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: bash /usr/bin/ls invalid argument
  2003-10-28  0:12 bash /usr/bin/ls invalid argument Jared Ingersoll
  2003-10-28  1:13 ` Andrew DeFaria
@ 2003-10-28 12:57 ` Hannu E K Nevalainen
  2003-10-29 10:17   ` Nicolas BUONOMO
  1 sibling, 1 reply; 7+ messages in thread
From: Hannu E K Nevalainen @ 2003-10-28 12:57 UTC (permalink / raw)
  To: cygwin

> From: Jared Ingersoll
> Sent: Monday, October 27, 2003 8:55 PM

> I'm using bash 2.05b-16 on Win2K pro and I'm running into problems listing
> directory contents with a wildcard. This particular directory has
> over 8000
> files in it, most of which (99%) are files that start with
> send.log.*. When
> I issue the following commands, I get the same error:
>
> $ ls send.log.*
> bash: /usr/bin/ls: Invalid argument

 For newbies: to get to grips about how this works "under the hood"; read up
on how "Shell expansion" works in e.g. bash (i.e. search and read the "man"
or "info" on bash)

 IIRC there was a recent thread (about environment variables and passing
arguments to a windows-console program):

There is a 32KB length limit on the command line. This is imposed on us by
the underlying "OS" - i.e. not likely to change.


To check how long your command line would be, try something like this:

$ find -type f -name 'send.log.*' |
(
  read f;
  cc=-1;
  echo "";
  while [ ! -z "$f" ];do
    cc=$(( 1 + $cc + $( echo "$f" | wc -c) ));
    echo -e "\e[F$cc\e[K";read f;
  done;
  echo -e "\e[F$cc chars"
)

Remember to add the length of e.g. "ls -l " (note space).

If this gives a number larger than...

$ echo $(( ( 1 << 15 ) -1 ))
32767

... then you're "outta luck".

/Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
-- printf("Timezone: %s\n", (DST)?"UTC+02":"UTC+01"); --
--END OF MESSAGE--


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bash /usr/bin/ls invalid argument
  2003-10-28 12:57 ` Hannu E K Nevalainen
@ 2003-10-29 10:17   ` Nicolas BUONOMO
  2003-10-29 15:23     ` Hannu E K Nevalainen
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas BUONOMO @ 2003-10-29 10:17 UTC (permalink / raw)
  To: cygwin

Hello,

Hannu E K Nevalainen a écrit :

>>From: Jared Ingersoll
>>Sent: Monday, October 27, 2003 8:55 PM
> 
> ....
> 
> There is a 32KB length limit on the command line. This is imposed on us by
> the underlying "OS" - i.e. not likely to change.
> 
> 
> To check how long your command line would be, try something like this:
> 
> $ find -type f -name 'send.log.*' |
> (
>   read f;
>   cc=-1;
>   echo "";
>   while [ ! -z "$f" ];do
>     cc=$(( 1 + $cc + $( echo "$f" | wc -c) ));
>     echo -e "\e[F$cc\e[K";read f;
>   done;
>   echo -e "\e[F$cc chars"
> )
> 
> Remember to add the length of e.g. "ls -l " (note space).
> 
> If this gives a number larger than...
> 
> $ echo $(( ( 1 << 15 ) -1 ))
> 32767
> 
> ... then you're "outta luck".
> 

I try your command on a Microsoft XP pro and I win

nicolas@cl12369n ~ s=1
  $ find -type f -name '*' | (   read f;   cc=-1;   echo "";   while
[ ! -z "$f" ]; do     cc=$(( 1 + $cc + $( echo "$f" | wc -c) ));
  echo -e "\e[F$cc\e[K";read f;   done;   echo -e "\e[F$cc chars"; )
1789980 chars

Where is the problem?

bye

> /Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
> -- printf("Timezone: %s\n", (DST)?"UTC+02":"UTC+01"); --
> --END OF MESSAGE--
> 
> 
> --
> 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/
> 
> 
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: bash /usr/bin/ls invalid argument
  2003-10-29 10:17   ` Nicolas BUONOMO
@ 2003-10-29 15:23     ` Hannu E K Nevalainen
  0 siblings, 0 replies; 7+ messages in thread
From: Hannu E K Nevalainen @ 2003-10-29 15:23 UTC (permalink / raw)
  To: cygwin

> From: Nicolas BUONOMO
> Sent: Wednesday, October 29, 2003 9:52 AM

> Hello,
>
> Hannu E K Nevalainen a écrit :
>
> >>From: Jared Ingersoll
> >>Sent: Monday, October 27, 2003 8:55 PM
> >
> > ....
> >
> > There is a 32KB length limit on the command line. This is
> imposed on us by
> > the underlying "OS" - i.e. not likely to change.
> >
> >
> > To check how long your command line would be, try something like this:
> >
> > $ find -type f -name 'send.log.*' |
> > (
> >   read f;
> >   cc=-1;
> >   echo "";
> >   while [ ! -z "$f" ];do
> >     cc=$(( 1 + $cc + $( echo "$f" | wc -c) ));
> >     echo -e "\e[F$cc\e[K";read f;
> >   done;
> >   echo -e "\e[F$cc chars"
> > )
> >
> > Remember to add the length of e.g. "ls -l " (note space).
> >
> > If this gives a number larger than...
> >
> > $ echo $(( ( 1 << 15 ) -1 ))
> > 32767
> >
> > ... then you're "outta luck".
> >
>
> I try your command on a Microsoft XP pro and I win
>
> nicolas@cl12369n ~ s=1
>   $ find -type f -name '*' | (   read f;   cc=-1;   echo "";   while
> [ ! -z "$f" ]; do     cc=$(( 1 + $cc + $( echo "$f" | wc -c) ));
>   echo -e "\e[F$cc\e[K";read f;   done;   echo -e "\e[F$cc chars"; )
> 1789980 chars
>
> Where is the problem?
>

 =-) there is no problem with _my_ command. It was to show _when_ there is a
problem - and what the problem consists of.

 Try "ls -l *" in the same directory as you did your test in. That will give
you an error message, due to the limit mentioned earlier in this thread.

/Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
-- printf("LocalTime: UTC+%02d\n",(DST)? 1:2); --
--END OF MESSAGE--


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: bash /usr/bin/ls invalid argument
  2003-10-28 14:08 Jared Ingersoll
@ 2003-10-28 16:05 ` Christopher Faylor
  0 siblings, 0 replies; 7+ messages in thread
From: Christopher Faylor @ 2003-10-28 16:05 UTC (permalink / raw)
  To: cygwin

On Tue, Oct 28, 2003 at 07:02:15AM -0500, Jared Ingersoll wrote:
>Thanks, I thought it may be something inherent. I can work around this
>limitation.

Let me again point out that there is a way around this limitation:

http://sources.redhat.com/ml/cygwin/2003-09/msg01607.html
--
Please use the resources at cygwin.com rather than sending personal email.
Special for spam email harvesters: send email to aaaspam@sourceware.org
and be permanently blocked from mailing lists at sources.redhat.com

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: bash /usr/bin/ls invalid argument
@ 2003-10-28 14:08 Jared Ingersoll
  2003-10-28 16:05 ` Christopher Faylor
  0 siblings, 1 reply; 7+ messages in thread
From: Jared Ingersoll @ 2003-10-28 14:08 UTC (permalink / raw)
  To: cygwin

Thanks, I thought it may be something inherent. I can work around this
limitation.

Jared

-----Original Message-----
From: Hannu E K Nevalainen [mailto:garbage_collector@telia.com]
Sent: Tuesday, October 28, 2003 5:20 AM
To: cygwin@cygwin.com
Subject: RE: bash /usr/bin/ls invalid argument


> From: Jared Ingersoll
> Sent: Monday, October 27, 2003 8:55 PM

> I'm using bash 2.05b-16 on Win2K pro and I'm running into problems listing
> directory contents with a wildcard. This particular directory has
> over 8000
> files in it, most of which (99%) are files that start with
> send.log.*. When
> I issue the following commands, I get the same error:
>
> $ ls send.log.*
> bash: /usr/bin/ls: Invalid argument

 For newbies: to get to grips about how this works "under the hood"; read up
on how "Shell expansion" works in e.g. bash (i.e. search and read the "man"
or "info" on bash)

 IIRC there was a recent thread (about environment variables and passing
arguments to a windows-console program):

There is a 32KB length limit on the command line. This is imposed on us by
the underlying "OS" - i.e. not likely to change.


To check how long your command line would be, try something like this:

$ find -type f -name 'send.log.*' |
(
  read f;
  cc=-1;
  echo "";
  while [ ! -z "$f" ];do
    cc=$(( 1 + $cc + $( echo "$f" | wc -c) ));
    echo -e "\e[F$cc\e[K";read f;
  done;
  echo -e "\e[F$cc chars"
)

Remember to add the length of e.g. "ls -l " (note space).

If this gives a number larger than...

$ echo $(( ( 1 << 15 ) -1 ))
32767

... then you're "outta luck".

/Hannu E K Nevalainen, B.Sc. EE - 59?16.37'N, 17?12.60'E
-- printf("Timezone: %s\n", (DST)?"UTC+02":"UTC+01"); --
--END OF MESSAGE--


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-10-29 14:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-28  0:12 bash /usr/bin/ls invalid argument Jared Ingersoll
2003-10-28  1:13 ` Andrew DeFaria
2003-10-28 12:57 ` Hannu E K Nevalainen
2003-10-29 10:17   ` Nicolas BUONOMO
2003-10-29 15:23     ` Hannu E K Nevalainen
2003-10-28 14:08 Jared Ingersoll
2003-10-28 16:05 ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).