This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug diff 2.8.7: Separate dir


On Sat, Mar 05, 2005 at 06:55:12PM -0800, Brian Dessent wrote:
> 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.

Seems obvious to me that Cygwin is doing the right thing...

Let's say you have c:\windows mounted in binary mode as /winbin and also
mounted as text mode as /wintxt.

Cygwin treats...
    - /winbin/file.txt as binary
    - /wintxt/file.txt as text and does CRLF translation
    - c:\windows\file.txt as binary since it is a native path and it
      would obviously be futile to try and map it to a single mount
      point

My .02$...
Sebastien

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

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]