Subject: Re: check_case:adjust still an option?
From: Yitzchak Scott-Thoennes <[email-masked]>
To: [email-masked]
Date: Sun, 2 Jan 2005 17:12:10 -0800

On Sun, Jan 02, 2005 at 06:13:44PM -0500, "Pierre A. Humblet" wrote:
> On Sun, Jan 02, 2005 at 02:18:44PM -0800, Yitzchak Scott-Thoennes wrote:
> > On Sun, Jan 02, 2005 at 04:33:01PM -0500, "Pierre A. Humblet" wrote:
> > > On Sun, Jan 02, 2005 at 12:32:21PM -0800, Yitzchak Scott-Thoennes wrote:
> > > > /usr/share/doc/cygwin-doc-1.3/html/cygwin-ug-net/using-cygwinenv.html says:
> > > > 
> > > >    check_case:level - Controls the behaviour of Cygwin when a user
> > > > tries to open or create a file using a case different from the case of
> > > > the path as asved on the disk. level is one of relaxed, adjust and
> > > > strict.
> > > >    ...
> > > >    adjust behaves mostly invisible. The POSIX input path is internally
> > > > adjusted in case, so that the resulting DOS path uses the correct case
> > > > throughout. You can see the result when changing the directory using a
> > > > wrong case and calling /bin/pwd afterwards.
> > > > 
> > > > but I'm not seeing any difference between adjust and relaxed; is adjust
> > > > still a valid option?
> > > 
> > > Sure, but not as visibly as documented above. For example under sh
> > > $: cd c:/HoME/PiErRe
> > > $: /bin/pwd
> > > /c/HoME/Pierre
> > > 
> > > I has a look at the code and it is the Windows path that is adjusted,
> > > not the Posix path. I think it was always like that.
> > > In the case of chdir, the change in the Posix path was a result of former
> > > transformations of the Windows path back to Posix form. Those can cause
> > > trouble when several Posix paths point to the same Windows path (the mapping
> > > Posix -- Windows is not bijective). In particular the final text/binary mode
> > > need not be as expected, and this caused complaints.  
> > 
> > So you can expect it to "work" only outside of any mount point?
> 
> It always "works" but it's hard to observe. I don't really care 
> about it and never tried to really make sense of it.

I meant "work" as in have any user-visible effect at all.
 
> > It doesn't seem to do this for me (using 20050101 snapshot):
> >
> > $ CYGWIN="$CYGWIN check_case:adjust " bash
> > $ echo $CYGWIN
> > tty ntsec title server check_case:adjust
> > $ cd c:/SeTuP/CyGwIn
> > $ /bin/pwd
> > /cygdrive/c/SeTuP/CyGwIn
> > $ ls -d c:/?e?u?/?y?w?n
> > c:/setup/cygwin
> 
> That's because you use bash. There are lots of Cygwin patches
> in bash to transform paths (again, I never tried to understand
> why) , so it's likely that the Cygwin chdir does not even see
> what you give to bash, e.g.
> 
> /c/home/PiERRe: strace bash -c 'cd c:/hOmE/PiErRe' | fgrep chdir 
>   351  524054 [main] bash 542197 chdir: dir '/c/hOmE/PiErRe'      <== NO MORE c:
>   270  528790 [main] bash 542197 chdir: 0 = chdir() cygheap->cwd.posix '/c/hOmE/PiErRe' native 'c:\hOmE\Pierre'
> 
> But as you see toward the end, the native path was indeed fixed!
> Because chdir gets a Posix path from bash, it's happy and it does not 
> use the Windows path to get a Posix path (although it used to, which broke
> various more important things).

Thanks for the explanation.  A test program that does chdir and
system("pwd") does show it having an effect (when chdir is given a
windows path only).

Seems kind of pointless, really.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/