X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 820FD385E015 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1584906108; bh=kV3bKwvVNVPpZIGKsiUsaJMgFBp7TvW+07ra47SHRDg=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=FyrDAFAmzSXSVwkPJSBaBA9mR+L7IO54Lx+Z/gZAs8D8xsqtyhXpunn/cKRBNm3ki uTbgAyFgY64loYBrNLm6OIjSEXsy+aP5kGNbEFudCIEEkWUr6Z/bNJ8PViXy6bHQiq me4oGa20IVqZ2DcCx3r+GYzvvR7FUIxKGxaSbTNo= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 11E1B385E001 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=BMOXQrip5cG7d2vcnYRCqN5MnNwryxA0RkrYF71viEA=; b=kCOwNzVT/s4kaqd2ww3dYNTCyD+By124/lUHT4PoBKGW7xW167MHAvASo2uREh354t thOXp7DHzTnEtAqBriXp1g8HY+NT/PjeFdqr3Zyu2cLQy9VY9qsdTZoBJfm3Inw62uQ6 P/IRBN2xAq/qbRCYHxTdrBXwjjwAGtSp0dD1GbWsZeTPtNUNEkDvUQXydCYAlIpQZff8 84cvaTfXYQWxxFujkbpKLlOeH8P4X+NpxpVbG3iUmAHbuX/nq40nFeFh/m78tx8ASM7Z nI52mpwcPL2TqdXDLUFzsuWL/p6pY4CwTlvQPWnTNo9x4jthwIMqAaSQf/5whzkJ7CVt Jspg== X-Gm-Message-State: ANhLgQ2YPwmcTXu42z014YVGAQp4/FqdYEyPLQy5CH2oQd7atzRAuamo 6H40Y81z3IPRYJzs43Hs1TMgvDiasFU/zAO/P6o= X-Google-Smtp-Source: ADFU+vtMy0Kf9AUYxQq5tzK3BAgT7etc+cLfv7o59adF6utnmxX9nYgbNmGPMmzHe7+tWZuH+cXnGxyJa228qD1ij18= X-Received: by 2002:a37:a213:: with SMTP id l19mr17064320qke.377.1584906105663; Sun, 22 Mar 2020 12:41:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 22 Mar 2020 19:41:34 +0000 Message-ID: Subject: Re: shell expansion produces e.g. "ls: cannot access '*.pdf': No such file or directory" in Windows CMD shell, but works okay in bash To: Jay Libove X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_2, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: Cygwin mailing list List-Archive: List-Post: List-Help: List-Subscribe: , From: Paul Moore via Cygwin Reply-To: Paul Moore

Cc: "cygwin AT cygwin DOT com" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" Have you tried deleting files one by one, to see if the issue is related to a single file (sorry if this is an obvious suggestion that you've already tried). In Cygwin bash, it's the shell that glob-expands wildcards before calling your program (e.g. ls), and in find, it's the find code that does the glob matching. But when running Cygwin utilities from a Windows shell, it's the Cygwin argv-processing code linked into the executable that does the glob-expansion. So it's reasonable to me that you should see the issue only with CMD, and not with bash or find. But that only confirms what bit of code is involved - not what the actual problem is :-( I don't actually know much about how the cygwin glob code actually works (my main involvement with it has been to confirm that it doesn't suit my specific needs, and to work out a way to bypass it...) so I can only offer fairly basic suggestions, I'm afraid... Paul On Sun, 22 Mar 2020 at 19:27, Jay Libove wrote: > > Thanks Paul, both for your initial reply, and your follow-up. > > In this case it's not a matter case sensitivity. > I've verified that, in one of the example cases, there are both *.pdf and *.PDF files in the subject directory. > Both 'ls *.pdf' and 'ls *.PDF' produce the "ls: cannot access '*.whatever': No such file or directory" error. > > (Nor, to the other respondent's question, as I pointed out in my original post, is it ACLs, as I did check CACLS before posting). > > I also tried copying (using Windows CMD "COPY") *.pdf (so being under Windows, not Cygwin, it matches all cases) from a subject directory to a new test directory. > In the resulting copy in the new test directory, the Cygwin shell expansion problem persists. > > Here's an interesting twist: > C:> cd c:\bin\cygwin64\bin > C:> ln gnufind.exe find.exe # I do this to allow me to differentiate between Windows' built-in very limited FIND command, and GNU/Cygwin's far superior find command. > C:> cd \my\test\directory > C:> gnufind . -name *.pdf -print > [ successfully returns all *.pdf {lower case only} files in the subject directory ] > C:> gnufind . -name *.PDF -print > [ successfully returns all *.pdf {upper case only} files in the subject directory ] > > I'm pretty sure that Cygwin 'find' does NOT try to emulate shell globbing the way 'ls' does, so it makes sense that this works, and it supports the theory that something weird is going on between how Cygwin does shell expansion when under Windows CMD vs. when fully within the Cygwin environment (under bash where of course bash is doing the shell expansion, and ls or other Cygwin commands don't have to). > > Does any of this help pinpoint the problem further? > > thanks again, > -Jay > > -----Original Message----- > From: Paul Moore

> Sent: Sunday, 22 March 2020 20:09 > To: Jay Libove > Cc: cygwin AT cygwin DOT com > Subject: Re: shell expansion produces e.g. "ls: cannot access '*.pdf': No such file or directory" in Windows CMD shell, but works okay in bash > > Is this because cygwin globbing is (by default) case sensitive? You could set the CYGWIN environment variable to "glob:ignorecase" to get case-insensitive behaviour. > > Paul > > On Sun, 22 Mar 2020 at 17:52, Jay Libove via Cygwin wrote: > > > > I've never seen this before. > > In a Windows CMD shell, Cygwin shell expansion, for example: > > ls *.pdf > > > > returns: > > ls: cannot access '*.PDF': No such file or directory (Indeed, any > > Cygwin shell expansion, when executed from within Windows CMD, > > produces this error. See below) > > > > ls *someotherwildcard* (that matches the same .pdf files) DOES return the expected file list. > > > > Example: > > > > C:> DIR *.pdf > > Volume in drive C is C > > Volume Serial Number is 8674-712A > > > > Directory of C:\Temp > > > > 22/03/2020 18:30 1.675.954 test.pdf > > XX/XX/XXXX XX:XX {Any many other .pdf files} > > > > Yet: > > > > C:> ls *.pdf > > ls: cannot access '*.pdf': No such file or directory > > > > And: > > C:> bash > > user AT hostname /cygdrive/C/Temp/test > > $ ls *.pdf > > A.pdf > > B.pdf > > {etc} > > > > And, not ALL of the *.pdf files in the particular directory where I've encountered this trigger the problem... > > > > C:> ls N*.pdf > > N.pdf > > > > C:> ls A*.pdf > > ls: cannot access 'A*.pdf': No such file or directory > > > > Nor do all directories containing .pdf files produce this. Of the many thousands of files and directories that I have, only some produce this problem. > > In others, ls *.pdf works perfectly in Windows CMD. > > > > I've looked at the Windows ATTRIB and CACLS of the files in directories where this problem occurs. > > They're all the same. That is, uniform across all files and directories. Nothing interesting. > > > > It's not just 'ls': > > > > C:> cat *.pdf > > cat: '*.pdf': No such file or directory > > > > So, it appears to be Cygwin shell expansion, when executed under Windows CMD, which is provoking this strange behavior. > > Any ideas what could be causing this, and how to solve it? > > > > many thanks, > > Jay > > > > -- > > Problem reports: https://cygwin.com/problems.html > > FAQ: https://cygwin.com/faq/ > > Documentation: https://cygwin.com/docs.html > > Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple