upload: diffstat-1.40-1, tar-1.15.1-1

Christopher Faylor cgf-no-personal-reply-please@cygwin.com
Wed Aug 17 19:25:00 GMT 2005


Yep.  I knew that this would be coming from some direction and it is a
wonderful illustration of why I quoted the term "common sense".

On Wed, Aug 17, 2005 at 07:22:42PM +0100, Dave Korn wrote:
>>From: Christopher Faylor
>>Sent: 17 August 2005 18:20
>
>>Let's apply some common sense here, too.  You specify "wt", what would
>>you expect?  You'd expect a file with CRLF endings, i.e., LF should be
>>translated to CRLF.
>
>Well, not on a linux box I wouldn't.

We're talking about a place where cygwin *obviously* differs from linux.

>Cygwin is meant to be emulating a POSIX system.  But it's hosted on
>windows.  That's why we have different mount kinds: they're a way of
>specifying what kind of native line-ends you want cygwin to pretend to
>apps that the underlying system has.

If you are going to be arguing based on what people intended for cygwin
to do with mounts, then I have to tell you that this behavior hasn't
changed for a very long time.

FWIW, the intent of attaching "binary" and "text" to mount points was to
get source code up and running in the early days of cygwin.  IMO, it's
an idea whose time has gone by.

>I think this entire discussion is coming from the wrong perspective!

Your logic seems to imply that "rt", "rb", and "wb" are all mandates
and "rt" is a hint.

You seem to be saying that this makes sense for a binary mounted
directory:

  On reads, if a file contains CRLFs:

    If you open with "rb", your buffer will contain CRLFs.
    If you open with "rt", your buffer will contain LFs.

  On writes, if you have a buffer which contains LFs:

    If you open with "wb", the file will contain LFs.
    If you open with "wt", the file will contain LFs.

And you seem to be saying that this makes sense for a text mounted
directory:

  On reads, if a file contains CRLFs:

    If you open with "rb", your buffer will contain CRLFs.
    If you open with "rt", your buffer will contain LFs.

  On writes, if you have a buffer which contains LFs:

    If you open with "wb", the file will contain LFs.
    If you open with "wt", the file will contain CRLFs.

In other words, there is nothing that a programmer can do to ensure that
the file gets CRLFs other than to inspect every line before writing it
and add a CR if one is needed.  I would consider this behavior pretty
useless.

For the archives, again, the reality is that "t" always translates from
CRLF on read and to CRLF on write.

cgf



More information about the Cygwin-apps mailing list