Question

I finally found an answer to my question when I wanted to post it! However I'll still post it, including my answer, in case it helps someone else:

When converting from CVS to Subversion cvs2svn failed on some files with the message

"xxx is not a valid ,v file"

What's the problem?

Was it helpful?

Solution

As it turns out CVSNT omits the last 0xa from some files where cvs2svn needs them. This can be easily fixed with the following c# code:

static void Main(string[] args)
{
  foreach (string file in Directory.GetFiles(args[0], "*,v", SearchOption.AllDirectories))
  {
    using (FileStream sin=File.Open(file, FileMode.Open, FileAccess.ReadWrite))
    {
      sin.Position=sin.Length-1;
      if (sin.ReadByte()==0x40)
      {
        Console.WriteLine("fixed "+file);
        sin.WriteByte(0xa);
      }
    }
  }
}

OTHER TIPS

In my case there was corruption in the symbols section of the xxx,v file. The expected format is tag_name:tag_rev, but there were instances of:

  • Missing :tag_rev
    e.g. tag_name
    Fixed by deleting the line.
  • Multiple tag_name
    e.g. tag_name1:tag_name2:tag_rev
    Fixed by removing the second tag name (which one you remove probably depends on what they are).
  • Invalid name/revision delimiter. In my case the invalid character was always z (there is only 1-bit difference between ASCII : and z).
    e.g. tag_nameztag_rev
    Fixed by replacing the z with :.

To help during my investigation I added a print line to cvs2svn_rcsparse\common.py. If parsing the symbols fails, the last tag printed is the cause.

def _parse_admin_symbols(self, token):
while 1:
  tag_name = self.ts.get()
  # WileCau print the token and tag_name
  print 'token=|%s| tag_name=|%s|' % (token, tag_name)
  if tag_name == ';':
    break
  self.ts.match(':')
  tag_rev = self.ts.get()
  self.sink.define_tag(tag_name, tag_rev)

The additional print adds quite a lot of noise to the output so it might be nicer to only print if an exception happens, but this was good enough for my needs.


I also found this link which turned out to not be my problem but may help someone else. Credit to Christian Haarmann for documenting it.

http://tigris-scm.10930.n7.nabble.com/suggestions-for-cvs2svn-fix-for-error-quot-myfile-txt-v-is-not-a-valid-v-file-quot-td54240.html

In case the link becomes invalid, the summary is that someone had edited the xxx,v file and their editor had replaced 0x0A (LF) with 0x0D/0x0A (CR/LF), and the additional character caused the parser to think the file was corrupt.

I've also such an error. When I use cvs2git in order to migrate a cvs repository to git, this error occurs for several files. I have detected that there is missing a closing 0x40 (@) at the end of file.

So my solution is:

1. Open the corrupted cvs-history-file e.g. with vim (maybe in binary mode)
2. Add the missing @

If this doesn't fix the problem, then compare the content of the corrupted file with the RCS-file format: rcs_man_page

One way to troubleshoot this is to run rcs log *file,v*, which may provide you some insight.

In my case, I had some files missing @'s, some files missing a semicolon, and the tool I used to import my old repository onto the cvspserver had thrown in an unreferenced version.

Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top