X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.0 required=5.0	tests=BAYES_00,DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Date: Tue, 6 Jul 2010 14:11:02 +0200
From: Robert Schiele <rschiele@gmail.com>
To: cygwin@cygwin.com
Subject: weird behavior regarding case sensitivity of GNU make's $(wildcard) function
Message-ID: <20100706121100.GA19706@sigfpe.ibm.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;	protocol="application/pgp-signature"; boundary="FCuugMFkClbJLl1L"
Content-Disposition: inline
User-Agent: Mutt/1.5.20 (2009-06-14)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi!

I found the following (in my optinion weird) behavior of the $(wildcard)
function of GNU make when running on Cygwin:

I have a place in a makefile that checks for existence of a file (let's call
it "/cygdrive/c/path/to/file") with $(wildcard /cygdrive/c/path/to/file).
Unfortunately the vendor of this file refers to this file with different case
letters than it is materialized on disk.  On the disk the file is actually
stored as "C:\Path\to\File" which translates to the Cygwin style name
"/cygdrive/c/Path/to/File".  Since Windows is supposed to be case-insensitive
this should be fine but in Cygwin's GNU make binary (current version as of
today) I observed the following behavior:

1. "$(wildcard /cygdrive/c/path/to/file)" does not match anything and thus
   returns an empty string.

2. "$(wildcard /cygdrive/c/Path/to/File)" does match the file and thus returns
   "/cygdrive/c/Path/to/File" as expected.

3. "$(wildcard /cygdrive/c/Path/to/file)" does not match anything and thus
   returns an empty string.

4. "$(wildcard /cygdrive/c/path/to/File)" does match the file and thus returns
   "/cygdrive/c/path/to/File".

More generic inspection reveals that apparently the $(wildcard) function seems
to be case-insensitive on the directory part but case-sensitive on the file
name part of the absolute path given.

Is this kind of expected behavior or does this point to a bug in the GNU make
implementation (or even further down in a Cygwin library)?

Does anyone know of a reasonable workaround?  Is there a way to make the
$(wildcard) function case-insensitive completely (like by setting a special
option of flag)?  Or is there probably a better replacement function that does
basically the same but in a case-insensitive way?

If this doesn't work is there probably some function that converts filename
strings to a representation that is exactly how a file is stored on the disk,
i.e. I give it "/cygdrive/c/path/to/file" and it returns
"/cygdrive/c/Path/to/File"?

Any better ideas?

Robert

--FCuugMFkClbJLl1L
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)

iEYEARECAAYFAkwzHVQACgkQxcDFxyGNGNf9TgCdFl01DfsaYzxeEy29SG0G4sBL
GWMAoIevPWRW+oiiTsbOEDEPRgs9uANg
=DpJn
-----END PGP SIGNATURE-----

--FCuugMFkClbJLl1L--
