delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/08/19/01:46:23

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; q=dns; s=default; b=i9
2QQMGzs3a1bZ+tnDFHPhXOEoLGWuqEfU/H4Jf2KHEvXhNnbnibbhLP4xNXT7PQuF
PaxSYamojHxBBGIvm4LS6thQaGAL4kavtp7hpIZVcikHJeJWI8V8pByeLMctlnlT
KONx2CB/gs+3pdNiZtOCnM1sRC6RxZmbB7sks13l4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:in-reply-to:references:date
:message-id:subject:from:to:content-type; s=default; bh=uoq0ev50
W9uZNyE2K5a+KADAlQs=; b=HwC7JkB0rnIVZnppEa8rzkkeshK0UGr24xT4GrTD
Tu5NGlchYfC2uUQNWvJJh7a9v3Pg12/gSP4hG+2FMRKpd3sTSjb44j/1acN0iy5B
DBKZLrS2vVRCjYdCM3FFOP5GkSDwX4dN8gL5CUg2Gok9oI24VUR6bgpB4F88K1F7
B5w=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
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-f178.google.com
MIME-Version: 1.0
X-Received: by 10.180.108.175 with SMTP id hl15mr50296171wib.1.1439963161877; Tue, 18 Aug 2015 22:46:01 -0700 (PDT)
In-Reply-To: <CAGHpTBKEWFa8M1KN6_vqrBT6WOjVpmOCUqP-LHBYK=FApg2fJg@mail.gmail.com>
References: <CAGHpTBKEWFa8M1KN6_vqrBT6WOjVpmOCUqP-LHBYK=FApg2fJg AT mail DOT gmail DOT com>
Date: Wed, 19 Aug 2015 08:46:01 +0300
Message-ID: <CAGHpTB+O-Z3Mir-4ZV7Wmh3dqo=rqfy+-CAW_KCE2hQdCjhB5w@mail.gmail.com>
Subject: Re: FindFirstFile fails for some network directories
From: Orgad Shaneh <orgads AT gmail DOT com>
To: cygwin AT cygwin DOT com

On Mon, Aug 17, 2015 at 3:03 PM, Orgad Shaneh <orgads AT gmail DOT com> wrote:
> 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

Hi,

Using Wireshark, I discovered that aclnas01 uses SMB, while netapp1 uses SMB2.

For some reason, when executed from command prompt, a FIND_FIRST2
request is sent and the server replies, while with cygwin a "NT Create
AndX" request is sent and denied.

To minimize the captured packets, I executed the application twice,
and captured only the second execution (to avoid session initiation).

Working capture: https://gist.github.com/orgads/d2681881668afb9cb08f
Failing capture: https://gist.github.com/orgads/4f0ea2b26cfd64f4353d

Does cygwin implement SMB on its own, or is this difference a
side-effect of the "Backup Intent" flag?

- Orgad

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

- Raw text -


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