Tuesday, November 13, 2007

For CVS command-line junkies: /CVSROOTccess in cygwin

Eclipse is the de-facto standard IDE at my company, and I've been gradually becoming more and more comfortable with it as I go along. I've noticed, though, that I couldn't work any of my old-school CVS command-line magic in a Cygwin shell with projects checked out using Eclipse's "New Project from CVS" tool.

When I tried a CVS command from within a Cygwin shell, I'd typically see the following:

/CVSROOTccess /usr/local/cvs/repository
No such file or directory

As it turns out, it's apparently the age-old CR-LF vs LF newline discrepancy between Windows and UNIX at work again. There's a relatively simple fix, pointed out at the very first Google hit for "/CVSROOTccess", over at Whitesquare Software's blog. I found the method described in the comments to be most efficient:

find . -name Root -or -name Entries -or -name Repository | xargs dos2unix

Issue that command from the top directory of your CVS project, and you'll clear up all the problems. I haven't yet tested it, but I suspect that newly created CVS directories will end up with the same problem and this command will have to be issued again.

On a related note, the same issue cropped up in some bash scripts on the same project with even more cryptic errors:
./setuptree.sh: line 14: $'\r': command not found
./setuptree.sh: line 37: syntax error: unexpected end of file

Again, the solution is the same; run 'dos2unix' on those bad boys, and you'll be right as rain.