This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
1.3.13 bug with arguments for "ls *" etc. where * is >900 chars
- From: "Willis, Matthew" <Matthew dot Willis at CIBC dot ca>
- To: "'cygwin at cygwin dot com'" <cygwin at cygwin dot com>
- Date: Thu, 7 Nov 2002 09:57:26 -0500
- Subject: 1.3.13 bug with arguments for "ls *" etc. where * is >900 chars
I reported a strange hang with nt4 yesterday and have more information on
how to replicate. Basically, long command line globs seem to cause the
system to get locked up at 100%. The following can replicate
mkdir tmp; cd tmp
for k in 0 1 2 3 4 5 6 7 8 9 a b c d e f
do
for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f
do
touch $j.$k
done
done
Now, when I do
ls * - this hangs (ctrl-c to get out)
ls [0-9a-f].[0-9a-f] - this hangs too
ls [0-9a-e].[0-9a-e] - but this works fine
It appears related to the absolute length of the arguments rather than the
number of them (above, 225). If I change the inner loop to "touch foo_$j.$k"
then experiment,
ls foo_* - this hangs (256 files)
ls foo_[0-9].[0-9a-b] - this hangs (120 files)
ls foo_[0-9].[0-9a] - this works fine (110 files)
It appears that if the arg list is over something like 900 bytes (incl
spaces, e.g. echo [0-9a-e].[0-9a-e] | wc), the program gets confused, which
is consistent with the prior experiment.
I created a small stub program to test if it was something special about
"ls".
#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, char * argv[])
{
for (int i=0;i<argc; i++)
cout << setw(4) << i << " " << argv[i] << endl;
return 0;
}
This program fails in the same way that ls does. It prints nothing in the
"hanging" cases, and just stops silently. For the okay cases, it prints a
list of args
Is this a bona fide bug? Has it been fixed already? (I am a bit gun shy
about upgrading because I use this machine for production and I got burned
by a compiler update last week.)
My cygcheck.out is attached to a post I made yesterday.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/