[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: ^M Appends to every line?

From: David Chapman <dcchapman_at_acm.org>
Date: Wed, 23 Feb 2011 17:48:46 -0800

On 2/23/2011 4:44 PM, Nico Kadel-Garcia wrote:
> On Wed, Feb 23, 2011 at 11:39 AM, Les Mikesell<lesmikesell_at_gmail.com> wrote:
>> On 2/23/2011 10:19 AM, Christopher D Haakinson wrote:
>>> I have SVN up and running and things are working well, except when
>>> editing shell scripts from windows.
>>> My server is RHEL5-based and I will have clients connecting from linux
>>> and windows. Linux commits work great, and even some times from windows.
>>> However some times I commit a file from Windows(running tortoiseSVN and
>>> Komodo EDIT) it corrupts the script and adds ^M to the end of every
>>> line, often times ruining the structure of the file too.
>>> Is there a way to disable this or do I have to run a dos2unix script
>>> after every commit to remove them?
>> Long version:
>> http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.advanced.props.file-portability
>> Short version: set the svn:eol-style property to native on the files where
>> you want subversion to manage line endings. Your client may have a list of
>> file suffixes where this would be set automatically.
> But in general, avoid it. If you're in a mixed platform environment,
> and you are tweaking files back and forth in end-of-line settings when
> you check them out in UNIX versis checking them out in Windows, you
> are in for a *world* of hurt. This is a source of enormous confusion
> for programmers when it works right, on one system, but not on the
> other due to local re-writing.
> If you're on the UNIX or Linux sides, the "dos2unix" and "unix2dos"
> utilities are available with almost every distribution. For Windows,
> there are other tools, including the same tools under CygWin.

Uh, no. Use of "svn:eol-style" avoids a world of hurt - programmers do
not have to run a script *every* time they check out a file. Requiring
users to run a script to fix line endings in every sandbox is a recipe
for disaster.

"dos2unix" and "unix2dos" are precisely the kind of local rewriting you
want to avoid.

My two cents (and one million lines of code) worth...

     David Chapman         dcchapman_at_acm.org
     Chapman Consulting -- San Jose, CA
Received on 2011-02-24 02:49:39 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.