Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Fri, 22 Nov 2002 19:10:35 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Andrew Chang cc: cygwin AT cygwin DOT com Subject: Re: DOS shortname and cygwin I/O In-Reply-To: <200211222358.gAMNw2X06966@work.bitmover.com> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Fri, 22 Nov 2002, Andrew Chang wrote: > Hello, > > I just noticed that cygwin seems to get confused when we do a > cd to dos-short-pathname. It is easy to reproduce: > > a) Install cygwin to c:/Programme/cygwin > b) make sure you mount / in binary mode > c) mkdir c:/Programme/cygwin/tst > c) cd c:/Programme/cygwin/tst > d) echo "XXX" > file1 > e) od -c file1 # this should show file1 with '\n' line termination > f) cd c:/Progra~2/cygwin/tst # C:/Progra~2 is the shortname of c:/Programme > g) echo "XXX" > file2 > h) od -c file2 # this should show file2 with a \r\n line termination > > I would expect the "echo" command to behave the same way, regardless of how > I cd there. Is there a reason for doing otherwise ? > > Thanks > Andrew Chang I don't know if it's a bug, but I believe I can explain what's happening: When a file is opened in Cygwin, and the mode (binary or text) is not specified, the mount table is consulted, and the first matching entry determines the type of mount (binary or text), and thus the mode. If the directory is not found in the mount table, it is assumed to be mounted through /cygdrive. What's happening in your case is that Cygwin doesn't match c:/Progra~2 with the c:/Programme in the mount table, and thus assumes that it is a text mount (because /cygdrive is text). The fact that you end up in the same directory is really irrelevant (that's Windows' doing). Cygwin isn't aware of DOS short names being equivalent to Windows long names. So, to answer your question, echo *does* behave the same way - it only outputs a newline. Writing the file to disk, however, *does not* behave the same way, and depends on the type of mount, which, in turn, depends on which entry in the mount table the directory matches. Hope this helps, Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/