echo vs. ls race condition?

Henry S. Thompson ht@inf.ed.ac.uk
Thu May 27 09:56:00 GMT 2004


Fred Kulack <kulack@us.ibm.com> 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

ht
-- 
 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: ht@inf.ed.ac.uk
                   URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]

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



More information about the Cygwin mailing list