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: 1.5.21-1 readdir() not returning complete directory entries for network paths after rewinddir()

On Oct 23 13:50, Benjamin Lindner wrote:
> Hello list,
> Issuing a rewinddir() on a mounted network path caues successive calls 
> to readdir() to only return "." and ".." ignoring the actual further 
> content of the directory.
> I searched the mailing list and found the following two bug reports 
> dealing with this problem:
> In the second report the same problem is reported, and there was a fix 
> proposed. It works correct for local directories, but not for directories
> mounted with "net use".
> following testcase:
> $ ls -la /cygdrive/u/testing
> total 4.0K
> drwxr-xr-x 1 lindnebe DUsers  0 Oct 16 17:27 ./
> drwxr-xr-x 1 lindnebe DUsers  0 Jan  1  1970 ../
> -rw-r--r-- 1 lindnebe DUsers 77 Oct 16 11:16 mytestfunction.m
> $ ./readdirtest.exe /cygdrive/u/testing
> Entry 0: <.>
> Entry 1: <..>
> Entry 2: <mytestfunction.m>
> count=3
> rewinding
> Entry 0: <.>
> Entry 1: <..>
> Entry 2: NULL
> Entry 3: NULL
> Entry 4: NULL
> Entry 5: NULL

Unfortunately you didn't attach the testcase, but the cygcheck output
twice instead.

I tried your above example using Yaakov's original testcase from
I created a FAT share as in your case, containing a directory testing
with a file mytestfunction.m in it on a 1.5.21 system and found that it
works like a charm.

Then it occured to me that you're running W2K, so I tried the same on
W2K and... bingo.

Further debugging showed that this is a bug in W2K.  The function
NtQueryDirectoryFile apparently ignores the "RestartScan" parameter when
being called on a remote directory.  It does not depend on the file
system type, it happens with remote FAT, NTFS as well as Samba shares.
This bug is not present in NT4, nor in XP and above.

This is most unfortunate.  I'm not sure right now how to solve this
problem most satisfying.  Oh well, yet another kludge necessary :(

Thanks for the report, nevertheless.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Unsubscribe info:
Problem reports:

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