cvs broken on MacOs-Catalina? (cannot get working directory)

Viewed 1559

I've just upgraded my Mac to Catalina and cvs does not seem to be working. Almost every command I try gives me a variant on the error:

cvs [init aborted]: cannot get working directory: No such file or directory

This is true not just for existing repositories, but if I try to set up a new repository or a new cvsroot (as above).

I've tried re-installing cvs via Homebrew but the problem remains.

Is anyone else experiencing this and does anyone have suggestions for workarounds? (Obviously I could shift this stuff to git or similar, but its mostly legacy projects and I'm not that enthusiastic to go to the effort)

4 Answers

In case you have homebrew:

brew remove cvs
brew install cvs

did the trick for me. The new binary will be in /usr/local/bin/cvs, make sure you call that binary and not the catalina one (in /usr/bin/cvs)
Simply typing "brew update; brew upgrade" - what you should do after an OS upgrade - will not be enough.

cannot get working directory only exists one place in the CVS source code, so was pretty easy to track it down to something awry in xgetcwd(). xgetcwd() eventually calls getcwd(), but apparently isn't using the version defined in unistd.h in Catalina, but its own version from "getcwd.h" which is included in the CVS source.

I don't have the time to track down why it works pre-Catalina, but the following patch forces the issue and worked for me on 10.15.

--- cvs-1.12.13/lib/xgetcwd.c.orig      2019-10-10 22:52:37.000000000 -0500
+++ cvs-1.12.13/lib/xgetcwd.c   2019-10-10 22:53:32.000000000 -0500
@@ -26,8 +26,9 @@

 #include <errno.h>
 #include <limits.h>
+#include <unistd.h>

-#include "getcwd.h"
+/* #include "getcwd.h" */
 #include "xalloc.h"

 /* Return the current directory, newly allocated.

I had the same problem with CVS from Homebrew. CVS from macports fixed the issue for me.

As an temporary solution you can use Java version of cvs client command from Netbeans https://netbeans.org/projects/versioncontrol/downloads/. Simple script

#!/bin/bash
java -Dcvs.root=$CVSROOT -jar org-netbeans-lib-cvsclient.jar $@

works almost exactly identical as original cvs command. It is not optimal solution, but works.

Related