This is the mail archive of the
mailing list for the Cygwin project.
FindFirstFile fails for some network directories
- From: Orgad Shaneh <orgads at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 17 Aug 2015 15:03:29 +0300
- Subject: FindFirstFile fails for some network directories
- Authentication-results: sourceware.org; auth=none
I have 2 network shares with similar contents:
Trying to list all the files within these directories using Ruby
succeeds for netapp1, but fails for aclnas01.
The failing ruby command is:
ruby -e "print Dir.glob('//aclnas01/versions/CompilationResults/*')"
The exact same command succeeds when executed from a normal command
prompt, or when the directory is on netapp1 (on both shells).
After debugging Ruby, I found out that FindFirstFile returns an
INVALID_HANDLE when invoked from cygwin environment.
The following application succeeds on command prompt and fails on cygwin:
const TCHAR *aclnas = TEXT("//aclnas01/versions/CompilationResults");
const TCHAR *netapp = TEXT("//netapp1/CM/CompilationResults");
printf("%d\n", FindFirstFile(aclnas, &fd) !=
INVALID_HANDLE_VALUE); // Fails on cygwin
printf("%d\n", FindFirstFile(netapp, &fd) !=
INVALID_HANDLE_VALUE); // Always succeeds
Output on cmd is 1 1, on cygwin it is 0 1.
Process Monitor shows that when executed from cygwin, CreateFile is
called with Open for Backup flag. I can't say for sure if this causes
the failure, but that's the only difference I could find between these
This bug was previously reported on github/msys2, but it wasn't solved.
I only have read access to these servers, but I might have cooperation
of the sys admin (can't promise though).
Any help will be appreciated.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple