delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/12/20/11:30:56

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_46
X-Spam-Check-By: sourceware.org
Date: Sat, 20 Dec 2008 17:29:34 +0100
From: Spiro Trikaliotis <an-cygwin AT spiro DOT trikaliotis DOT net>
To: cygwin AT cygwin DOT com
Message-ID: <20081220162934.GY14886@trikaliotis.net>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <877i5wlwc3 DOT fsf AT mcbain DOT luannocracy DOT com> <20081219090531 DOT GV14886 AT trikaliotis DOT net> <EF7F2E5833CC4B5C8D8003C4A8F5DD7A AT DFW5RB41>
MIME-Version: 1.0
In-Reply-To: <EF7F2E5833CC4B5C8D8003C4A8F5DD7A@DFW5RB41>
User-Agent: Mutt/1.5.17+20080114 (2008-01-14)
X-SA-Exim-Connect-IP: 87.163.248.253
X-SA-Exim-Mail-From: an-cygwin AT spiro DOT trikaliotis DOT net
Subject: Re: Rationale for line-ending recommendation?
X-SA-Exim-Version: 4.2.1 (built Tue, 09 Jan 2007 17:23:22 +0000)
X-SA-Exim-Scanned: Yes (on mail.trikaliotis.net)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hello Gary,

* On Fri, Dec 19, 2008 at 03:42:34AM -0600 Gary R. Van Sickle wrote:
> > From: Spiro Trikaliotis
[...]
> > Oh, and Subversion is problematic, too. Because the SVN 
> > developers decided to handle line endings on their own using 
> > libapr, opening files in binary mode and reading and writing 
> > CR, LF or CR/LF on their own,
> 
> This is the right way to do things...

I hope you are ironic here, right?

> > on Cygwin, SVN is hard-coded to 
> > *nix line endings. This is not nice. Note that this approach 
> > will also fail badly if you mount parts of your system in 
> > textmode, and parts in binmode.
> > 
> > Because of this, I am using an SVN version which I compiled 
> > myself with a patched libapr.
> > 
> 
> ...I'm not following this.  Are you talking about the SVN repository, or the
> clients, or...?  What's the issue?

You are right, I was not specific enough. I never tested an SVN server
on Cygwin, thus, I can only talk about the client side.

If you check out some files which are set to CRLF=native, Cygwin's SVN
checks them out with LF line ending (as SVN handles the endings on its
own, and libapr tells it that Cygwin == Unixoid == LF).

Now, if you edit a file of this using some tool that
1. does not have problems with the LF endings, but
2. generates CR/LF endings on new lines
(like, for example, MSVC does, but also some other tools)

then SVN cannot check in that file. It complains that the file has
"mixed line endings". Yes, that's right, but why does SVN care?

Even commands like "svn diff" behave erratically.

You have to use d2u in order to get this file checked in. This is really
annoying.

Note: In my opinion, this is clearly an SVN/libapr problem, not a Cygwin
problem.

> I know CVS had some problems with the
> dreaded \n/\r\n issue back in the day, but I wasn't aware of similar
> Subversion issues.

The CVS issue was a mere cosmetical one, while the SVN one is a real
show-stopper, IMHO.

> > Other than that, I never had any problems with the CR/LF line endings.
> 
> Bash has some known problems in this area, but there's a Cygwin-specific fix
> (that unfortunately is off by default) which hopefully will get accepted
> upstream sometime in the next century.

But this fix is in bash, right? So, it does not have a CR/LF issue in
Cygwin, as I said. ;)

> > Thus, many programmers do not care about the "right" mode.
> 
> Well, better stated, they assume they can treat all files - text,
> executables, jpegs, whatever - as if they were Unix-formatted text files.
> Of course, they're not, hence problems ensue.

Well, it is hard to test something against problems that are unlikely to
occur at all in your environment, right? Of course, you can generate
artificial test cases for this. However, if you think about generating
these test cases, chances are high you would not do it wrong in the
first place.

Thus, while I think it is annoying that some tools have CR/LF problems,
I can understand WHY this happens.

Best regards,
Spiro.

-- 
Spiro R. Trikaliotis                              http://opencbm.sf.net/
http://www.trikaliotis.net/                     http://www.viceteam.org/

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019