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]

FindFirstFile fails for some network directories


Hi,

I have 2 network shares with similar contents:
\\netapp1\CM\CompilationResults
\\aclnas01\versions\CompilationResults

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:

#include <stdio.h>
#include <windows.h>

int main()
{
    const TCHAR *aclnas = TEXT("//aclnas01/versions/CompilationResults");
    const TCHAR *netapp = TEXT("//netapp1/CM/CompilationResults");

    WIN32_FIND_DATA fd;
    printf("%d\n", FindFirstFile(aclnas, &fd) !=
INVALID_HANDLE_VALUE); // Fails on cygwin
    printf("%d\n", FindFirstFile(netapp, &fd) !=
INVALID_HANDLE_VALUE); // Always succeeds
    return 0;
}

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
executions.

This bug was previously reported on github/msys2[1], 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.

Thanks,
- Orgad

[1] https://github.com/Alexpux/MSYS2-packages/issues/242

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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