Subject: Re: CRLF fun stuff again...

From: Duncan Sinclair <[email-masked]>
Date: Sat, 10 Feb 2001 16:03:35 +0000

Paul Schinder writes:
>I missed this before.

...

>The transformations you're using aren't the ones that netatalk does 
>(or at least netatalk did in the past before I turned it off).  These 
>are reversible.  netatalk does
>
>tr '\r' '\n'  to Unix and tr '\n' '\r' to Mac OS.
>
>That's why people are warning about data corruption.

Guess what?  You're wrong.  If people are going to try to tell me I'm
wrong, please do the research first!

Here's a chunk of code from afpd's fork.c file.  It uses an identical
process for reading and writing files...

    /*
     * If this file is of type TEXT, swap \015 to \012.
     */
    if (xlate) {
        for ( p = rbuf, q = p + rbuflen; p < q; p++ ) {
            if ( *p == '\015' ) {
                *p = '\012';
            } else if ( *p == '\012' ) {
                *p = '\015';
            }
        }
    }

I hope you can all see what this code is doing.  In case you can't
I'll spell it out....

It goes through the buffer of data to be written or having been read,
if it finds a return ('\015') it turns it into a linefeed ('\012'),
otherwise if it finds a linefeed it turns it into a return.  The exact
same thing for both reading and writing.  It can only do this if the
transformation is symmetric.

Frankly I'm surprised at the number of people who are confused on this
matter.  I'm not a newbie to netatalk.  I've been using it since around
version 1.3.3.  I actually know what I'm talking about here.

So, once more I'll repeat it.  The netatalk cr/lf code worked very
well until MacOS 8 came out.  Then the way the Finder copies file
causes it not to work correctly.  It'd be nice if this could be fixed.
If you don't like the code, fine - it is off by default.  Please stop
trying to tell me I don't want the feature at all.  I really, really,
really do.

Later today or tomorrow I'll post a slightly revised method of making
this stuff work.  I'll be happy to receive constructive criticism on
that.

Cheers,

Duncan.

---

From: Carsten Neumann <[email-masked]>
Date: Sat, 10 Feb 2001 19:55:30 +0100

>             } else if ( *p == '\012' ) {

I'm really glad to see that netatalk does it the way I would do, you obviously would do, and I
suspected netatalk would do it.

So many people with so much guessledge... ;-)

Regards

	Carsten

---

From: Donald Lee <[email-masked]>
Date: Sat, 10 Feb 2001 13:45:10 -0600

>wrong, please do the research first!

My apologies.  This is symmetric and reversible, although a little odd. ;->

I still don't see a way to reliably determine the actual type of the data,
but as long as the transformation is reversible, no irreparable harm can
be done by it.  This information changes the feature from being dangerous to
being questionable.   Questionable features are appropriate as options for
those who have a need.

As atonement for not doing my homework I will go and reexamine some 
data files that I had heretofore considered lost due to this transformation
and report back to this list if it is truly reversible (at which
point I will be very happy).

-dgl-