[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dbmopen suddenly broken



on 12/28/1999 9:30 AM, Jamie Gerdes at jgerdes@cimedia.com wrote:

(snip)

> upgraded (fresh install) to RedHat 6.1 from the CD.  Now, my bot can
> no longer open any of the data files because of a dbmopen error:
> 
> Invalid argument at DBM.pl line 15
> 
> I haven't changed the code a bit.  The PERL newsgroups haven't given
> me any leads on what to do, so I thought I'd check with you guys to
> see if anyone has had a smiliar problem.  Here's line 15 of DBM.pl...
> 
> dbmopen(%plusplus, $param{'plusplus'}, 0644) || warn
> ("....blah..");
> 
> I get the same "invalid argument" error for all of my dbmopens.   I'm
> running PERL 5.005_03 and have the same problem on two different
> computers (both with RH 6.1).  Has anyone seen this?
> 
> Thanks.
> 
> ..jamie

I'm having similar problems since upgrading to Redhat 6.1.  I am extremely
new to perl and linux, so I have no idea how to fix this.  Any suggestions?

Error (from cron):
No write permission to ndbm file at /home/brain/infobot/src/DBM.pl line 104,
<FH> chunk 56.

in DBM.pl:

sub set {
    my ($db, $key, $val) = @_;
    my %dbs = %DBMS;

    if (!$key) {
    ($db, $key, $val) = split(/\s+/, $db);
    }

    # this is a hack to keep set param consistent.. overloaded
    if ($db eq 'param') {
    my $was = $param{$key};
    $param{$key} = $val;
    return $was;
    }

    $dbname = "$DBprefix$db";
    my $was = $$dbname{$key};
    $$dbname{$key} = $val;          # <-- this is line 104

    #if ($param{'commitDBM'} eq 'ALWAYS') {
    # close and reopen the dbm file on each update.
    # what a pain.  some implementations commit to
    # disk on every update; some, however, do not.
    # if you don't do this on the ones that do not,
    # you can lose all new updates if the process
    # dies.
    #    &closeDBM($db);
    #    my $trycount = 0;
    #    while ((++$trycount < 10) && &openDBM($db => $dbs{$db})) {
    #        sleep 1;
    #    }
    #} elsif ($param{'commitDBM'} =~ /^\d+/) {
    #    if (!(++$strobe % $param{'commitDBM'})) {
    #        # close and reopen the dbm file every N
    #        # allow a refractory period.  the dbm takes some time
    #        # to close and reopen. this is safer but still
    #        # a rather stupid way to do this.
    #        &closeDBM($db);
    #        my $trycount = 0;
    #        while ((++$trycount < 10) && &openDBM($db => $dbs{$db})) {
    #            sleep 1;
    #        }
    #    }
    #}
    return $was;
}