From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18458 invoked by alias); 17 Aug 2015 12:03:34 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 18449 invoked by uid 89); 17 Aug 2015 12:03:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f175.google.com Received: from mail-wi0-f175.google.com (HELO mail-wi0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 17 Aug 2015 12:03:32 +0000 Received: by wibhh20 with SMTP id hh20so79073510wib.0 for ; Mon, 17 Aug 2015 05:03:29 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.180.85.194 with SMTP id j2mr32858534wiz.11.1439813009220; Mon, 17 Aug 2015 05:03:29 -0700 (PDT) Received: by 10.28.51.80 with HTTP; Mon, 17 Aug 2015 05:03:29 -0700 (PDT) Date: Mon, 17 Aug 2015 12:03:00 -0000 Message-ID: Subject: FindFirstFile fails for some network directories From: Orgad Shaneh To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-08/txt/msg00276.txt.bz2 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 #include 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