This is the mail archive of the cygwin 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: echo vs. ls race condition?

Fred Kulack <> writes:

> Interesting tests. I still can't get it to fail...

Note _I_ can't get it to fail with only 10 subdirs -- 100 or 200 are
much more reliable at producing the problem. . .

> What terminal are you using? Perhaps there's something weird going on with 
> flow control as descriptors are dup'd for the utilities there? 
> I'm using plain old winblows console.

I can reproduce using windows console plus bash

> Did you try the regular echo instead of the builtin? It may have different 
> characteristics
> with regard to this.

OK, so _that's_ interesting -- using /bin/echo _and_ running under
windows console I _cannot_ reproduce.  Either running under rxvt _or_
using builtin echo produces the problem.  Also, using /bin/sh to run
the loop does _not_ reproduce the problem, even with builtin echo.

Here's a hack way to test for the bug automatically, by the way:

 > command ls -d * | while read d; do /bin/echo -e "\n-$d-"; ls $d ; done > xxx
 > egrep -A2 'aaa' xxx| tr -d '\012' | sed 's/--/\
/g' | egrep 'aaa.*aaa'

 > uname -a
   CYGWIN_NT-5.1 francis 1.5.9(0.112/4/2) 2004-03-18 23:05 i686 unknown
   unknown Cygwin
 > cygcheck -cd bash
   Cygwin Package Information
   Package              Version        
   bash                 2.05b-16

 Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                     Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
            Fax: (44) 131 650-4587, e-mail:
[mail really from me _always_ has this .sig -- mail without it is forged spam]

Unsubscribe info:
Problem reports:

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