Skip Menu |
 

This queue is for tickets about the SVN-Dump CPAN distribution.

Report information
The Basics
Id: 56868
Status: resolved
Priority: 0/
Queue: SVN-Dump

People
Owner: Nobody in particular
Requestors: saldane [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.05



Subject: Patch for SVN-Dump-0.04 to add md5 digest support
Date: Fri, 23 Apr 2010 17:42:57 -0400
To: bug-SVN-Dump [...] rt.cpan.org
From: Scott MacPhee <saldane [...] gmail.com>
Download (untitled) / with headers
text/plain 1.9k
This patch adds md5 checking, and regenerates when update_headers() is called. Additionally, accepts blank lines before head segments. diff -r a941ac7aa981 Dump/Reader.pm --- a/Dump/Reader.pm Fri Apr 23 15:52:40 2010 -0400 +++ b/Dump/Reader.pm Fri Apr 23 17:34:11 2010 -0400 @@ -51,6 +51,10 @@ + ( $headers->{'Text-content-length'} || 0 ) != ( $headers->{'Content-length'} || 0 ); + croak "Checksum mismatch" + if $headers->{'Text-content-md5'} + && $headers->{'Text-content-md5'} ne $record->get_text_md5(); + # if we have a delete record with a 'Node-kind' header # we have to recurse for an included record if ( exists $headers->{'Node-action'} @@ -82,8 +86,11 @@ my $line = <$fh>; croak _eof() if !defined $line; chop $line; - last if $line eq ''; # stop on empty line - + + # stop on empty line after we have headers + last if $line eq '' && keys %$headers; + next if $line eq ''; + my ($key, $value) = split /: /, $line, 2; $headers->{$key} = $value; } diff -r a941ac7aa981 Dump/Record.pm --- a/Dump/Record.pm Fri Apr 23 15:52:40 2010 -0400 +++ b/Dump/Record.pm Fri Apr 23 17:34:11 2010 -0400 @@ -7,6 +7,8 @@ use SVN::Dump::Property; use SVN::Dump::Text; +use Digest::MD5 'md5_hex'; + my $NL = "\012"; sub new { @@ -89,6 +91,8 @@ if defined $self->get_text_block(); $self->set_header( 'Prop-content-length', $proplen ); $self->set_header( 'Content-length' => $proplen + $textlen ); + $self->set_header( 'Text-content-md5' => $self->get_text_md5() ) + if $self->get_header( 'Text-content-md5'); } # access methods to the inner blocks @@ -143,6 +147,13 @@ return defined $text_block ? $text_block->get() : undef; } +sub get_text_md5 { + my ($self) = @_; + my $text_block = $self->get_text_block(); + my $text = defined $text_block ? $text_block->get() : ''; + return md5_hex($text); +} + 1; __END__
Subject: Re: [rt.cpan.org #56868] Patch for SVN-Dump-0.04 to add md5 digest support
Date: Mon, 26 Apr 2010 09:49:12 +0200
To: Scott MacPhee via RT <bug-SVN-Dump [...] rt.cpan.org>
From: "Philippe Bruhat (BooK)" <book [...] cpan.org>
Download (untitled) / with headers
text/plain 1.1k
On Fri, Apr 23, 2010 at 05:43:21PM -0400, Scott MacPhee via RT wrote: Show quoted text
> Fri Apr 23 17:43:16 2010: Request 56868 was acted upon. > Transaction: Ticket created by saldane@gmail.com > Queue: SVN-Dump > Subject: Patch for SVN-Dump-0.04 to add md5 digest support > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: saldane@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=56868 > > > > This patch adds md5 checking, and regenerates when update_headers() is called. >
Thanks for the patch. It doesn't work with dumps generated with the --deltas option. I've reimplemented it in part to support the new sha1 digest header. I've just added a digest() method to SVN::Dump::Text for now. I doubt SVN::Dump will ever support the delta format of svndump, so I'll find another way to optionaly enable those checks and recomputations. -- Philippe Bruhat (BooK) When it is time for voting- / In the West or in the East- Why must we always settle for- / The man we hate the least? (Intro poem to Groo The Wanderer #108 (Epic))
Subject: Re: [rt.cpan.org #56868] Patch for SVN-Dump-0.04 to add md5 digest support
Date: Mon, 26 Apr 2010 18:35:25 -0400
To: bug-SVN-Dump [...] rt.cpan.org
From: Scott MacPhee <saldane [...] gmail.com>
Download (untitled) / with headers
text/plain 821b
On Mon, Apr 26, 2010 at 03:49, Philippe 'BooK' Bruhat via RT <bug-SVN-Dump@rt.cpan.org> wrote: Show quoted text
> Thanks for the patch. It doesn't work with dumps generated with the --deltas > option. I've reimplemented it in part to support the new sha1 digest header. > > I've just added a digest() method to SVN::Dump::Text for now. >
That sounds great. I was only working with subversion v1.4 dumps, which only generated the MD5's, so I only included what I could test easily. Your module worked great for filtering out sensitive data from an old repository. Thanks for providing it. Show quoted text
> I doubt SVN::Dump will ever support the delta format of svndump, so I'll find > another way to optionaly enable those checks and recomputations. >
No worries, it's pretty trivial to svnadmin load && svnadmin dump to convert a delta to full dump.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.