Subject: | Parse error and exit after "no UUID" warning |
I generated a Subversion dump file from a Microsoft VSS repository by
using the Polarion svnimporter tool
(http://community.polarion.com/index.php?page=overview&project=svnimporter).
While trying to write a Perl script to fix some issues with the dumpfile
due to bugs in the svnimporter, I also discovered that it omits the
UUID: header in the file.
SVN::Dumpfile catches this condition, carps about it and presumably
continues along. However, shortly after that, a syntax error is emitted
and the script exits. I have attached a simple dump file that exhibits
the problem.
I found that the Revision-number line is consumed by the UUID check, and
when code in Node.pm attempts to read the dumpfile node, it can't locate
the revision number.
I get a sequence of errors like this:
Error: Dumpfile looks invalid. Couldn't find valid 'UUID' header.
at ./fix_dump.pl line 16
No node start found at input file position 75. at
/usr/lib/perl5/site_perl/5.10/SVN/Dumpfile/Node.pm line 221
My attached diff saves the current file position, and if the UUID header
isn't present, it restores it so parsing will not fail later.
I read another SVN::Dumpfile bug description, and it's possible that my
patch will break usage when reading from a pipe. If that's the case, is
there another way to fix the problem?
Thank you,
Greg Larkin
SourceHosting.net, LLC
http://www.sourcehosting.net/
Subject: | Dumpfile.pm.diff |
--- /usr/lib/perl5/site_perl/5.10/SVN/Dumpfile.pm.orig 2009-04-22 15:01:02.763220400 -0400
+++ /usr/lib/perl5/site_perl/5.10/SVN/Dumpfile.pm 2009-04-22 15:03:25.669470400 -0400
@@ -273,6 +273,7 @@
}
if ( $self->{'SVN-fs-dump-format-version'} > 1 ) {
+ my $pos = $fh->tell;
while ( ( $line = $fh->getline ) =~ /^$/ ) { }
if ( $line =~ /^UUID: (.*)$/ ) {
$self->{'UUID'} = $1;
@@ -280,6 +281,8 @@
else {
carp "Error: Dumpfile looks invalid. Couldn't find valid ",
"'UUID' header.\n";
+ # reset filehandle position
+ $fh->seek($pos, 0);
}
# read blank line after UUID:
Subject: | no-uuid-out-of-order.dump |
Message body not shown because it is not plain text.