An interesting error on “cvsimport” for git.

I’m writing this up in the hope that google might pick it up, and that it might help people in a similar situation.

Lately I have been moving from CVS to git for the storage of my source code. When converting all my projects over, I used tge “cvsimport” function of git. Though a few of them failed. I took some time today and fixed those issues.

When importing a project called “bingo”, I received the following cryptic error:

%> git cvsimport -C bingo.cvs2git -d /opt/cvs/repository/ -A /opt/git/author.txt bingo

Initialized empty Git repository in /opt/git/bingo.cvs2git/.git/
Unknown: error

“Unknown: error” doesn’t help that much. So I added “-v” for some verbosity.

%> git cvsimport -v -C bingo.cvs2git -d /opt/cvs/repository/ -A /opt/git/author.txt bingo

Initialized empty Git repository in /opt/git/bingo.cvs2git/.git/
Running cvsps...
cvs_direct initialized to CVSROOT /opt/cvs/repository/
cvs rlog: Logging bingo
NOTICE: used alternate strip path /opt/cvs/repository/bingo/bingo.
WARNING: file /opt/cvs/repository/bingo/Attic/bingo.html doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
WARNING: file /opt/cvs/repository/bingo/edit.cgi doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
WARNING: file /opt/cvs/repository/bingo/giza-face.jpg doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
WARNING: file /opt/cvs/repository/bingo/Attic/giza-text.jpg doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
WARNING: file /opt/cvs/repository/bingo/index.cgi doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
WARNING: file /opt/cvs/repository/bingo/Attic/index.html doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
WARNING: file /opt/cvs/repository/bingo/triggur-face.jpg doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
WARNING: file /opt/cvs/repository/bingo/Attic/triggur-text.jpg doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
cvs rlog: Logging bingo/db
WARNING: file /opt/cvs/repository/bingo/db/bingo-schema.sql doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
WARNING: file /opt/cvs/repository/bingo/db/bingo.sql doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
WARNING: file /opt/cvs/repository/bingo/db/dbsave.sh doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
cvs rlog: Logging bingo/lib
WARNING: file /opt/cvs/repository/bingo/lib/Bingo.pm doesn't match strip_path /opt/cvs/repository/bingo/bingo.. ignoring
Fetching cgi v 1.1
Unknown: error

Now we have some useful detail. If you look at the line I’ve marked in italics, it’s shifting the path to “bingo/bingo” which doesn’t exist and then nothing is able to be imported. Something is causing git to incorrectly adjust the path.

After some googling I found that git is using “cvsps” under the covers. And that you could turn up the verbosity of “cvsps,” by using the “cvsimport” switch -p to pass a “-v” down to “cvsps.” They weren’t kidding. It dials the noise all the way up to 11.

%> git cvsimport -v -p "-v" -C bingo.cvs2git -d /opt/cvs/repository/ -A /opt/git/author.txt bingo

Running cvsps...
strip_path: /opt/cvs/repository//bingo/
read cache_date 1369173644
read cache filename 'cgi'
added revision 1.1 to file cgi
revision 1.1 of file cgi on branch HEAD
added revision 1.2 to file cgi
revision 1.2 of file cgi on branch HEAD
added revision 1.3 to file cgi
revision 1.3 of file cgi on branch HEAD
added revision 1.4 to file cgi
revision 1.4 of file cgi on branch HEAD
added revision 1.5 to file cgi
revision 1.5 of file cgi on branch HEAD
added revision 1.6 to file cgi
revision 1.6 of file cgi on branch HEAD
added revision 1.7 to file cgi
revision 1.7 of file cgi on branch HEAD
added revision 1.8 to file cgi
revision 1.8 of file cgi on branch HEAD
added revision 1.9 to file cgi
revision 1.9 of file cgi on branch HEAD
patch set 1122909837 cvs Initial import of the old bingo game.
HEAD
new patch set!
cvs Initial import of the old bingo game.
1122909837
patch set 1122911429 cvs Creating a web page.
HEAD
new patch set!
cvs Creating a web page.
1122911429
patch set 1122923863 cvs slowly building out more so folks can edit their own bingo things.
HEAD
new patch set!
cvs slowly building out more so folks can edit their own bingo things.
1122923863
patch set 1122924036 cvs Now access() is in the module and not the CGI.
HEAD
new patch set!
cvs Now access() is in the module and not the CGI.
1122924036
patch set 1122928663 cvs Triggur's card info is comint out of the DB now.
HEAD
new patch set!
cvs Triggur's card info is comint out of the DB now.
1122928663
patch set 1122932744 cvs Now the title graphics are auto-generated.
HEAD
new patch set!
cvs Now the title graphics are auto-generated.
1122932744
patch set 1122935182 cvs Yay for dynamic cards with pages.
HEAD
new patch set!
cvs Yay for dynamic cards with pages.
1122935182
patch set 1123011990 cvs Now with a non-race-condition randomizer.
HEAD
new patch set!
cvs Now with a non-race-condition randomizer.
1123011990
patch set 1123272482 cvs We now officially draw everything from the DB.
HEAD
new patch set!
cvs We now officially draw everything from the DB.
1123272482
forked cmdline: cvs server
string: 'Root /opt/cvs/repository/
' sent
string: 'Valid-responses ok error Valid-requests Checked-in New-entry Checksum Copy-file Updated Created Update-existing Merged Patched Rcs-diff Mode Mod-time Removed Remove-entry Set-static-directory Clear-static-directory Set-sticky Clear-sticky Template Set-checkin-prog Set-update-prog Notified Module-expansion Wrapper-rcsOption M E F
' sent
string: 'valid-requests
' sent
string: 'UseUnchanged
' sent
cvs_direct initialized to CVSROOT /opt/cvs/repository/
string: 'version
' sent
cvs_direct: client version Client: Concurrent Versions System (CVS) 99.99.99 (client/server) cvs-direct
cvs_direct: server version Server: Concurrent Versions System (CVS) 1.11.22 (client/server)
******* USING CMD cvs -f rlog -d '21 May 2013 22:00:44 +0000<;21 May 2013 22:00:44 +0000' bingo string: 'Argument -d ' sent string: 'Argument 21 May 2013 22:00:44 +0000<1 Jan 2038 05:00:00 -0000 ' sent string: 'Argument -d ' sent string: 'Argument 21 May 2013 22:00:44 +0000 ' sent string: 'Argument bingo ' sent string: 'rlog ' sent cvs_direct: rlog: read E cvs rlog: Logging bingo cvs rlog: Logging bingo state: 0 read line: cvs_direct: rlog: read M state: 0 read line: cvs_direct: rlog: read M RCS file: /opt/cvs/repository/bingo/bingo.cgi,v
state: 0 read line:RCS file: /opt/cvs/repository/bingo/bingo.cgi,v

NOTICE: used alternate strip path /opt/cvs/repository/bingo/bingo.
stripped filename cgi
existing file: cgi

cvs_direct: rlog: read M head: 1.9
state: 1 read line:head: 1.9

cvs_direct: rlog: read M branch:
state: 1 read line:branch:

cvs_direct: rlog: read M locks: strict
state: 1 read line:locks: strict

cvs_direct: rlog: read M access list:
state: 1 read line:access list:

cvs_direct: rlog: read M symbolic names:
state: 1 read line:symbolic names:

cvs_direct: rlog: read M keyword substitution: kv
state: 2 read line:keyword substitution: kv

cvs_direct: rlog: read M total revisions: 9; selected revisions: 1
state: 3 read line:total revisions: 9; selected revisions: 1

cvs_direct: rlog: read M description:
state: 3 read line:description:

cvs_direct: rlog: read M ----------------------------
state: 3 read line:----------------------------

… and hundreds more lines.

And the important point is highlighted in italics again. I found it by searching for where that “strip path” changed.

There is a file called “bingo.cgi” in the root of the project called “bingo.” And that is what is mussing things up.

I’m assuming that something about how cvsimport interpolates file types has it strip the extension off it. There must also be a routine that checks the directory path by looking for the project name on the end of the current working directory. When the two collide, “bingo.cgi” makes cvsps think it needs to change to “bingo/bingo” as the repository path.

So the simple solution? I renamed project “bingo” to “bingo1” before importing it into git. And it worked perfect.

Isn’t it funny how the weird errors so often come down to something like a file name.

2 Responses to “An interesting error on “cvsimport” for git.”

  1. dgags says:

    This is really excellent information. I regularly convert subversion repos to git as part of my day job. I use a ruby project called svn2git. I swear by it. And as a matter of course i have to make a dir to do the conversion into. Interestingly enough i never name the dir i am converting into after the project name. I doubt this is a problem, but next time i get an opportunity to convert one of the many svn repos we have at work, i’m going to try this to see if it effects svn too.

  2. Phil says:

    It seems that the svn2git guys also did a cvs2git option. If this hand’t have worked out, I would have gone that route. “cvsimport” is built into git so I opted to try that first.

    I have to do a transitional directory as well. Though I’m not sure if you’re referring to SVN or to git. I end up making a temp git repository and then do a “git –bare fetch” into a new bare repository on the server. The server side stuff all needs to be “bare” and the conversion stuff builds non-bare local repositories.

    I’ll probably post the whole script I’m using here soon. It’s been a “git-pocalypse.”

    I am really starting to like git. I’m glad to hear it has traction around where you are at too.

Leave a Response