delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/05/23/05:36:29

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: erasmus.inf.ed.ac.uk: ht set sender to ht AT inf DOT ed DOT ac DOT uk using -f
To: cygwin AT cygwin DOT com
Subject: echo vs. ls race condition?
From: ht AT inf DOT ed DOT ac DOT uk (Henry S. Thompson)
User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux)
Date: Sun, 23 May 2004 10:35:51 +0100
Message-ID: <f5blljj4hag.fsf@erasmus.inf.ed.ac.uk>
MIME-Version: 1.0

Apologies if this is a known bug, or actually a bash problem, but I
can only reproduce it under cygwin (not linux or solaris, same bash
version (2.05b0) on linux, different (2.02.0) on solaris).

Hard to know what to search for, but nothing obvious in archives.

Short summary:  a loop with echo and ls does not produce well-ordered
output

Recipe to reproduce:

 > mkdir test
 > cd test
 > x=1
 > while [ $x -lt 200 ]; do mkdir $x; x=`expr $x + 1`; done
 > for d in *; do touch $d/aaa; touch $d/bbb; done
 > ls -d * | while read d; do echo $d; ls $d ; done > raceLog

Looking at raceLog will show e.g.

105
aaa
bbb
106
107
108
aaa
bbb
aaa
bbb
aaa
bbb

which is not what it should be. . .

Running up-to-date installations on XP and ME (cygcheck for the latter
[removed -- mail not getting through?]).

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 AT inf DOT ed DOT ac DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019