delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/24/19:55:18

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Sun, 24 Feb 2002 19:54:55 -0500
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Readdir() bug?
Message-ID: <20020225005455.GE22074@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <F86dRo5dNtWZvXVPDHX000183c8 AT hotmail DOT com>
Mime-Version: 1.0
In-Reply-To: <F86dRo5dNtWZvXVPDHX000183c8@hotmail.com>
User-Agent: Mutt/1.3.23.1i

On Mon, Feb 25, 2002 at 12:49:39AM +0000, John William wrote:
>From: "John William" <jw2357 AT hotmail DOT com>
>To: cygwin AT cygwin DOT com
>Subject: Readdir() bug?
>Date: Mon, 25 Feb 2002 00:49:39 
>
>I have a program that behaves differently on Linux and Cygwin.  I'm
>using version 1.3.9 of the DLL.
>
>The program tries to list all files in a directory by doing opendir(),
>then readdir() until all the entries have been read and then
>closedir().  That works fine, but the time between the opendir() and
>the closedir() can be considerable.
>
>On Linux, if any files are added to the directory after the opendir(),
>they will not be enumerated by readdir().  On Cygwin, they are (they
>can appear in
>
>the middle of the file list or at the end - presumably wherever the new
>file
>
>happened to end up in the directory's file order).
>
>I am assuming that the Linux behavour is correct.  Cygwin causes the
>program in question to break because it can modify files and copy them
>back into the
>
>original directory (with a copy followed by a rename to replace the
>original
>
>file) so readdir() never hits the end of the file list because it keeps
>seeing the newly added files.
>
>Any help or comments would be appreciated.  Thanks.

From the Single UNIX (R) Specification, Version 2:
http://www.opengroup.org/onlinepubs/007908799/xsh/readdir.html

If a file is removed from or added to the directory after the most
recent call to opendir() or rewinddir(), whether a subsequent call to
readdir() returns an entry for that file is unspecified.

cgf

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

- Raw text -


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