public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: File Name Case Sensitivity & Globbing! Was: file system name case insensitivity issue: Possible inclusion for the FAQ or User Manual?
Date: Sat, 28 May 2011 07:51:00 -0000	[thread overview]
Message-ID: <20110528075022.GA19027@calimero.vinschen.de> (raw)
In-Reply-To: <BANLkTinSRFMSj_dB-aLBDXi9TOqDKrZw3A@mail.gmail.com>

On May 27 16:36, Edward McGuire wrote:
> This note:
> 
> http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-casesensitive
> 
> warns that you cannot have two filenames in the same directory that
> differ only by case, because of NTFS semantics.

No, it does not.  *sigh*

I'm not a native English speaker, but it's still frustrating how my
words are misunderstood.  Read again, now with comment:

  "In the Win32 subsystem filenames are only case-preserved, but not
   case-sensitive."
   
Not NTFS.  The Win32 subsystem.  The underlying native NT calls allow to
specify if the object name is treated case-sensitive or case-insensitive.
The Win32 calls are usually calling their underlying NT pendants with
case-insensitivity switched on.  Therefore you only get a case-insensitive
behaviour on the Win32 surface.
   
   "You can't access two files in the same directory which only differ by
   case,  [...]"

That's just an example.

  "While NTFS (and some remote filesystems) support case-sensitivity, [...]"

Yes, they do.  The NTFS driver is case-sensitive.  This is obviously
used by the POSIX subsystem (Interix/SFU/SUA).  There is *no* reason to
forgo case-sensitivity with NTFS other than:

  "[...] the NT kernel starting with Windows XP does not support it by
   default.  Rather, you have to tweak a registry setting and reboot."

That's the only problem.  This registry settings, if set, lets the NT
kernel ignore all requests for case-sensitive behaviour.  It translates
all calls into case-insensitive calls.  Unless...
   
   "For that reason, case-sensitivity can not be supported by Cygwin,
    unless you change that registry value."

That's it.  Just change a registry value and suddenly case-sensitivity is
enabled in the kernel.  Now you can call native NT functions, request
case-sensitive behaviour, and actually get it.  Now, suddenly you can have
three files called "abc", "Abc and "ABC" in the same directory.  On NTFS:

  $ uname -a
  CYGWIN_NT-6.1 vmbert7 1.7.10(0.241/5/3) 2011-05-27 21:05 i686 Cygwin
  $ echo abc > abc
  $ echo Abc > Abc
  $ echo ABC > ABC
  $ cat abc
  abc
  $ cat Abc
  Abc
  $ cat ABC
  ABC

> It could be improved to warn that because of NTFS semantics there
> are also filenames which exist but which Cygwin's readdir() does not
> return, and which therefore are truly hidden -- will never show up
> in directory listings or globs.

This wouldn't be true.  The problem is not Cygwin's readdir, nor
the underlying OS functions scanning directories.  The only problem is
that non-Cygwin apps, which open one of the above three files, will
always open the same one, regardless whether you specify "abc", "Abc",
or "ABC" as filename.  Because, whatever Cygwin does, or the NT kernel,
the native Win32 applications are *still* case-insensitive.

Did I make myself clear now?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

  parent reply	other threads:[~2011-05-28  7:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26 18:29 Lee Rothstein
2011-05-26 19:36 ` Christopher Faylor
2011-05-26 19:58   ` Lee D. Rothstein
2011-05-27  5:30     ` Corinna Vinschen
2011-05-27 15:53       ` File Name Case Sensitivity & Globbing! Was: " Lee D. Rothstein
2011-05-27 16:12         ` Corinna Vinschen
2011-05-27 17:39         ` Thorsten Kampe
2011-05-27 21:36           ` Edward McGuire
2011-05-27 22:46             ` Thorsten Kampe
2011-05-28  7:51             ` Corinna Vinschen [this message]
2011-05-28 19:03               ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110528075022.GA19027@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).