« JXTA v Jabber continued | Main | Martin Fowler: MultipleCanonicalModels and messaging integration »

A fix for Cygwin and CVS linefeeds

Here's something that came up in work, and a workaround.

If you check in a file with dos line endings (\\r\\n) from the given Cygwin CVS client, it will not convert the dos line feed to Unix (\\n). That means the file is stored in the repository with bad line endings which hurts both CVS diffing and possibly any non Windows users.

I suspect this is because the CVS cygwin client has no idea it's running on Windows (that's strong encapsulation for you) and assumes no conversion is neccessary. In any case it's not what you want to happen.

To get around this in a way that will let use a command interface to CVS, you need to do two things:

  1. Install WinCVS if haven't already and add it's command line client, cvs,exe, to your PATH. For example, mine is in E:\gnu\WinCvs 1.3\CVSNT.
  2. Uninstall the CVS client from Cygwin. Cygwin seems to pick up its own CVS first regardless of how you organize your Windows path. Do this this through Cygwin's setup.exe.

To test you're using the right client for your OS, fire up a bash shell and type

  cvs -version | grep CVSNT

you should see a match, something like this:

  Concurrent Versions System (CVSNT) 2.0.2 (client/server)
  CVSNT version (Apr 16 2003) Copyright (c) 1999-2003 Tony Hoyle and others

Later: from Matt Quail:

We have this problem too. But I've had cygwin-CVS work fine for me now so long as I do either of the following:

  1. store .java files in the file system using DOS line endings, and have my drives mounted textmode
  2. store the .java files in the file system using UNIX line endings, and have my drives mounted binmode.

see the cygwin "mount" command for mount modes, mine are:

  c: on /cygdrive/c type user (binmode,noumount)
  d: on /cygdrive/d type user (binmode,noumount)

And if the files on a particular disk get wonky, I just run "dos2unix" :D

July 30, 2003 08:48 PM


Trackback Pings

TrackBack URL for this entry: