Subject: Re: Bug diff 2.8.7: Separate dir
From: Brian Dessent <[email-masked]>
To: [email-masked]
Date: Sat, 05 Mar 2005 18:55:12 -0800

Arend-Jan Westhoff wrote:

> It also seems inconsequent if what you say is truely correct and what is
> intended that when I use my file 'a' from my original example and do the
> following:
>         copy a b
> that then:
>         diff ./a .\b
> says that the files are completely different, whereas:
>         diff ./a .\a
> says they are completely equal, while files a and b are character for
> character identical!

I think this happens because diff calls stat() on both files and
recognizes that they are actually the same file without even reading
them.

> Therefor in my opinion according to the User's Guide all files
> on my d: drive should have been opened by diff in text mode,
> which as we saw is currently not the case.

They will, if you use '/' as the path separator.

The fact is that Cygwin is trying to emulate/provide a POSIX type
environment to the apps that are running under it, and this means the
path separator is the '/', as on just about any unix-like system.  If
you want Cygwin to perform newline-translation you should use POSIX
paths.  When you specify a filename like "c:\windows\file.txt" or "a\b"
you are using Windows style paths and not POSIX style ones, and Cygwin
just passes them on straight to the underlying Windows system calls.

I don't know enough about Cygwin history or internals to say why this is
the case.  Someone who knows more about it would have to explain it. 
And as you've seen it can lead to confusing situations.

That said, from what I can tell the ability for *some* Cygwin apps to
accept '\'-style paths in *some* situations is more or less luck. 
'diff' aside, there are probably many other ported Cygwin apps that will
choke in strange ways if you try to feed them a path with '\' because
they are all coded to recognise '/' as a path separator.

The cygpath utility is provided for translating paths, so that if you
have a windows program calling a cygwin one (or vice versa) you can
convert the arguments between the two.

Brian

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