[Catalyst] Keep getting checksum mismatch problems each time I regenerate my schema files

kakimoto at tpg.com.au kakimoto at tpg.com.au
Fri Apr 17 02:27:28 GMT 2009


Hello, John

 thank you for your response.

Quoting John Romkey <romkey at apocalypse.org>:

> On Apr 16, 2009, at 12:41 AM, kakimoto at tpg.com.au wrote:
> >   I keep getting a checksum mismatch problems each time I
> regenerate  
> > my
> > schema files.
> >
> > What's the most common fault and solution? I really don't know
> why..
> 
> Look in the schema file. You see this line?
> 
> # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum: XXXXXXXX
> 
> it means that you modified that line or something above it...

Yes I do see the line.

If the way the check is to be done is so stringent (ie. permissions on
the files it touches or even new lines, surely, the makers of this
package could come up with somethign better. I don't have the same issue
when using Ruby on Rails' Active Records).

As per the source code,
"/usr/local/share/perl/5.8.9/DBIx/Class/Schema/Loader/Base.pm
", here's what I did to silence it temporarily.



how i solved the checksum mismatch problem temporarily


sub _get_custom_content {
    my ($self, $class, $filename) = @_;

    return if ! -f $filename;
    open(my $fh, '<', $filename)
        or croak "Cannot open '$filename' for reading: $!";

    my $mark_re =
        qr{^(# DO NOT MODIFY THIS OR ANYTHING ABOVE!
md5sum:)([A-Za-z0-9/+]{22})\n};

    my $found = 0;
    my $buffer = '';
    while(<$fh>) {
        if(!$found && /$mark_re/) {

        print qq| found is $found...\n|;
            $found = 1;
            my $one = $1;
            $buffer .= $one;
            my $two = $2;
#            print qq| buffer is $buffer\n|;
#            print qq| Two is $two\n|;
#            print qq| one is $one...\n|;
#            print qq| checksum base 64 is '| . 
Digest::MD5::md5_base64($buffer) . qq|'\n|;
#            croak "Checksum mismatch in '$filename'"
#                if Digest::MD5::md5_base64($buffer) ne $two;

            $buffer = '';
        }
        else {
            $buffer .= $_;
        }
    }

    croak "Cannot not overwrite '$filename' without
'really_erase_my_files',"
        . " it does not appear to have been generated by Loader"
            if !$found;

    return $buffer;
}






More information about the Catalyst mailing list