Re: ^M Appends to every line?

2011-02-26 Thread Blair Zajac

On 2/24/2011 8:02 AM, Christopher D Haakinson wrote:

OK, so I've been testing out the svn:eol-style prop and it appears to
work, but it seems like an awful lot of work for such a simple issue.

Is there something server-side I can setup to ensure that all files
contain the correct eol style?


As others have said, you can use a pre-commit script to check the files.

If you have a number of files already checked in that you want to update 
their properties, you can use the svn_apply_autoprops.py script that I 
wrote a while back on a working copy to fix up everything in one commit:


http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svn_apply_autoprops.py

Regards,
Blair


Re: ^M Appends to every line?

2011-02-25 Thread David Weintraub
On Thu, Feb 24, 2011 at 12:55 PM, Christopher D Haakinson 
cdhaa...@us.ibm.com wrote:

 2) I copy this entire script from notepad in windows into a new file named
 test2.sh, also in notepad.

The guy who wrote Notepad and had them put it on Windows as a text editor
should be shot, hung, and then shot again. Then, stampeded by a bunch of
wild horses, and for good measure shot again.

As you can tell, I have a strong opinion of Notepad.

Notepad is NOT A PROGRAM EDITOR. Yes, I was shouting. Sorry about that,
after 15 years of Windows and having developers use it as their program
editor, I get a little tense sometimes.

Notepad is not a program editor. Nothing will mess up a program quicker than
Notepad. It mucks up line endings, changes Unicode characters, and will mess
up the end of file. The developers in my organization know not to use
Notepad or face the Wrath of Dave.

There are tons of freeware program editors out there, and there's just no
excuse for anyone who is involved in development to use Notepad. VIM is
great (http://www.vi.org) -- if you're a VI fanboy. I happen to be one. I
have yet found a program editor that is as fast as VI. VIM adds all sorts of
goodies to VI including automatic syntax indentations and syntax
highlighting. It is not the easiest editor to use (it can take months to
learn all of its ins and outs), but once you learn it, it's the best.

For those who want something a bit more GUI oriented, there's ScitTE (
http://www.scintilla.org/SciTE.html). And a great Notepad replacement is
Notepad++ (http://notepad-plus-plus.org/). It provides a very similar
looking Notepad like interface, but understands line and file endings.

-- 
David Weintraub
qazw...@gmail.com


Re: ^M Appends to every line?

2011-02-25 Thread Andy Levy
On Fri, Feb 25, 2011 at 12:08, David Weintraub qazw...@gmail.com wrote:

 For those who want something a bit more GUI oriented, there's ScitTE
 (http://www.scintilla.org/SciTE.html). And a great Notepad replacement is
 Notepad++ (http://notepad-plus-plus.org/). It provides a very similar
 looking Notepad like interface, but understands line and file endings.

FYI Notepad++  SciTE use the same text editor component (or at least
last I checked they did); they're just different
shells/wrappers/features bolted on. Not saying that's bad; on the
contrary, it means that it's been checked  tested twice as much.

I used to swear by SciTE, now I've switched to Notepad++ (but I keep
both installed, for different features).


Re: ^M Appends to every line?

2011-02-24 Thread Christopher D Haakinson

OK, so I've been testing out the svn:eol-style prop and it appears to work,
but it seems like an awful lot of work for such a simple issue.

Is there something server-side I can setup to ensure that all files contain
the correct eol style?


Also I've noticed that my shell scripts are now failing with an EOF error?
Does this mean that there's a style setting for the end of file too??




|
| From:  |
|
  
|
  |Ryan Schmidt subversion-20...@ryandesign.com   
   |
  
|
|
| To:|
|
  
|
  |David Chapman dcchap...@acm.org
   |
  
|
|
| Cc:|
|
  
|
  |Nico Kadel-Garcia nka...@gmail.com, users@subversion.apache.org
   |
  
|
|
| Date:  |
|
  
|
  |02/23/2011 09:04 PM  
   |
  
|
|
| Subject:   |
|
  
|
  |Re: ^M Appends to every line?
   |
  
|





On Feb 23, 2011, at 19:48, David Chapman wrote:
 On 2/23/2011 4:44 PM, Nico Kadel-Garcia wrote:
 On Wed, Feb 23, 2011 at 11:39 AM, Les Mikesell wrote:
 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.


Some have the view that setting svn:eol-style to native is a problem;
perhaps that's what Nico meant. Certainly, it would be a problem (wouldn't
work as designed) if you check out a working copy on a platform with one
eol convention (e.g. Mac OS X) and move that working copy to an OS with a
different eol convention (e.g. Windows). If that is something you plan to
do, the alternative is to still use svn:eol-style but set it to a specific
eol style instead -- for example LF. Then you would have to configure all
your editors on all platforms to use that line ending style.*

* Actually it does not matter if the editor decided, for example, to
completely convert the file from, say, LF to CRLF line endings. On commit,
your Subversion client would notice the change and convert it back to just
LF before submitting it to the repository. The situation Subversion won't
handle for you

Re: ^M Appends to every line?

2011-02-24 Thread David Chapman

On 2/24/2011 8:02 AM, Christopher D Haakinson wrote:


OK, so I've been testing out the svn:eol-style prop and it appears to 
work, but it seems like an awful lot of work for such a simple issue.


Is there something server-side I can setup to ensure that all files 
contain the correct eol style?



Also I've noticed that my shell scripts are now failing with an EOF 
error? Does this mean that there's a style setting for the end of file 
too??






You can define a pre-commit hook script that looks at the file name and 
then verifies the property is present.  These are described in the 
Subversion book.


Multi-platform work is an awful lot of work; it is not as simple as it 
seems.  Heuristics to determine whether a file is plain text can fail, 
with catastrophic results.  File transfers done carelessly will corrupt 
binary files; in integrated circuit design the OASIS geometry file 
format has an almost text string defined solely to catch this error.  
If you try to use the same text files across platforms, things will fail 
unless *every* tool you use - all editors, all file analysis software, 
all file transfer programs - deals with mixed or wrong platform line 
ending styles properly.  This is a high standard that has never been met 
in my experience.


I haven't seen script errors related to end of file; Windows no longer 
puts a ^Z at the end of files, so you shouldn't need to strip that out.  
Have you done an octal dump of the scripts to see what is at the end of 
the files?  On which platform are they failing - Windows or Linux?


--
David Chapman dcchap...@acm.org
Chapman Consulting -- San Jose, CA



Re: ^M Appends to every line?

2011-02-24 Thread Les Mikesell

On 2/24/2011 10:02 AM, Christopher D Haakinson wrote:

OK, so I've been testing out the svn:eol-style prop and it appears to
work, but it seems like an awful lot of work for such a simple issue.

Is there something server-side I can setup to ensure that all files
contain the correct eol style?


No, the server can't possibly know what is right either for any 
particular file or for any particular client platform.  But, your client 
configs control auto-props which can sometimes do the right thing 
automatically on the client side.  Unfortunately those have to match 
filename patterns that won't necessarily correspond to the file content 
or use.



Also I've noticed that my shell scripts are now failing with an EOF
error? Does this mean that there's a style setting for the end of file too??


No, that probably is related to some other error or parsing issue in the 
file.


--
  Les Mikesell
lesmikes...@gmail.com


Re: ^M Appends to every line?

2011-02-24 Thread Christopher D Haakinson

Linux is the final home for these scripts. Currently I'm still in testing
mode, so the shell script I am trying is very simple, only a few lines with
a while loop, which is why I thought there may be something like
svn:eof-style to handle the EOF properly too..


|
| From:  |
|
  
|
  |David Chapman dcchap...@acm.org
   |
  
|
|
| To:|
|
  
|
  |Christopher D Haakinson/Raleigh/IBM@IBMUS
   |
  
|
|
| Cc:|
|
  
|
  |Ryan Schmidt subversion-20...@ryandesign.com, users@subversion.apache.org  
   |
  
|
|
| Date:  |
|
  
|
  |02/24/2011 11:22 AM  
   |
  
|
|
| Subject:   |
|
  
|
  |Re: ^M Appends to every line?
   |
  
|





On 2/24/2011 8:02 AM, Christopher D Haakinson wrote:

 OK, so I've been testing out the svn:eol-style prop and it appears to
 work, but it seems like an awful lot of work for such a simple issue.

 Is there something server-side I can setup to ensure that all files
 contain the correct eol style?


 Also I've noticed that my shell scripts are now failing with an EOF
 error? Does this mean that there's a style setting for the end of file
 too??




You can define a pre-commit hook script that looks at the file name and
then verifies the property is present.  These are described in the
Subversion book.

Multi-platform work is an awful lot of work; it is not as simple as it
seems.  Heuristics to determine whether a file is plain text can fail,
with catastrophic results.  File transfers done carelessly will corrupt
binary files; in integrated circuit design the OASIS geometry file
format has an almost text string defined solely to catch this error.
If you try to use the same text files across platforms, things will fail
unless *every* tool you use - all editors, all file analysis software,
all file transfer programs - deals with mixed or wrong platform line
ending styles properly.  This is a high standard that has never been met
in my experience.

I haven't seen script errors related to end of file; Windows no longer
puts a ^Z at the end of files, so you shouldn't need to strip that out.
Have you done an octal dump of the scripts to see what is at the end of
the files?  On which platform are they failing - Windows or Linux?

--
 David Chapman dcchap...@acm.org
 Chapman Consulting -- San Jose, CA


inline: graycol.gifinline: ecblank.gif

Re: ^M Appends to every line?

2011-02-24 Thread Christopher D Haakinson

I'd like someone to explain how this small shell script, which works fine,
gets corrupted simply by creating a new file and copy/pasting the text in
it. Here's what I'm doing:

1) I have a test shell script that runs fine. Here's the content:
- start
lock=/tmp/deleteme
if [ -f $lock ]
then
echo Lock file exists. Wait until it's gone to proceed. .
while [ -f $lock ]
do
echo Waiting for lockfile to be removed. .
sleep 1s
done
echo Now creating lock file
echo locked  $lock
else
echo No lock file found. Creating it. .
echo locked  $lock
fi
echo Lets try this again, hopefully for the last time
exit 0
-- end

2) I copy this entire script from notepad in windows into a new file named
test2.sh, also in notepad.
3) Using TortoiseSVN, I add test2.sh into my project
4) I commit the changes to the server
5) On my linux server, I run:  svn update  ... to get the test2.sh file
6) Now when I try to run it I get this:
syntax error: unexpected end of file


Now, this is the most simple task I could think of doing, and this doesn't
work. I've also tried creating the new shell script with Komodo EDIT with
the same results.

This occurs even though I've tried adding svn:eol-style from both my linux
server and my windows wrx... I'm lost!!



|
| From:  |
|
  
|
  |Les Mikesell lesmikes...@gmail.com 
   |
  
|
|
| To:|
|
  
|
  |users@subversion.apache.org  
   |
  
|
|
| Date:  |
|
  
|
  |02/24/2011 11:27 AM  
   |
  
|
|
| Subject:   |
|
  
|
  |Re: ^M Appends to every line?
   |
  
|





On 2/24/2011 10:02 AM, Christopher D Haakinson wrote:
 OK, so I've been testing out the svn:eol-style prop and it appears to
 work, but it seems like an awful lot of work for such a simple issue.

 Is there something server-side I can setup to ensure that all files
 contain the correct eol style?

No, the server can't possibly know what is right either for any
particular file or for any particular client platform.  But, your client
configs control auto-props which can sometimes do the right thing
automatically on the client side.  Unfortunately those have to match
filename patterns that won't necessarily correspond to the file content
or use.

 Also I've noticed that my shell scripts are now failing with an EOF
 error? Does this mean that there's a style setting for the end of file
too??

No, that probably is related to some other error or parsing issue in the
file.

--
   Les Mikesell
 lesmikes...@gmail.com

inline: graycol.gifinline: ecblank.gif

Re: ^M Appends to every line?

2011-02-24 Thread David Chapman

On 2/24/2011 9:55 AM, Christopher D Haakinson wrote:


I'd like someone to explain how this small shell script, which works 
fine, gets corrupted simply by creating a new file and copy/pasting 
the text in it. Here's what I'm doing:


1) I have a test shell script that runs fine. Here's the content:
- start
lock=/tmp/deleteme
if [ -f $lock ]
then
echo Lock file exists. Wait until it's gone to proceed. .
while [ -f $lock ]
do
echo Waiting for lockfile to be removed. .
sleep 1s
done
echo Now creating lock file
echo locked  $lock
else
echo No lock file found. Creating it. .
echo locked  $lock
fi
echo Lets try this again, hopefully for the last time
exit 0
-- end

2) I copy this entire script from notepad in windows into a new file 
named test2.sh, also in notepad.

3) Using TortoiseSVN, I add test2.sh into my project
4) I commit the changes to the server
5) On my linux server, I run: svn update ... to get the test2.sh file
6) Now when I try to run it I get this:
syntax error: unexpected end of file


Now, this is the most simple task I could think of doing, and this 
doesn't work. I've also tried creating the new shell script with 
Komodo EDIT with the same results.


This occurs even though I've tried adding svn:eol-style from both my 
linux server and my windows wrx... I'm lost!!




In Notepad, can you move your cursor below the last line of text in the 
file?  If not, there won't be a newline after the final line.  Under 
Linux, try od -c test2.sh | more and verify that there is a \n at 
the very end of the listing.  If not, you'll need to add one in Notepad, 
Komodo, or your favorite Linux editor.


I have no idea why you would see this problem only with svn:eol-style 
defined (if in fact this is the problem).


--
David Chapman dcchap...@acm.org
Chapman Consulting -- San Jose, CA



Re: ^M Appends to every line?

2011-02-24 Thread Christopher D Haakinson

It's possible that the eol-style has nothing to do with this, because
before I added the style, my script was still failing and complaining about
the EOF as well as EOL errors...

Running your od command yields the following on the last 3 lines:
620   s   t   t   i   m   e   .   .   .   . \r  \n  \r  \n
640  \r  \n   e   x   i   t   0
650

so it is missing \n ...

I opened the file in notepad and added a couple blank lines under my exit 0
and it worked!! How weird is that?

Thanks for your help! It's been much appreciated.


|
| From:  |
|
  
-|
  |David Chapman dcchap...@acm.org
|
  
-|
|
| To:|
|
  
-|
  |Christopher D Haakinson/Raleigh/IBM@IBMUS
|
  
-|
|
| Cc:|
|
  
-|
  |users@subversion.apache.org  
|
  
-|
|
| Date:  |
|
  
-|
  |02/24/2011 01:28 PM  
|
  
-|
|
| Subject:   |
|
  
-|
  |Re: ^M Appends to every line?
|
  
-|





On 2/24/2011 9:55 AM, Christopher D Haakinson wrote:

 I'd like someone to explain how this small shell script, which works
 fine, gets corrupted simply by creating a new file and copy/pasting
 the text in it. Here's what I'm doing:

 1) I have a test shell script that runs fine. Here's the content:
 - start
 lock=/tmp/deleteme
 if [ -f $lock ]
 then
 echo Lock file exists. Wait until it's gone to proceed. .
 while [ -f $lock ]
 do
 echo Waiting for lockfile to be removed. .
 sleep 1s
 done
 echo Now creating lock file
 echo locked  $lock
 else
 echo No lock file found. Creating it. .
 echo locked  $lock
 fi
 echo Lets try this again, hopefully for the last time
 exit 0
 -- end

 2) I copy this entire script from notepad in windows into a new file
 named test2.sh, also in notepad.
 3) Using TortoiseSVN, I add test2.sh into my project
 4) I commit the changes to the server
 5) On my linux server, I run: svn update ... to get the test2.sh file
 6) Now when I try to run it I get this:
 syntax error: unexpected end of file


 Now, this is the most simple task I could think of doing, and this
 doesn't work. I've also tried creating the new shell script with
 Komodo EDIT with the same results.

 This occurs even though I've tried adding svn:eol-style from both my
 linux server and my windows wrx... I'm lost!!


In Notepad, can you move your cursor below the last line of text in the
file?  If not, there won't be a newline after the final line.  Under
Linux, try od -c test2.sh | more and verify that there is a \n at
the very end of the listing.  If not, you'll need to add one in Notepad,
Komodo, or your favorite Linux editor.

I have no idea why you would see this problem only with svn:eol-style
defined (if in fact this is the problem).

--
 David Chapman dcchap...@acm.org
 Chapman Consulting -- San Jose, CA


inline: graycol.gifinline: ecblank.gif

Re: ^M Appends to every line?

2011-02-24 Thread Ryan Schmidt

On Feb 24, 2011, at 12:44, Christopher D Haakinson wrote:

 I opened the file in notepad and added a couple blank lines under my exit 0 
 and it worked!! How weird is that?

Sounds normal to me. I text file is not a text file, according to UNIX 
definitions, if it does not end with a newline.




Re: ^M Appends to every line?

2011-02-23 Thread David Chapman

On 2/23/2011 8: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?




Look up propset and eol-style.   In particular, in the [auto-props] 
section of my configuration file I have a number of lines of the form


*.c = svn:eol-style=native
*.txt = svn:eol-style=native
*.pl = svn:eol-style=native;svn:executable

I do this both in Windows and in Linux so that I don't have files with 
only ^J when I check them out under Windows.


You can also add this property manually after the files are committed:

svn propset svn:eol-style=native file1 file2 ...

Since you are seeing ^M now, you will need to do this manually for the 
affected files.


Other useful commands:

svn proplist file
svn propget svn:eol-style file

where file is the name of the file you are looking at.

--
David Chapman dcchap...@acm.org
Chapman Consulting -- San Jose, CA



Re: ^M Appends to every line?

2011-02-23 Thread David Chapman

On 2/23/2011 4:44 PM, Nico Kadel-Garcia wrote:

On Wed, Feb 23, 2011 at 11:39 AM, Les Mikeselllesmikes...@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 dcchap...@acm.org
Chapman Consulting -- San Jose, CA



Re: ^M Appends to every line?

2011-02-23 Thread David Weintraub
As others have mentioned, you need to set svn:eol-style on files that
MUST have particular line endings. For example, shell scripts and
Makefiles MUST have Unix line endings. DOS Batch files MUST have
Windows line endings.

You might need to check everything out, clean it up, and set the
property on it. I have a pre-commit hook and one of the things you can
do is to force users to set a property to a particular value on
specified files. If the property isn't on the file, you can't commit
the change. You can get it from here: http://db.tt/H3o1i7S.

If you're using Ant,  take a look at the FixCRNL task when you do your builds.

On Wed, Feb 23, 2011 at 11:19 AM, Christopher D Haakinson
cdhaa...@us.ibm.com 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?



-- 
David Weintraub
qazw...@gmail.com


Re: ^M Appends to every line?

2011-02-23 Thread Nico Kadel-Garcia
On Wed, Feb 23, 2011 at 8:48 PM, David Chapman dcchap...@acm.org wrote:
 On 2/23/2011 4:44 PM, Nico Kadel-Garcia wrote:

 On Wed, Feb 23, 2011 at 11:39 AM, Les Mikeselllesmikes...@gmail.com

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

Not when the same working working copy is accessible from both Linux
or UNIX, and Windows, as is commonplace in a mixed platform
environment. If your working copies on each platform are distinct, you
should be able to get away with it. But hit the same checked out
Windows repository with TortoiseSVN and CygWin, and suddenly you're in
a world of hurt again with the non-binary handling of EOL. Some text
editors will autoparse it for you, but it can get extremely nasty, and
I've had to clean up some serious messes this way.

The messes are aggravated by the lack of the obliterate function, to
entirely strip out erroneously configured file additions, and the
difficulty running diff operations against files that have been
stored and had their EOL settings updated and their contents revised.
It really messes with svn diff operations before and after the
change.


Re: ^M Appends to every line?

2011-02-23 Thread Ryan Schmidt
On Feb 23, 2011, at 19:48, David Chapman wrote:
 On 2/23/2011 4:44 PM, Nico Kadel-Garcia wrote:
 On Wed, Feb 23, 2011 at 11:39 AM, Les Mikesell wrote:
 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.


Some have the view that setting svn:eol-style to native is a problem; perhaps 
that's what Nico meant. Certainly, it would be a problem (wouldn't work as 
designed) if you check out a working copy on a platform with one eol convention 
(e.g. Mac OS X) and move that working copy to an OS with a different eol 
convention (e.g. Windows). If that is something you plan to do, the alternative 
is to still use svn:eol-style but set it to a specific eol style instead -- for 
example LF. Then you would have to configure all your editors on all platforms 
to use that line ending style.*

* Actually it does not matter if the editor decided, for example, to completely 
convert the file from, say, LF to CRLF line endings. On commit, your Subversion 
client would notice the change and convert it back to just LF before submitting 
it to the repository. The situation Subversion won't handle for you, and will 
abort the commit with an error message, is if your editor decides to save a 
file with mixed line endings. Such editors are broken IMHO. UltraEdit is an 
example of an editor we used which was broken in this way, unless you 
remembered to change a particular preference setting.

NOT using svn:eol-style at all will remove all eol checks that Subversion does, 
and if you are using multiple editors on multiple platforms, you will most 
probably end up with files of mixed line ending styles. THAT is a recipe for 
disaster.




Re: ^M Appends to every line?

2011-02-23 Thread Les Mikesell

On 2/23/11 8:03 PM, Nico Kadel-Garcia wrote:

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


Not when the same working working copy is accessible from both Linux
or UNIX, and Windows, as is commonplace in a mixed platform
environment.


There are lots of ways to cause trouble. My opinion is that if it hurts, don't 
do it.  And that will hurt.



If your working copies on each platform are distinct, you
should be able to get away with it. But hit the same checked out
Windows repository with TortoiseSVN and CygWin, and suddenly you're in
a world of hurt again with the non-binary handling of EOL. Some text
editors will autoparse it for you, but it can get extremely nasty, and
I've had to clean up some serious messes this way.


More things that hurt - and to avoid.  But setting eol-style native and using 
normal, native tools on each OS isn't one of them.




The messes are aggravated by the lack of the obliterate function, to
entirely strip out erroneously configured file additions, and the
difficulty running diff operations against files that have been
stored and had their EOL settings updated and their contents revised.
It really messes with svn diff operations before and after the
change.


Any time you use dos2unix or the like it is going to be a change in every line 
and will screw up any concept of version differences.   If svn does it 
internally, you don't have that problem.


--
   Les Mikesell
lesmikes...@gmail.com



Re: ^M Appends to every line?

2011-02-23 Thread Tony Butt
On Wed, 2011-02-23 at 20:03 -0600, Ryan Schmidt wrote:
 On Feb 23, 2011, at 19:48, David Chapman wrote:
  On 2/23/2011 4:44 PM, Nico Kadel-Garcia wrote:
  On Wed, Feb 23, 2011 at 11:39 AM, Les Mikesell wrote:
  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.
 
 
 Some have the view that setting svn:eol-style to native is a problem; perhaps 
 that's what Nico meant. Certainly, it would be a problem (wouldn't work as 
 designed) if you check out a working copy on a platform with one eol 
 convention (e.g. Mac OS X) and move that working copy to an OS with a 
 different eol convention (e.g. Windows). If that is something you plan to do, 
 the alternative is to still use svn:eol-style but set it to a specific eol 
 style instead -- for example LF. Then you would have to configure all your 
 editors on all platforms to use that line ending style.*
 
 * Actually it does not matter if the editor decided, for example, to 
 completely convert the file from, say, LF to CRLF line endings. On commit, 
 your Subversion client would notice the change and convert it back to just LF 
 before submitting it to the repository. The situation Subversion won't handle 
 for you, and will abort the commit with an error message, is if your editor 
 decides to save a file with mixed line endings. Such editors are broken IMHO. 
 UltraEdit is an example of an editor we used which was broken in this way, 
 unless you remembered to change a particular preference setting.
Another example is emacs (the one true ring (um) editor). But only if
there were mixed line endings to begin with.
 
 NOT using svn:eol-style at all will remove all eol checks that Subversion 
 does, and if you are using multiple editors on multiple platforms, you will 
 most probably end up with files of mixed line ending styles. THAT is a recipe 
 for disaster.
 
I have in the past tried to use a smb exported share form a unix box on
a windows client. Don't do that, nothing but trouble.
 

-- 
Tony Butt tony.b...@cea.com.au
CEA Technologies