[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: line endings in text files and -kb

From: Todd Denniston
Subject: Re: line endings in text files and -kb
Date: Thu, 11 Sep 2008 16:13:55 -0400
User-agent: Thunderbird (X11/20080707)

Ittay Dror wrote, On 09/11/2008 01:39 PM:
Todd Denniston wrote:
Ittay Dror wrote, On 09/11/2008 12:14 PM:
Larry Jones wrote:
Ittay Dror writes:

On windows, are you using cvs under cygwin or CVSNT?
turtoise cvs

which IIRC means you are using CVSNT as your client.

windows programs interpret text files different than Unix programs interpret text files, and cvs knows how and when to do the translation of text files, that it has not been told are binary. Usually folks WANT the translation, that is why good ftp clients let you tell them you are transferring text files so that the client and server can negotiate any needed translation.
ok, but in this case i'm not editing the file, i'm just moving it around to create a product tree. someone else edited it and committed and the build just so happens to run on windows. also, afaik, most windows ides (outside of notepad) know how to handle just \n today.

Here is the clue...
First rule of using any version control tool: DO NOT DO THINGS BEHIND THE TOOL'S BACK!

"moving" a file around is almost always doing something behind the the tool's back.

if you want a file on a machine/in a tree, then check that file out of CVS where you want it, and definitely don't put a moved file back into CVS.

when working on files, that you have an intention of committing back into a version control system,
* always do the checkouts so you get the sandbox you want.
* always do the checkout on the OS you intend to work on.
* do not contaminate the sandbox. (don't copy from other sandboxes, don't update while having an editor's buffer open...)
* let the version control tool manage the line endings.
* bend and break these rules only with an understanding of the implications, and the ability to be happy when you are left holding the broken chunks.

i don't. i want to prevent CVS from converting line endings. the file is checked out in windows but is later used in linux (it is part of a product build), but because CVS converts line endings, i get a '/bin/bash^M: bad
interpreter error'

That's not CVS's fault.  If you want to use the file on Linux, you
oh, it is, because cvs decided to change the file without giving me a reasonable way to tell it not to.

Quite the opposite, YOU told cvs (via -kb) not to change the file, and it obeyed, i.e., you added the file with -kb and then committed it from MS, and on MS the file contained "/bin/bash^M", and because of the -kb, cvs on Linux gave you EXACTLY the file committed on the MS machine which contains "/bin/bash^M"
what happened is this:
- there was no -kb
- a developer checks out the source tree and works with it, making some changes to .c files - not touching the file in question. the file is a startup script for a daemon
- the build is ok on windows, so now he wants to check it is ok on linux
  - we don't want him to commit in order to test.

OK, IMHO you have a problem in your process(es).
Either you should have had the developer work on his/her own branch, so they could keep their tested state under control while not affecting anyone else's tree, or you should have helped the developer understand that when cross mounting a directory that the developer had to be extremely mindful of the network file-system's propensity to carry line ending translations.

in other words, if you are not an anal file-transport expert, then don't do that. Use cvs instead.

- so, he mounts the source tree from a linux machine and runs the build
 - this copies the file to the output of the build
- he wants to test the daemon, so he runs the startup script (the file in question)
--> this fails. the file was checked out in windows, so now it has ^M

there is now the option to mark the file with -kb, thus solving the issue above, but merging will not work

IMHO, bad technical solution to a process failure, because the solution will in the end cause more problems of the type you are now dealing with. I suggest: Change the process to allow/suggest/direct the developer to make/use his|her own branch when they need to work on both OS's and are currently not allowed, by process, to commit to the trunk|main branch.

I have had to do this, make my own side branch, myself several times recently because I was doing development and the rest of the project was making a release/test event. Word of warning: branch the WHOLE repository, because if you don't you will likely regret it later.

yes, it is the developer's responsibility to commit after dos2unix. in any case, even if he forgets, it is easy to fix (checkout, remove, commit)
Assuming all your files that are to be ran on Unix are in one part of the tree, you could setup a commitinfo script to ERROR out if they detect the dev forgetting, and go back to not using -kb. And although you can modify the file on it's way to the repository, you should search the history of this list and find out that many of the folks who did eventually cried about the chunks left in their hands.

Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter

reply via email to

[Prev in Thread] Current Thread [Next in Thread]